Crazy Timer bug - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Crazy Timer bug (
/showthread.php?tid=231524)
Crazy Timer bug -
jorambo - 25.02.2011
Heey guys,
I want to make a renting system in my GM.
Now I have a timer and when it ends I have this:
pawn Код:
public Rentbike(playerid)
{
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "Your time is up, the bike will be picked up");
return 1;
}
Now I want to kill the timer and I made this:
pawn Код:
public Rentbike(playerid)
{
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "Your time is up, the bike will be picked up");
KillTimer(Rentbike(playerid));
return 1;
}
When I do this there is comming many thimes the sendclientmessage, what do I do wrong?
Greetings
Re: Crazy Timer bug -
Think - 25.02.2011
KillTimer(Rentbike(playerid));
is wrong. change it to the timers variable.
Re: Crazy Timer bug -
BlackWolf120 - 25.02.2011
normally u set a timer like this:
pawn Код:
SetTimer("Timer_ID",interval,repeating);
But use SetTimerEx here cause u want to start a timer for only a specific player.
pawn Код:
SetTimerEx("Timer_ID",interval,repeating,"i",playerid);
Also u have to assign a variable to the timer
pawn Код:
new RentbikeTimer;
RentbikeTimer = SetTimerEx("Timer_ID",interval,repeating,"i",playerid);
And then kill it like this:
pawn Код:
KillTimer(RentbikeTimer);
Re: Crazy Timer bug -
jorambo - 25.02.2011
Aah of couse,
Stupid, thank you