SA-MP Forums Archive
Errors - 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: Errors (/showthread.php?tid=249607)



Errors - nuriel8833 - 19.04.2011

Hello
I made a tiny script,but I have an issue with it.
First I have this argument on the top of the mode:
PHP код:
new XXX[8]; 
But now,when I make this line (On OnPlayerEnterVehicle):
PHP код:
if(vehicleid == MoneyTaxi
I get this error:
PHP код:
error 033: array must be indexed (variable "MoneyTaxi"
when I put this line:
PHP код:
if(vehicleid == MoneyTaxi[]) 
I get this error:
PHP код:
error 029invalid expressionassumed zero 
and when I put this line:
PHP код:
if(vehicleid == MoneyTaxi[8]) 
I get this error:
PHP код:
error 032: array index out of bounds (variable "MoneyTaxi"
What shall I do?


Re: Errors - Sascha - 19.04.2011

pawn Код:
new MoneyTaxi[8];
pawn Код:
MoneyTaxi[0] = AddStaticVehicle.........;
MoneyTaxi[1] = AddStaticVehicle.........;
MoneyTaxi[2] = AddStaticVehicle.........;
MoneyTaxi[3]= AddStaticVehicle.........;
MoneyTaxi[4] = AddStaticVehicle.........;
MoneyTaxi[5] = AddStaticVehicle.........;
MoneyTaxi[6] = AddStaticVehicle.........;
MoneyTaxi[7] = AddStaticVehicle.........;
pawn Код:
for(new n=0; n<sizeof(MoneyTaxi); n++)
{
  if(vehicleid == MoneyTaxi[n])
  {
         ....
  }
}



Re: Errors - nuriel8833 - 19.04.2011

Quote:
Originally Posted by Sascha
Посмотреть сообщение
pawn Код:
new MoneyTaxi[8];
pawn Код:
MoneyTaxi[0] = AddStaticVehicle.........;
MoneyTaxi[1] = AddStaticVehicle.........;
MoneyTaxi[2] = AddStaticVehicle.........;
MoneyTaxi[3]= AddStaticVehicle.........;
MoneyTaxi[4] = AddStaticVehicle.........;
MoneyTaxi[5] = AddStaticVehicle.........;
MoneyTaxi[6] = AddStaticVehicle.........;
MoneyTaxi[7] = AddStaticVehicle.........;
pawn Код:
for(new n=0; n<sizeof(MoneyTaxi); n++)
{
  if(vehicleid == MoneyTaxi[n])
  {
         ....
  }
}
Thank you very much