SA-MP Forums Archive
Run time error 4: "Array index out of bounds" - 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)
+--- Thread: Run time error 4: "Array index out of bounds" (/showthread.php?tid=641391)



Run time error 4: "Array index out of bounds" - None1337 - 15.09.2017

Hello, i get this error (in server_log) when i use /deletevehicle on my server, the problem is the dialog, i don't know what should i do to fix this.

Dialog: https://pastebin.com/m4hPxrjL

Error (server_log):
Код:
[17:01:40] [debug] Run time error 4: "Array index out of bounds"
[17:01:40] [debug] AMX backtrace:
[17:01:40] [debug] #0 002afcf8 in public OnDialogResponse (0, 676, 1, -1, 58432840) from leddz.amx



Re: Run time error 4: "Array index out of bounds" - X337 - 15.09.2017

Show us your VehicleInfo's declaration


Re: Run time error 4: "Array index out of bounds" - None1337 - 15.09.2017

Quote:
Originally Posted by X337
Посмотреть сообщение
Show us your VehicleInfo's declaration
Here: https://pastebin.com/9eja5mkW


Re: Run time error 4: "Array index out of bounds" - X337 - 15.09.2017

MAX_VEHICLES is 2000 by default.
You got that array index out of bounds because you are accessing array index of VehicleInfo which doesn't exists (>= 1000). A simple fix is by declaring VehicleInfo with MAX_VEHICLES as its size or use iterator.


Re: Run time error 4: "Array index out of bounds" - None1337 - 15.09.2017

Quote:
Originally Posted by X337
Посмотреть сообщение
MAX_VEHICLES is 2000 by default.
You got that array index out of bounds because you are accessing array index of VehicleInfo which doesn't exists (>= 1000). A simple fix is by declaring VehicleInfo with MAX_VEHICLES as its size or use iterator.
Thanks bro, its work.