How to check if vehicle is being driven already.
#1

So I have a specific vehicle on the map lets say
tropic = AddStaticVehicle(454,313.3820,3454.1711,0.3374,52. 7016,63,66); //

The vehicle has alot of attached objects. So you can't enter it normaly
The Vehicle has a custom interior and in order to drive it you must enter the vehicles interior and grab a pickup that puts you in the driver seat.

However, I'm worried that if multiple people grab the pickup and the driver seat is already occupied, they might crash, so I need a way to check if some one is in the driver seat when grabbing the pickup and deny the player entry if some one is already driving.. :c

https://sampforum.blast.hk/showthread.php?tid=553980

EDIT:I may have found my answer within this.. not sure yet.
Reply
#2

This should work,
pawn Код:
stock IsSeatTaken(vehicleid, seatid)
{
    for(new i = GetPlayerPoolSize(); i != -1; i--)
    {
        if(!IsPlayerConnected(i)) continue;
        if(GetPlayerVehicleID(i) == vehicleid && GetPlayerVehicleSeat(i) == seatid) return 1;
    }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)