SA-MP Forums Archive
SetTimer - 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: SetTimer (/showthread.php?tid=293371)



SetTimer - Speed - 28.10.2011

I want to add parametar "%d" to SetTimer function...

Here is command:

pawn Код:
CMD:test(playerid, params[])
{
    new time;
    if(sscanf(params, "i", time))return SendClientMessage(playerid, -1, "Usage: /test [minutes]");
    SetTimer("Over", %d*1000*60, false)
    return 1;
}
Can this works??

and will this Timer repet just once?

When i type command, timer goes, and after end he dont repeat again only if I type command again??


Re: SetTimer - Steve M. - 28.10.2011

Here is the example for your command:
pawn Код:
SetTimer("Over", time*1000, true);
If you want to convert minutes to miliseconds you don't need '*60'.

And if you want for timer to repeat you have to put 'true', not 'false' for repeating parameter.


Re: SetTimer - wumpyc - 28.10.2011

This should work
PHP код:
CMD:test(playeridparams[])
{
    new 
time;
    if(
sscanf(params"i"time))return SendClientMessage(playerid, -1"Usage: /test [minutes]");
    
SetTimer("Over",time*1000false);
    return 
1;




Re: SetTimer - Steve M. - 28.10.2011

Quote:
Originally Posted by ******
Посмотреть сообщение
Yes you DO need to put "* 60", otherwise "7" will only give 7 seconds, not 7 minutes.
That's right. I mixed up seconds and minutes. Thanks for the correction.