Checking the last driver of a vehicle
#1

Howdy,
Does anyone know how I can create a script to detect the previous driver of a vehicle? I've been trying and I just haven't gotten it. Thanks
Reply
#2

pawn Код:
new lastDriver[MAX_VEHICLES];
public OnPlayerStateChange(playerid, newstate, oldstate) {
    if(newstate == PLAYER_STATE_DRIVER)
    {
            if(IsPlayerInAnyVehicle(playerid))
                  lastDriver[GetPlayerVehicleID(playerid)] = playerid;
    }

    return 1;
}
Reply
#3

There you go:
pawn Код:
new VehicleLastDriver[MAX_VEHICLES]; //put this at the top of the script
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(GetPlayerVehicleID(playerid) != 0)
        {
            VehicleLastDriver[GetPlayerVehicleID(playerid)] = playerid;
        }
    }
    return 1;
}
Reply
#4

Thank you both, REP+
Reply
#5

Last question, How would I be able to make a command such as /lastdriver to actually see who was in the vehicle?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)