Posts: 1,219
Threads: 51
Joined: Jul 2012
PHP код:
new veh[2] =
{ 400, 401 };
There is too ways, depending on the size of the arrays you have to decide, but if the arrays size often changes, i recommend way 1
PHP код:
for(new i; i < sizeof(veh); i++)
{
if(GetVehicleModel(vmodel) == veh[i])
{
new modelText[30];
format(modelText, 30, "The Vehicle model is: %d", veh[i]);
printf("%s", modelText);
return 1;
}
}
or
PHP код:
if(GetVehicleModel(vmodel) == veh[0] || GetVehicleModel(vmodel) == veh[1])
{
return 1;
}
and also
Quote:
PHP код:
if(GetVehicleModel(vmodel) == veh[2]) //the veh[2] will call only the number 401
|
this would give you an out of bounds error, because max index is "1".
Posts: 1,219
Threads: 51
Joined: Jul 2012
Quote:
You said: or
if(GetVehicleModel(vmodel) == veh[0] || GetVehicleModel(vmodel) == veh[1])
{
return 1;
}
But it is a timy work.
And can this also work
PHP код:
if(GetVehicleModel(vmodel) == veh[0 || 1])
{
return 1;
}
|
1. what does "timy work" mean (Edit: ah, you meant tiny)
2. no, that "veh[0 || 1]" is not valid syntax
Posts: 1,506
Threads: 13
Joined: Jun 2015
Having no or very little amount of knowledge about SA-MP scripting and you are arguing or representing invalid/ non-existent methods/ syntax...
You better put some time into SA-MP scripting Wiki before posting something like that, programming/ scripting is based on LOGIC.
Posts: 1,219
Threads: 51
Joined: Jul 2012
Quote:
Originally Posted by ALiScripter
Having no or very little amount of knowledge about SA-MP scripting and you are arguing or representing invalid/ non-existent methods/ syntax...
|
Explain
Sorry if i was wrong, i was sure it doesn't work
Forgive me
Posts: 1,506
Threads: 13
Joined: Jun 2015
Quote:
Originally Posted by [Bios]Marcel
Explain
|
Not you, talking about the other guy.