Checking seats in vehicle
#1

Hey guys,

Is there a function or something to check which seats are being used in a vehicle?
I know about the function GetVehicleSeat, but i dont need that. I need to check if a vehicle contains a driver or a passenger.

~Wesley
Reply
#2

Do loop to get each player seat.
Reply
#3

pawn Код:
foreach(Player, i)
                {
                    for( new j = 0; j < MAX_VEHICLES; j ++ )
                    {
                        if( GetPlayerVehicleID( i ) == pVehicle[j] )
                        {

                        }
                    }
                }
How would i know if the player is in 'pVehicle[1]' or in 'pVehicle[5]' for example?
Reply
#4

pawn Код:
foreach(Player,i)
{
    if(GetPlayerVehicleID(i) != 0)
    {
        GetPlayerVehicleSeat(i);
Reply
#5

Yes i know that, but i want it to check if hes in a specific vehicle (pVehicle[#]).
Ive created a few vehicles with the variable pVehicle[#], and i need to check if theyre in one of those vehicles. But when a player is in pVehicle[0], another one in pVehicle[6], how can i check if theyre in that vehicle?
Reply
#6

pawn Код:
//Specific vehicle with iterator
Iter_Add(pVehicle,CreateVehicle(.....);


foreach(Player,i)
{
    new vid = GetPlayerVehicleID(i);
    foreach(pVehicle,a)
    {
        if(vid == a)
        {
            GetPlayerVehicleSeat(i);
Reply
#7

So i would create the vehicles by doing 'Iter_Add(pVehicle[0],CreateVehicle(....);'?
Reply
#8

Yes (By my suggestion)
Reply
#9

pawn Код:
Iter_Add(pVehicle[0],CreateVehicle(....);
Iter_Add(pVehicle[1],CreateVehicle(....);
Iter_Add(pVehicle[2],CreateVehicle(....);
Iter_Add(pVehicle[3],CreateVehicle(....);
Iter_Add(pVehicle[4],CreateVehicle(....);
So that will create the 4 vehicles, and theyre automaticly attached to the variable?
So when i want to acces 'pVehicle[3]' for example, i can just use 'pVehicle[3]' as variable to do something with that vehicle?

I never really worked with that Iter thing, so dont know alot of it
Reply
#10

I suggest you to read the topic.
https://sampforum.blast.hk/showthread.php?tid=92679

You can add my MSN if you need any help. Or just post it here.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)