If any player is in vehicle? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: If any player is in vehicle? (
/showthread.php?tid=270311)
If any player is in vehicle? -
Runedog48 - 19.07.2011
The title says it all, is there a function to check if ANY player is in/driving that vehicle.
Re: If any player is in vehicle? -
cruising - 19.07.2011
Quote:
Originally Posted by Runedog48
The title says it all, is there a function to check if ANY player is in/driving that vehicle.
|
One example:
pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
for (new i = 0; i != MAX_PLAYERS; i++)
{
if(IsPlayerInAnyVehicle(i))
{
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
}
}
return 1;
}
Re: If any player is in vehicle? -
Runedog48 - 19.07.2011
Код:
for (new i = 0; i != MAX_PLAYERS; i++)
{
if(IsPlayerInAnyVehicle(i))
{
}
That might work
ty
Re: If any player is in vehicle? -
cruising - 19.07.2011
Quote:
Originally Posted by Runedog48
Код:
for (new i = 0; i != MAX_PLAYERS; i++)
{
if(IsPlayerInAnyVehicle(i))
{
}
That might work ty
|
No problems
Re: If any player is in vehicle? -
Runedog48 - 19.07.2011
can you please explain how it works?
Re: If any player is in vehicle? -
Steven82 - 19.07.2011
Why not look on the wiki. Since, hey it's on the wiki -__-.
Re: If any player is in vehicle? -
Runedog48 - 19.07.2011
Quote:
Originally Posted by Steven82
Why not look on the wiki. Since, hey it's on the wiki -__-.
|
I guess I can say thank you, even though I wanted to say fuck you I found the wiki article to be very helpful.
Re: If any player is in vehicle? -
MoroDan - 19.07.2011
Quote:
Originally Posted by Runedog48
The title says it all, is there a function to check if ANY player is in/driving that vehicle.
|
PHP код:
VehicleHasPlayer(vehicleid, &player_seat = -1)
{
for(new i = 0, j = GetMaxPlayers(); i < j; i++)
if(IsPlayerConnected(i))
if(IsPlayerInVehicle(i, vehicleid))
{
player_seat = GetPlayerVehicleSeat(i);
return i;
}
return (-1);
}
Re: If any player is in vehicle? -
Steven82 - 19.07.2011
Quote:
Originally Posted by Runedog48
I guess I can say thank you, even though I wanted to say fuck you I found the wiki article to be very helpful.
|
See what i mean? lol
Re: If any player is in vehicle? -
Sasino97 - 19.07.2011
IsPlayerInVehicle(playerid, ID of the Instance)
return 1 if true
return 0 if false
IsPlayerInAnyVehicle(playerid)