How do I check if vehicle has no driver?
#1

Ok so I made this system but something is missing so I don't bug it... How do I check if vehicle has no driver? It's very important and I don't know how...

Thanks.
Reply
#2

Use this function.

pawn Код:
stock IsVehicleOccupied(vehicleid)
{
    foreach(Player,i)
    {
        if(IsPlayerInAnyVehicle(i))
        {
            return (GetPlayerVehicleID(i)==vehicleid);
        }
    }
   
    return 0;
}
Reply
#3

I asked for no driver not the whole car unoccupied
Reply
#4

GetPassengerSeat?
Reply
#5

Does that even exist?
Please tell a valid function or at least tell me how to make that .
Reply
#6

https://sampwiki.blast.hk/wiki/GetPlayerVehicleSeat
Reply
#7

I've made something but I need to test it with someone so PM me if you want to help me test it
Thanks Cold
Reply
#8

Made this and it works. Hope you enjoy it whoever needs it but please give credits:
pawn Код:
stock IsntDriver(playerid)
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid) && GetPlayerVehicleSeat(i) != 0) return true;
    }
    return false;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)