SA-MP Forums Archive
Find empty vehicle seats - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Find empty vehicle seats (/showthread.php?tid=242169)



Find empty vehicle seats - Hobod - 19.03.2011

Just trying to make a teleport command that checks if the person your teleporting to is inside a car, and if they are then the player whos teleporting gets put into that vehicle.
but i want to avoid putting them into a seat thats probably already taken
how would i find the empty seats and put them into it?


Re: Find empty vehicle seats - Stigg - 19.03.2011

You could try using something like this:

pawn Код:
new VehicleSeats[] = {
4,2,2,2,4,4,1,2,2,4,2,2,2,4,2,2,4,2,4,2,4,4,2,2,2,1,4,4,4,2,1,500,1,2,2,0,2,500,4,2,4,1,2,2,2,4,1,2,
1,0,0,2,1,1,1,2,2,2,4,4,2,2,2,2,1,1,4,4,2,2,4,2,1,1,2,2,1,2,2,4,2,1,4,3,1,1,1,4,2,2,4,2,4,1,2,2,2,4,
4,2,2,1,2,2,2,2,2,4,2,1,1,2,1,1,2,2,4,2,2,1,1,2,2,2,2,2,2,2,2,4,1,1,1,2,2,2,2,500,500,1,4,2,2,2,2,2,
4,4,2,2,4,4,2,1,2,2,2,2,2,2,4,4,2,2,1,2,4,4,1,0,0,1,1,2,1,2,2,1,2,4,4,2,4,1,0,4,2,2,2,2,0,0,500,2,2,
1,4,4,4,2,2,2,2,2,4,2,0,0,0,4,0,0};

GetVehicleMaxSeats(vehicleid) return VehicleSeats[(GetVehicleModel(vehicleid) - 400)];



Re: Find empty vehicle seats - Hobod - 19.03.2011

im still learning pawno as i only do it when i have enough spare time for it
but is the return on that how many there is in the vehicle?


Re: Find empty vehicle seats - Stigg - 19.03.2011

It returns vehicle seats in vehicle, then you could check to see if they are filled or not.


Re: Find empty vehicle seats - jamesbond007 - 19.03.2011

500 max seats for a bus? :P


Re: Find empty vehicle seats - Stigg - 19.03.2011

Quote:
Originally Posted by jamesbond007
Посмотреть сообщение
500 max seats for a bus? :P
It does need a tweek here an there..lolz
I found it it the snippet section.


Re: Find empty vehicle seats - Hobod - 19.03.2011

:$ how would i check it?


Re: Find empty vehicle seats - SpankMe2 - 18.01.2012

Quote:
Originally Posted by Stigg
Посмотреть сообщение
You could try using something like this:

pawn Код:
new VehicleSeats[] = {
4,2,2,2,4,4,1,2,2,4,2,2,2,4,2,2,4,2,4,2,4,4,2,2,2,1,4,4,4,2,1,500,1,2,2,0,2,500,4,2,4,1,2,2,2,4,1,2,
1,0,0,2,1,1,1,2,2,2,4,4,2,2,2,2,1,1,4,4,2,2,4,2,1,1,2,2,1,2,2,4,2,1,4,3,1,1,1,4,2,2,4,2,4,1,2,2,2,4,
4,2,2,1,2,2,2,2,2,4,2,1,1,2,1,1,2,2,4,2,2,1,1,2,2,2,2,2,2,2,2,4,1,1,1,2,2,2,2,500,500,1,4,2,2,2,2,2,
4,4,2,2,4,4,2,1,2,2,2,2,2,2,4,4,2,2,1,2,4,4,1,0,0,1,1,2,1,2,2,1,2,4,4,2,4,1,0,4,2,2,2,2,0,0,500,2,2,
1,4,4,4,2,2,2,2,2,4,2,0,0,0,4,0,0};

GetVehicleMaxSeats(vehicleid) return VehicleSeats[(GetVehicleModel(vehicleid) - 400)];
Are these the actual max seat numbers?


Re: Find empty vehicle seats - clarencecuzz - 29.07.2012

Sorry for bumping an extremely old topic, but I have made the correct values for anyone who wants it. The reason I am posting here, is because many ****** searchers get redirected to this topic.
NOTE: These values represent the amount of seats in TOTAL, not the amount of passenger seats. Hope you use them well, took me a few hours to get them all.

pawn Код:
new MaxSeats[212] = {
4,2,2,2,4,4,1,2,2,4,2,2,2,4,2,2,4,2,4,2,4,4,2,2,2,1,4,4,4,2,1,9,1,2,2,1,2,9,4,2,
4,1,2,2,2,4,1,2,1,6,1,2,1,1,1,2,2,2,4,4,2,2,2,2,2,2,4,4,2,2,4,2,1,1,2,2,1,2,2,4,
2,1,4,3,1,1,1,4,2,2,4,2,4,1,2,2,2,4,4,2,2,2,2,2,2,2,2,4,2,1,1,2,1,1,2,2,4,2,2,1,
1,2,2,2,2,2,2,2,2,4,1,1,1,2,2,2,2,0,0,1,4,2,2,2,2,2,4,4,2,2,4,4,2,1,2,2,2,2,2,2,
4,4,2,2,1,2,4,4,1,0,0,1,1,2,1,2,2,2,2,4,4,2,4,1,1,4,2,2,2,2,6,1,2,2,2,1,4,4,4,2,
2,2,2,2,4,2,1,1,1,4,1,1
};
Used in the stock function like so:
pawn Код:
stock GetMaxSeats(vehicleid)
{
    return MaxSeats[(GetVehicleModel(vehicleid) - 400)];
}



Re: Find empty vehicle seats - Littlehelper - 29.07.2012

.......
pawn Код:
stock IsSeatTaken(vehicleid, seatid)
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(GetPlayerVehicleID(i) == vehicleid && GetPlayerVehicleSeat(i) == seatid) return 1;
    }
    return 0;
}