Need help with a timering - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Need help with a timering (
/showthread.php?tid=485313)
Need help with a timering -
Acres - 03.01.2014
hey guys i need to know how am i abel to set like this that you end somethin if you write like /reward at the place then you get reward but that reward can get every hour so if you take once then you cant take it again in few sec?
Thanks for your help.
Re: Need help with a timering - Emmet_ - 03.01.2014
pawn Код:
static stock
g_LastReward[MAX_PLAYERS]
;
CMD:reward(playerid, params[])
{
if (gettime() < g_LastReward[playerid])
return SendClientMessage(playerid, -1, "You must wait 1 hour before your next reward.");
// Your code here...
g_LastReward[playerid] = gettime() + 3600;
return 1;
}
Re: Need help with a timering -
Acres - 03.01.2014
is it possibel you make it in strcmp? Thanks
Re: Need help with a timering -
xo - 03.01.2014
pawn Код:
if(strcmp("/reward", cmdtext, true) == 0)
{
if (gettime() < g_LastReward[playerid])
return SendClientMessage(playerid, -1, "You must wait 1 hour before your next reward.");
// Your code here...
g_LastReward[playerid] = gettime() + 3600;
return 1;
}
Re: Need help with a timering -
Acres - 03.01.2014
Thanks for the help worked well