If vehicle has passengers?
#1

Is it possible to check and stop player from entering vehicle if there is 1 or more passengers in that car allready? i mean 1 passenger per vehicle. How to check that?
Reply
#2

Yes its possible, you should loop through all the connected players and check their vehicle ID

pawn Код:
stock IsVehiclePassengerOccupied(vehicleid)
{
    for(new i = 0: i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && GetPlayerVehicleID(i) == vehicleid && GetPlayerVehicleSeat(i) != 0)
            return true;
    }
    return false;
}
Thats function will return true there is a passenger in that vehicle, false otherwise
Reply
#3

Thank's, exactly what i was searching
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)