Need help to put timer on CMD
#1

Код:
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..
Reply
#2

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)
Reply
#3

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)