Jump to content
  • 0

How to change the format of this to use date..


Question

Posted

I have currently this code..

 

OnInit: bindatcmd("dailyreward",strnpcinfo(0)+"::OnAtCmd"); end;
OnAtCmd:
if (#dailyreward > gettimetick(2)) {
     message strcharinfo(0),"You must wait 24 hours before receiving more items.";
     end;
}
// getitem x,y;
set #dailyreward, gettimetick(2)+86400;
end;

 

It uses 24 hours cooldown for the daily reward. How to set it to check the date? example. If today is tuesday and he claims the reward, when the server date changes to wednesday, he can already get the reward. As long as you can use the command once per day..

 

How to do activate this command once per day only? Not via 24 hours cooldown.

4 answers to this question

Recommended Posts

Posted

OnInit: bindatcmd("dailyreward",strnpcinfo(0)+"::OnAtCmd"); end;
OnAtCmd:
set .@today, atoi(gettimestr("%Y%m%d", 9)); 

if (#dailyreward == .@today ) {
     message strcharinfo(0),"You should try tomorrow to receive more items.";
     end;
}
// getitem x,y;
set #dailyreward, .@today;
end;
It should do the job :)

It set #dailyreward to the date, example today: 20130412.

Edit: hehe, Emistry is faster :)

  • Upvote 1
Posted

shutdown server and try run this query in your SQL Machine..

backup ur database just in case anything happen...

DELETE FROM `global_reg_value` WHERE `str` LIKE '#dailyreward';
  • Upvote 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...