Array Help!
#1

hi guys, I made this array which rapresents the vehicle models.

Код:
new vmodel[0] = {
	"409",
	"416",
	"437",
	"500",
	"523",
	"525",
	"597",
	"598",
	"599"
};
and when i'm using it in code to see if a vehicle is one from those models i get no errors but it aint working like i want. Can someone help me? i'm using it like this!

Код:
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == vmodel[0])
  {
	return 0;
  }
this code soppose to do that if a vehicle is one of the model id's i done in the array it should skip the stuff that i do for other cars.
Reply
#2

Many errors in these few line...use something like this:
pawn Код:
switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
{
  case 409, 416, 437, 500, 523, 525, 597, 598, 599 :
    return 0;

  default :
    return 1;
}
Reply
#3

ok i'll try tnx,

i tried the one you told me but its stopping everything for all cars... :/

or where i need to put the stuff for other cars?
Reply
#4

any help?
Reply
#5

Код:
new vmodel[0]
That gives you much errors I guess. Try this:

Код:
new vmodel[20]
Well the size has to be the amount of vehicle ID's.
Reply
#6

If you want to return only if vehicle is one of those in the list, and continue your code if it isn't in the list, remove the 'default' case.
Reply
#7

tnx guys.
Reply
#8

this don't work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)