Is Vehicle Occupied
#1

Hi! How can I check if a vehicle is occupied, and if it's possible I'd like know the driver's name too.

Greetings from Spain.
Reply
#2

Mm; I guess you could do something like:

pawn Код:
stock GetVehicleDriver(vid)
{
     for(new i; i < GetMaxPlayers(); i++)
     {
          if(!IsPlayerConnected(i)) continue;
          if(GetPlayerVehicleID(i) == vid && GetPlayerSeat(playerid) == 0) return i;
     }
     return INVALID_PLAYER_ID;
}
Usage: GetVehicleDriver(vehicleid)
if the vehicle is occupied. It will return the drivers player id. If it is not occupied it will return INVALID_PLAYER_ID.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)