Is it possible? - 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: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Is it possible? (
/showthread.php?tid=426633)
Is it possible? -
TrueForYourSelf - 29.03.2013
So basically I want to know is this possible?
SO I want to know how is possible to count how much people is in the car?
I need to count how much people is in one bus or train..
And I want to know how it's possible?
Re: Is it possible? -
SuperViper - 29.03.2013
pawn Код:
CountPlayersInVehicle(countVehicle)
{
new playerCount;
for(new playerIndex; playerIndex < MAX_PLAYERS; playerIndex++)
{
if(IsPlayerInVehicle(playerIndex, countVehicle))
{
playerCount++;
}
}
return playerCount;
}
Usage:
pawn Код:
new clientMessage[128];
format(clientMessage, sizeof(clientMessage), "There are %d players in your vehicle.", CountPlayersInVehicle(GetPlayerVehicleID(playerid)));
SendClientMessage(playerid, -1, clientMessage);
Re: Is it possible? -
Sandiel - 29.03.2013
Nevermind this
Re: Is it possible? -
MP2 - 29.03.2013
Trains are an exception. They consist of 4 vehicle IDs. The vehicle ID that is returned by AddStaticVehicle(Ex) [you can't use CreateVehicle for trains] is the engine. The next 3 IDs are the 3 trailers/carriages/whatever. Keep that in mind.
Re: Is it possible? -
TrueForYourSelf - 29.03.2013
So basically that possible to do.. And I need the first one as not CreateVehicle and all the rest as created vehicle to count.
thanks guys for help.