Quote:
Originally Posted by Vince
The syntax is not even correct. The correct syntax is:
pawn Код:
if(Model[ playerid ] == 400 || Model[ playerid ] == 401 || Model[ playerid ] == 402 || ...)
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:
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; }
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:
pawn Код:
static const validVehicles[] = {400, 401, 402, 405, 409, /*etc*/ , 609};
Then you can check if the model is valid by doing
pawn Код:
if(in_array(Model[ playerid ], validVehicles))
|
tnx u vince will try your way . stock i can put anyware right ? and do i need to leave space by doing this static const validVehicles[] = {400, 401, 402, 405, 409, /*etc*/ , 609}; after each number ?