Crazy Timer bug
#1

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
Reply
#2

KillTimer(Rentbike(playerid));
is wrong. change it to the timers variable.
Reply
#3

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);
Reply
#4

Aah of couse,

Stupid, thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)