SA-MP Forums Archive
Need help with 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: Need help with settimer. (/showthread.php?tid=293965)



Need help with settimer. - Admigo - 30.10.2011

Heey all,
I want to make a timer for backup for police.
So if you use the command for backup your colour will be setted to purple for 3 mins and after 3 mins it will be blue again.
How can i do this because i am not good with timers.

Thanks admigo


Re: Need help with settimer. - Gamer_Z - 30.10.2011

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


Re: Need help with settimer. - Admigo - 30.10.2011

Already readed that,i dont understand it.
This code dont works:
Код:
//top of script
forward backuptimer(playerid);
//onkidnapcommand 
SetTimer("backuptimer",10000,0);//i setted so low for test

public backuptimer(playerid)
{
	SetPlayerColor(playerid,COLOR_BLUE);
    return 1;
}
How can i fix it?


Re: Need help with settimer. - Jakku - 30.10.2011

pawn Код:
new PlayerTimer[MAX_PLAYERS];

forward Timer(playerid);

PlayerTimer[playerid] = SetTimerEx("Timer", 1000*180, 0, "d", playerid);

public Timer(playerid)
{
SetPlayerColor(playerid, COLOR_BLUE);
KillTimer(PlayerTimer[playerid]);
}
At least this works

1000*180 = 180000 milliseconds = 180 seconds = 180 seconds / 60 = 3 minutes

Hope this helps you and you can build the another timer


Re: Need help with settimer. - Admigo - 30.10.2011

OMG,Thank you so much.