26.12.2014, 15:47
The syntax is not even correct. The correct syntax is:
But that would make the line even longer so you should instead use either a switch or, preferably, an array.
First, put this function somewhere in your script:
In your OnPlayerStateChange block (or at the top of your script if you expect to use the same collection of models elsewhere) create a constant array of valid vehicle models like:
Then you can check if the model is valid by doing
pawn Код:
if(Model[ playerid ] == 400 || Model[ playerid ] == 401 || Model[ playerid ] == 402 || ...)
First, put this function somewhere in your script:
pawn Код:
stock in_array(needle, const haystack[], size = sizeof haystack, &index = 0)
{
for(new i; i < size; i++)
{
if(haystack[i] == needle)
{
index = i;
return true;
}
}
return false;
}
pawn Код:
static const validVehicles[] = {400, 401, 402, 405, 409, /*etc*/ , 609};
pawn Код:
if(in_array(Model[ playerid ], validVehicles))