[HELP] Array if statement
#1


I Have this array with Vehicles ID:

Код:
new VeiculosDeOrg[3] = { 523,599,596 };
OnPlayerEnterVehicle i have:
Код:
new VehicleModel = GetVehicleModel(vehicleid);
if(VehicleModel != VeiculosDeOrg[0])
{
       SendClientMessage(playerid, COLOR_WHITE, "TEST.");
}
Even if i enter um Vehicle with this IDs in array, its printing. Why?
Reply
#2

PHP код:
new VehicleModel GetVehicleModel(vehicleid);
if(
VehicleModel != VeiculosDeOrg[4])
{
       
SendClientMessage(playeridCOLOR_WHITE"TEST.");

Try this, maybe it works or simply use a loop to check it he has enter in that vehicle.
Reply
#3

Quote:
Originally Posted by Karan007
Посмотреть сообщение
PHP код:
new VehicleModel GetVehicleModel(vehicleid);
if(
VehicleModel != VeiculosDeOrg[4])
{
       
SendClientMessage(playeridCOLOR_WHITE"TEST.");

Try this, maybe it works or simply use a loop to check it he has enter in that vehicle.
if a put [4] it gives me an error:
Код:
error 032: array index out of bounds (variable "VeiculosDeOrg")
Reply
#4

PHP код:
for(new asizeof(VeiculosDeOrg); a++)
if(
GetVehicleModel(VeiculosDeOrg) != VeiculosDeOrg[a])return printf("TEST."); 
Reply
#5

Quote:
Originally Posted by DeathCore
Посмотреть сообщение
PHP код:
for(new asizeof(VeiculosDeOrg); a++)
if(
GetVehicleModel(VeiculosDeOrg) != VeiculosDeOrg[a])return printf("TEST."); 
Код:
error 035: argument type mismatch (argument 1)
Reply
#6

Check the vehicle id with vehicle id unless you're checking both of their models.
Reply
#7

PHP код:
new VehicleModel GetVehicleModel(vehicleid);
for(new 
index 0index sizeof VeiculosDeOrg; ++index) {
    if(
VehicleModel != VeiculosDeOrg[index]) {
        
SendClientMessage(playerid, -1"TEST.");
    }

Reply
#8

Код:
if(GetVehicleModel(VeiculosDeOrg[a]) != VeiculosDeOrg[a])return printf("TEST.");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)