[FNC] Passanger counter
#1

i wasn't busy so I decided making a function. this function counts how many passengers are there in vehice id including or excluding driver.

pawn Code:
public GetPeopleInVehicle(vehicleid, bool:count_driver)
{
    new people_count = 0;
    switch count_driver
    {
        case true:
        {
          for(new i = 0; i < MAX_PLAYERS; i++;)
          {
            if(IsPlayerInVehicle(i, vehicleid))
            {
                    people_count++;
            }
          }
        }
        case false:
        {
          for(new i = 0; i < MAX_PLAYERS; i++;)
          {
            if(IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) != PLAYER_STATE_DRIVER)
            {
                    people_count++;
            }
          }
        }
    }
    return people_count;
}
Hope you enjoy it. It's simple, but useful. Especially for roleplay bussing system... Where i'll use it.
Reply
#2

Thats maybe INCLUDE?
Reply
#3

It's only a function, you don't need to include it.
Reply
#4

just as I was going to tell this guy
Reply
#5

Probably belongs here:

http://forum.sa-mp.com/index.php?topic=61574.0
Reply
#6

yes, will add right away
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)