how many players in vehicle
#2

Hi!

Yes, of course. You can use this function which I just wrote.
PHP код:
//The function you need:
stock GetVehiclePassengers(vehicleid)
{
    new 
passengers[MAX_VEHICLES];
    for(new 
i;i<MAX_PLAYERS;i++)
    {
        if(!
IsPlayerConnected(i) || IsPlayerNPC(i))continue;
        if(
GetPlayerVehicleID(i) == vehicleid)
        {
            
passengers[vehicleid] ++;
        }
    }
    return 
passengers[vehicleid];
}
//How many passengers are in this vehicle?
printf("Passengers in vehicleid %i: %i",vehicleid,GetVehiclePassengers(vehicleid));
//When you want to check wheather there is only one person in this vehicleid:
if(GetVehiclePassengers(vehicleid) == 1)printf("in vehicleid %i is only one passenger!",vehicleid); 
You have two examples how you can use this function.
Reply


Messages In This Thread
how many players in vehicle - by Alpha000 - 25.03.2016, 17:10
Re: how many players in vehicle - by Mencent - 25.03.2016, 17:41
Re: how many players in vehicle - by Abagail - 25.03.2016, 19:08
Re: how many players in vehicle - by Alpha000 - 27.03.2016, 17:51

Forum Jump:


Users browsing this thread: 2 Guest(s)