AFK Passenger teleports vehicle to OnPause position - 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: AFK Passenger teleports vehicle to OnPause position (
/showthread.php?tid=492752)
AFK Passenger teleports vehicle to OnPause position -
Phil_Cutcliffe - 05.02.2014
When a player is a passenger of a vehicle. When they go afk if the driver is still driving around. If they get out their vehicle before the passenger comes back from being AFK the vehicle will be teleported to the passengers OnPause location. So I tried some code to prevent this but it didn't work.
Any ideas?
Here's my code...
pawn Код:
public OnPlayerPause(playerid)
{
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
PassengerVehicleAFK[playerid] = GetPlayerVehicleID(playerid);
SeatAFK[playerid] = GetPlayerVehicleSeat(playerid);
PassengerAFK[playerid] = 1;
return 1;
}
pawn Код:
public OnPlayerResume(playerid)
{
if(PassengerAFK[playerid] == 1)
{
PutPlayerInVehicle(playerid, PassengerVehicleAFK[playerid], SeatAFK[playerid]);
return 1;
}
The OnPlayerPause & OnPlayerResume work perfectly before you ask. I use these for alot of things in my GM. I just need to know how to re-write my code so this bug can be prevented.
Re: AFK Passenger teleports vehicle to OnPause position -
CuervO - 05.02.2014
That code will be applied whenever the player gets back from AFK, still teleporting the vehicle away.
My best solution would be to store amount of AFK players in a vehicle when the driver leaves. If there's any then save the vehicle coordinates and if any of the AFK players come back teleport the vehicle back to the saved position.
Re: AFK Passenger teleports vehicle to OnPause position -
Phil_Cutcliffe - 05.02.2014
Quote:
Originally Posted by CuervO
That code will be applied whenever the player gets back from AFK, still teleporting the vehicle away.
My best solution would be to store amount of AFK players in a vehicle when the driver leaves. If there's any then save the vehicle coordinates and if any of the AFK players come back teleport the vehicle back to the saved position.
|
Right there! That's a dudes brain working! +Repped