SA-MP Forums Archive
Need help to put timer on CMD - 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 to put timer on CMD (/showthread.php?tid=566015)



Need help to put timer on CMD - MBilal - 02.03.2015

Код:
new ptimer[MAX_PLAYERS];
CMD:test(playerid, params[])
{
if(pCMD[playerid]==0)
{
//CMD code there..
pCMD[playerid]=1;
ptimer[playerid] = SetTimerEx("CMDSPAWN", 60000, false,"i", playerid);

}
else{
	SCM(playerid, COLOR_YELLOW,"You need to wait 60 sec to use this CMD again!");
}
return 1;
}
forward CMDSPAWN(playerid);
stock CMDSPAWN(playerid)
{
KillTimer(ptimer[playerid]);
pCMD[playerid]=0;
return 1;
}
the Problem is timer not working..


Re: Need help to put timer on CMD - wooolly - 02.03.2015

Try setting the function to a public function rather than a stock function.
And I think KillTimer in the called function is rather redundant since it has already ended after calling the function?
do some debugging after the timer has been set and make sure it's being created properly (print out the timerid or something)


Re: Need help to put timer on CMD - MBilal - 02.03.2015

Thanks ! I just Pressed Mistakely Ctrl +Z , actually I was trying that before with stock then i put function , then i didnt see my mistake and posted but thanks !! Rep +1 hope it work.