OnPlayerDisconnect [REPS Ofcourse :D]
#5

I recommend using this instead since what the code posted above does is remove the vehicle 500 times if the player is a driver.

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new vehicleid = GetPlayerVehicleID(playerid);
            new people;
            for(new i = 0; i < MAX_PLAYERS; i ++)
            {
                if(!IsPlayerConnected(i))
                    continue;

                if(GetPlayerVehicleID(i) == vehicleid && GetPlayerState(i) == PLAYER_STATE_PASSENGER)
                    people ++;
            }
            if(!people)
                SetVehicleToRespawn(vehicleid);
        }
    }
    return 1;
}
This code will respawn the vehicle if the driver disconnects and there's no one else in the vehicle, otherwise it'll keep it.
Reply


Messages In This Thread
OnPlayerDisconnect [REPS Ofcourse :D] - by MahdiGames - 01.02.2014, 20:42
Re: OnPlayerDisconnect [REPS Ofcourse :D] - by TheFlyer - 01.02.2014, 21:19
Re: OnPlayerDisconnect [REPS Ofcourse :D] - by Duck4coder - 01.02.2014, 21:35
Re: OnPlayerDisconnect [REPS Ofcourse :D] - by MahdiGames - 01.02.2014, 21:43
Re: OnPlayerDisconnect [REPS Ofcourse :D] - by CuervO - 01.02.2014, 23:35
Re: OnPlayerDisconnect [REPS Ofcourse :D] - by MahdiGames - 02.02.2014, 06:46

Forum Jump:


Users browsing this thread: 1 Guest(s)