Checking seats in vehicle -
Wesley221 - 23.10.2011
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
Re: Checking seats in vehicle -
=WoR=Varth - 23.10.2011
Do loop to get each player seat.
Re: Checking seats in vehicle -
Wesley221 - 23.10.2011
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?
Re: Checking seats in vehicle -
=WoR=Varth - 23.10.2011
pawn Код:
foreach(Player,i)
{
if(GetPlayerVehicleID(i) != 0)
{
GetPlayerVehicleSeat(i);
Re: Checking seats in vehicle -
Wesley221 - 23.10.2011
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?
Re: Checking seats in vehicle -
=WoR=Varth - 23.10.2011
pawn Код:
//Specific vehicle with iterator
Iter_Add(pVehicle,CreateVehicle(.....);
foreach(Player,i)
{
new vid = GetPlayerVehicleID(i);
foreach(pVehicle,a)
{
if(vid == a)
{
GetPlayerVehicleSeat(i);
Re: Checking seats in vehicle -
Wesley221 - 24.10.2011
So i would create the vehicles by doing 'Iter_Add(pVehicle[0],CreateVehicle(....);'?
Re: Checking seats in vehicle -
=WoR=Varth - 24.10.2011
Yes (By my suggestion)
Re: Checking seats in vehicle -
Wesley221 - 24.10.2011
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
Re: Checking seats in vehicle -
=WoR=Varth - 24.10.2011
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.