SA-MP Forums Archive
Is this possible? - 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: Is this possible? (/showthread.php?tid=233816)



Is this possible? - cloudysky - 02.03.2011

That when a trailer disconnects from a truck, that it cancels a checkpoint?


Re: Is this possible? - tuuker - 02.03.2011

It is possible.


Re: Is this possible? - cloudysky - 02.03.2011

Quote:
Originally Posted by tuuker
Посмотреть сообщение
It is possible.
Ah nice, how would you go about doing it?


Re: Is this possible? - PowerPC603 - 03.03.2011

Have a timer running for every player that checks if the trailer is still connected to your vehicle.

First store the vehicleid of the attached trailer somewhere.
Then start a timer which runs every second and let that timer check if vehicleid of the attached trailer is still the same as you stored before.
If it's the same, do nothing.
If it's not the same, cancel the checkpoint (and perhaps kill the timer).


Re: Is this possible? - Antonio [G-RP] - 03.03.2011

pawn Код:
new Timer[MAX_PLAYERS];

forward CheckAttached(playerid);
public CheckAttached(playerid);
{
    new veh = GetPlayerVehicleID(playerid);
    if(!IsTrailerAttachedToVehicle(veh)) return DisablePlayerCheckpoint(playerid);
    KillTimer(Timer[playerid]);
}

Timer[playerid] = SetTimerEx("CheckAttached", 1000, 1, "i", vehicleid); // When you attach trailer or create the checkpoint



Re: Is this possible? - cloudysky - 03.03.2011

Thanks!