Error in OnGameModeInit
#1

Hello!
I recently started getting this error on my gamemode, now no cars, objects or any of the like spawn, and I'm not sure how to fix this error!
Код:
[22:32:41] [debug] Run time error 4: "Array index out of bounds"
[22:32:41] [debug]  Accessing element at index 19 past array upper bound 18
[22:32:41] [debug] AMX backtrace:
[22:32:41] [debug] #0 000c7b98 in public Audio_OnGameModeInit () from RGRP.amx
[22:32:41] [debug] #1 native CallLocalFunction () [00471c30] from samp-server.exe
[22:32:41] [debug] #2 000146c4 in ?? () from RGRP.amx
[22:32:41] [debug] #3 0000db84 in public zcmd_OnGameModeInit () from RGRP.amx
[22:32:41] [debug] #4 native CallLocalFunction () [00471c30] from samp-server.exe
[22:32:41] [debug] #5 0000d510 in public Timers_OnScriptInit () from RGRP.amx
[22:32:41] [debug] #6 native CallLocalFunction () [00471c30] from samp-server.exe
[22:32:41] [debug] #7 0000d360 in public YVers_OnScriptInit () from RGRP.amx
[22:32:41] [debug] #8 native CallLocalFunction () [00471c30] from samp-server.exe
[22:32:41] [debug] #9 0000bcd0 in public Itter_OnGameModeInit () from RGRP.amx
[22:32:41] [debug] #10 native CallLocalFunction () [00471c30] from samp-server.exe
[22:32:41] [debug] #11 00001714 in public OnGameModeInit () from RGRP.amx
any help would be much appreciated!
Reply
#2

If you have an array with size of 19, the valid indexes can get are 0-18. The first thing I can think of about it in scripting issue are loops. Do not use <= but < instead.

OnGameModeInit would be a good idea to help us too.
Reply
#3

Uhh yeah sorry.. had to remove the objects wouldn't let me upload to pastebin otherwise.
http://pastebin.com/0357wt6U
Reply
#4

You'll have to compile with debug info and let's hope it'll show the line was caused at.

If you don't use the latest version of the crashdetect plugin (4.12), then you can get it from: https://github.com/Zeex/samp-plugin-...ases/tag/v4.12

About the debug info, goto pawno folder and create a file pawn.cfg
Open it and write in it:
pawn Код:
-d3
Save it and re-compile RGRP.pwn

The next time it will give results in the server log/console, post them.
Reply
#5

I already use crashdetect and the pawn.cfg with -d3... It's not telling me which lines causing it... I've been looking over and over and I can't find it! :/
Reply
#6

In some cases, it's easy to find what caused the run time by not even giving the line caused it but in your case is not. I didn't look the code in depth but from a fast look, I couldn't find anything wrong because I don't know all the sizes of the arrays you used.

Then I guess, the only way is to debug it manually. Adding print messages and try to find where the code stops working.
Reply
#7

I will do that, thanks for trying Konstantinos, it's much appreciated.
Reply
#8

Thought I should update you.
I filled the ongamemodeinit with print messages. It stopped at this code:
Код:
	for(new x;x<sizeof(TruckerVehicles);x++) //THIS LINE
	{
		format(string, sizeof(string), "Coon %d", TruckerVehicles[x]);
		SetVehicleNumberPlate(TruckerVehicles[x], string);
		SetVehicleToRespawn(TruckerVehicles[x]);
	}
This is the fixed version but before, the sizeof(); had the wrong array specified (Copy and paste for you)...-.-
Everyones help - much appreciated!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)