Errors
#1

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?
Reply
#2

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])
  {
         ....
  }
}
Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)