[FNC] Passanger counter - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (
https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FNC] Passanger counter (
/showthread.php?tid=80029)
[FNC] Passanger counter -
Ignas1337 - 01.06.2009
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.
Re: [???] Passanger counter -
KeyWay - 01.06.2009
Thats maybe INCLUDE?
Re: [???] Passanger counter - Double-O-Seven - 01.06.2009
It's only a function, you don't need to include it.
Re: [???] Passanger counter -
Ignas1337 - 01.06.2009
just as I was going to tell this guy
Re: [FNC] Passanger counter -
Weirdosport - 01.06.2009
Probably belongs here:
http://forum.sa-mp.com/index.php?topic=61574.0
Re: [FNC] Passanger counter -
Ignas1337 - 02.06.2009
yes, will add right away