SA-MP Forums Archive
forward and timer problem - 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: forward and timer problem (/showthread.php?tid=416572)



forward and timer problem - Tamer - 17.02.2013

pawn Код:
new dosomethingtimer[MAX_PLAYERS];
CMD:dosomething(playerid,params[])
{
  SendClientMessage(playerid,GREY,"Your are doing something,it will last for 5 seconds.");
  dosomethingtimer[playerid] = SetTimerEx("dosomethingtimer", 5000, false,"i",playerid);
  return 1;

}
forward dosomethinga(playerid);
public dosomethinga(playerid)
{
    KillTimer(dosomethingtimer[playerid]);
    SendClientMessage(playerid,GREY,"You are not doing something anymore!");
    return 1;
}
It won't send the clientmessage "you are not doing something anymore!"


Re: forward and timer problem - ReneG - 17.02.2013

The first parameter in SetTimerEx is the direct function you are calling, so it should match the public you want to be executed.

pawn Код:
dosomethingtimer[playerid] = SetTimerEx("dosomethinga", 5000, false,"i",playerid);



Re: forward and timer problem - Tamer - 17.02.2013

I'll test it.


Re: forward and timer problem - Glad2BeHere - 17.02.2013

pawn Код:
SetTimerEx("dosomethingtimer", 5000, false,"i",playerid);
to
SetTimerEx("dosomethinga", 5000, false,"i",playerid);

// dosomethinga this is the function as u can see you didnt called the function you called the timer