If any player is in vehicle?
#1

The title says it all, is there a function to check if ANY player is in/driving that vehicle.
Reply
#2

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;
}
Reply
#3

Код:
for (new i = 0; i != MAX_PLAYERS; i++)
    {
        if(IsPlayerInAnyVehicle(i))
        {
        }
That might work ty
Reply
#4

Quote:
Originally Posted by Runedog48
Посмотреть сообщение
Код:
for (new i = 0; i != MAX_PLAYERS; i++)
    {
        if(IsPlayerInAnyVehicle(i))
        {
        }
That might work ty
No problems
Reply
#5

can you please explain how it works?
Reply
#6

Why not look on the wiki. Since, hey it's on the wiki -__-.
Reply
#7

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.
Reply
#8

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 
0GetMaxPlayers(); ji++)
        if(
IsPlayerConnected(i))
            if(
IsPlayerInVehicle(ivehicleid))
            {
                
player_seat GetPlayerVehicleSeat(i);
                return 
i;
            }
    return (-
1);

Reply
#9

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
Reply
#10

IsPlayerInVehicle(playerid, ID of the Instance)

return 1 if true
return 0 if false

IsPlayerInAnyVehicle(playerid)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)