Vehicle loop problem
#1

So what I'm trying to do are faction vehicles.

I created a new variable.

Код:
new pizzaboy[8];
And I assigned them to those vehicles

Код:
pizzaboy[0] = AddStaticVehicleEx(448,202.1516,-155.5842,1.1784,179.4629,3,6,-1); // pizzaboy
	pizzaboy[1] = AddStaticVehicleEx(448,199.7199,-155.3315,1.1755,181.0785,3,6,-1); // pizzaboy
	pizzaboy[2] = AddStaticVehicleEx(448,196.6695,-155.1234,1.1779,176.7418,3,6,-1); // pizzaboy
	pizzaboy[3] = AddStaticVehicleEx(448,219.0956,-170.7992,1.1758,88.1145,3,6,-1); // pizzaboy
	pizzaboy[4] = AddStaticVehicleEx(448,219.2544,-173.0674,1.1779,87.9659,3,6,-1); // pizzaboy
	pizzaboy[5] = AddStaticVehicleEx(448,219.2123,-175.7683,1.1752,89.5281,3,6,-1); // pizzaboy
	pizzaboy[6] = AddStaticVehicleEx(448,219.3485,-178.3569,1.1776,90.5812,3,6,-1); // pizzaboy
	pizzaboy[7] = AddStaticVehicleEx(448,218.9106,-180.5808,1.1767,85.6638,3,6,-1); // pizzaboy
In OnPlayerStateChange I wanted to check if the player is inside this vehicle, and I do that by using a loop

Код:
new vehicleid = GetPlayerVehicleID(playerid);
for(new i = 0; i < MAX_VEHICLES; i++)
{
    if(vehicleid == pizzaboy[i]) //pizzaboy
    {
	//Do stuff
	SendClientMessage(playerid,COLOR_WHITE,"Pizzaboy w00t");
    }
 }
Now, the problem is that when I get into most of the pizzaboys, I get the message "Pizzaboy w00t", but some of them don't give me the message, as if the variable was not assigned to the vehicle. Anyone know what's the problem, or better yet, does anyone know any other way to create faction vehicles?
Reply


Messages In This Thread
Vehicle loop problem - by siemka321 - 02.11.2014, 19:04
Re: Vehicle loop problem - by [HiC]TheKiller - 02.11.2014, 19:42
Re: Vehicle loop problem - by siemka321 - 02.11.2014, 19:59
Re: Vehicle loop problem - by Michael@Belgium - 02.11.2014, 21:09
Re: Vehicle loop problem - by M0HAMMAD - 02.11.2014, 21:23
Re: Vehicle loop problem - by siemka321 - 03.11.2014, 09:28

Forum Jump:


Users browsing this thread: 2 Guest(s)