SetTimer problem...
#1

I have a timer that checks to see if a trailer is attached to a vehicle every second (its only a very small script). If my trailer disconnects, the timer, which runs every second will pick it up and exectue a code. Here is the checking script.

pawn Код:
forward TruckCheck(playerid);
public TruckCheck(playerid)
{
    if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)) == 0)
    {
        SendClientMessage(playerid, WORK, "Please reconnect your trailer");
    }
    if(IsPlayerInAnyVehicle(playerid) == 0)
    {
        SendClientMessage(playerid, WORK, "Get back in your truck!");
    }
}
And under the OnPlayerCommandText(playerid, cmdtext[]) command, (the actual command is "/work") i run the timer (after a lot of ifs)

pawn Код:
new truckchecktime; // This is called way before the actual timer
truckchecktime = SetTimer("TruckCheck", 1000, true);
EDIT: Do i then just have to call truckchecktime? Like this:
pawn Код:
truckchecktime;
I also end (KillTimer) the timer when the player has completed the mission

pawn Код:
KillTimer(truckchecktime);
This fails to work. Although compiles without warnings and errors.

I dont understand why it doesnt work.
Thanks, Ash!
Reply
#2

pawn Код:
truckchecktime = SetTimerEx("TruckCheck", 1000, true, "i", playerid)
Reply
#3

EDIT: See above
Reply
#4

bigcomfycouch: Thanks, ill try that now
Jay_: no, when the trailer disconnects, it should run the first script bit. But it doesnt. So that means the timer isnt working.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)