SA-MP Forums Archive
Command ever 60 seconds - 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: Command ever 60 seconds (/showthread.php?tid=337239)



Command ever 60 seconds - lonako45 - 25.04.2012

OK
I make if player make /a j
it write him : XXXXXXXXXXXX
But now I want he make /a j and if the player make /a j again
its write him : You been asked to join the activity wait another 60 seconds
Then another 60 seconds he could make the command again


Re: Command ever 60 seconds - Vince - 25.04.2012

Put this at the top of the command:
pawn Код:
static LastAction[MAX_PLAYERS]; // very important that it's declared static!

if((gettime() - LastAction[playerid]) < 60)
    return SendClientMessage(playerid, COLOR_RED, "Please wait 60 seconds!");

LastAction[playerid] = gettime();

// rest of stuff here



Re: Command ever 60 seconds - lonako45 - 25.04.2012

OK TNX
and if the 60 seconds have passed
I want its write : 60 seconds have passed you can use the command again


Re: Command ever 60 seconds - lonako45 - 26.04.2012

HELP ??


Re: Command ever 60 seconds - RollTi - 26.04.2012

pawn Код:
if((gettime() - LastAction[playerid]) == 60)
    return SendClientMessage(playerid, COLOR_RED, "60 seconds have passed you can use the command again");
that is little bit annoying player will wait 60 seconds turn it to 3, 5 seconds or whatever so no user will complain about your anti command spam


Re: Command ever 60 seconds - lonako45 - 26.04.2012

Dont work
its not send message : 60 seconds passed
PHP код:
static LastAction[MAX_PLAYERS]; 
        if((
gettime() - LastAction[playerid]) < 60) return SendClientMessage(playerid,White"бйчщъ одазшай мцшу аеък мфтймеъ , злд гчд еъелм мдщъощ щеб бфчегд");
        if((
gettime() - LastAction[playerid]) == 60) return SendClientMessage(playerid,White"гчд тбшд , аъд йлем мбчщ мдцишу мфтймеъ щеб");
        
LastAction[playerid] = gettime(); 



Re: Command ever 60 seconds - MP2 - 26.04.2012

Set a 60 second timer instead of using gettime().

https://sampwiki.blast.hk/wiki/SetTimerEx


Re: Command ever 60 seconds - lonako45 - 26.04.2012

I dont understand you


Re: Command ever 60 seconds - lonako45 - 26.04.2012

I put this :
ActivityJoin[playerid] = SetTimerEx("ActivityJoin",1000,0, "i", playerid);
Error:
error 029: invalid expression, assumed zero
error 029: invalid expression, assumed zero


Re: Command ever 60 seconds - MP2 - 26.04.2012

Show the declaration of ActivityJoin. Also, are you sure it's on THAT line?