17.10.2015, 09:10
Here's my problem;
I have created a function to loop through arrays with vehicle model ID's.
I'm checkng if the vehicle matches one of the groups of models I've specified so that I can
conditionally specify whether a vehicle should be created with a certain parameter.
For example, If the vehicle is enlisted in either VEHICLES or VEHICLES_2, i might want it to be all red when It's created. I use the function right before CreateVehicle(..) function.
I've created two loops for this, in the same function. My problems are;
- Only the first loop runs, no matter if it returns 1 or nothing. This is the main problem...
- It will only move on to CreateVehicle (next function after I use IsInVehiclesList(403) for example) if i return 1
And when the loops are done, I return 0 so that I can return "no match" and know if i , for example, want to specify red color in CreateVehicle(...)
I have created a function to loop through arrays with vehicle model ID's.
I'm checkng if the vehicle matches one of the groups of models I've specified so that I can
conditionally specify whether a vehicle should be created with a certain parameter.
For example, If the vehicle is enlisted in either VEHICLES or VEHICLES_2, i might want it to be all red when It's created. I use the function right before CreateVehicle(..) function.
I've created two loops for this, in the same function. My problems are;
- Only the first loop runs, no matter if it returns 1 or nothing. This is the main problem...
- It will only move on to CreateVehicle (next function after I use IsInVehiclesList(403) for example) if i return 1
And when the loops are done, I return 0 so that I can return "no match" and know if i , for example, want to specify red color in CreateVehicle(...)
pawn Код:
new VEHICLES[4] =
{
403,
414,
451,
565
};
new VEHICLES_2[4] =
{
420,
438,
437,
485
};
IsInVehiclesList(modelid)
{
for(new i = 0; i <= sizeof(VEHICLES); i++)
{
if(modelid == VEHICLES[i]){ return 1; }
}
// Want it to go on to the next if there's no match, but it doesn't...
for(new i = 0; i <= sizeof(VEHICLES_2); i++)
{
if(modelid == VEHICLES_2[i]){ return 1; }
}
return 0;
}