Find empty vehicle seats
#1

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?
Reply
#2

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)];
Reply
#3

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?
Reply
#4

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

500 max seats for a bus? :P
Reply
#6

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.
Reply
#7

:$ how would i check it?
Reply
#8

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?
Reply
#9

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)];
}
Reply
#10

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


Forum Jump:


Users browsing this thread: 4 Guest(s)