AFK Passenger teleports vehicle to OnPause position
#1

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

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.
Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)