Array Help! - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Array Help! (
/showthread.php?tid=72380)
Array Help! -
silvan - 08.04.2009
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.
Re: Array Help! -
Nubotron - 08.04.2009
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;
}
Re: Array Help! -
silvan - 08.04.2009
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?
Re: Array Help! -
silvan - 08.04.2009
any help?
Re: Array Help! -
HB - 08.04.2009
That gives you much errors I guess. Try this:
Well the size has to be the amount of vehicle ID's.
Re: Array Help! -
Nubotron - 08.04.2009
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.
Re: Array Help! -
silvan - 09.04.2009
tnx guys.
Re: Array Help! -
silvan - 17.04.2009
this don't work