Is there a way to...
#1

Get the driver's ID whenever a passenger gets in a car ? I have got no idea how to do it...
Reply
#2

OnPlayerEnterVehicle or OnPlayerStateChange then you can detect the driver's id using GetPlayerVehicleSeat.
Reply
#3

I think this will do the trick... Not sure because i did not actually test it.
pawn Код:
OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new Vehicle = GetPlayerVehicleID(playerid);
    new string[128];
    for(new i; i < MAX_PLAYERS; i++)
    {
        new driverSeat = GetPlayerVehicleSeat(i);
        if(driverSeat == 0)
        {
            format(string, sizeof(string), "ID: %i is the driver", i);
            SendClientMessage(playerid, 0xFFFFFFF,  string);
        }
    }
}
Reply
#4

Simples, like Cena said use OnPlayerStateChange, check if the player is a passenger, get the vehicle id he is in and then loop through players in range and check if they're inside a vehicle (as a driver) and see if the vehicle id matches the one the passenger is in.
Note: do not use OnPlayerEnterVehicle as they're not in the vehicle yet.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)