How To Check If A Vehicle Has A Driver
#1

Hello Guys,,,

Does Anyone Know How To Check If A Vehicle Has A Driver ?

Thanks f Advance ....
Reply
#2

You can loop through all players, check if their player state is PLAYER_STATE_DRIVER and if yes, if they are sitting in the vehicle you want to get the driver of.
All in all 10 lines of code
Reply
#3

pawn Код:
public VehicleHasDriver(vehicleid)
{
     for(new i=0;i<=MAX_PLAYERS;i++)
     {
           if(IsPlayerInAnyVehicle(i))
           {
                if(GetPlayerVehicleID(i)==vehicleid)
                {
                       if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
                       {
                             return 1;
                        }
                 }
           }
     }
     return 0;
}
Reply
#4

OK ,,,
I Think That I Understood ...
Well , I Hope

Thanks For Your Quick Answer
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)