SA-MP Forums Archive
Problem with foreach/iterator : array index out of bonus - 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: Problem with foreach/iterator : array index out of bonus (/showthread.php?tid=650997)



Problem with foreach/iterator : array index out of bonus - None1337 - 11.03.2018

So, when a player give damage (OnPlayerGiveDamge) I search for spectate admins to see how many damage he gives, just a simple message format.. I don't know what's wrong..

OnPlayerGiveDamage: https://pastebin.com/Tfan0y03 (I showed the line in pastebin)

I tested without iterator Admins and changed to Player, and still give me errors..

The problem is that, sometimes give me error and server crash, sometimes everying works fine, without errors in server_log and without crash.

Bdw, i have too many errors in server_log and the server crash..showing the wrong line (I think, because /freeze is a simple command, see below).

/freeze command: https://pastebin.com/jrJ8QKbh

server_log: https://pastebin.com/rSt4QZcv


Re: Problem with foreach/iterator : array index out of bonus - None1337 - 12.03.2018

bump


Re: Problem with foreach/iterator : array index out of bonus - CoaPsyFactor - 12.03.2018

have you try using "crashdetect" plugin?


Re: Problem with foreach/iterator : array index out of bonus - None1337 - 12.03.2018

Quote:
Originally Posted by CoaPsyFactor
Посмотреть сообщение
have you try using "crashdetect" plugin?
I have already crashdetect plugin...all information that are, are in in the pastebin above..


Re: Problem with foreach/iterator : array index out of bonus - Sew_Sumi - 12.03.2018

Show the defining of Spectate and the ShowDMG arrays.


Re: Problem with foreach/iterator : array index out of bonus - None1337 - 12.03.2018

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
Show the defining of Spectate and the ShowDMG arrays.
https://pastebin.com/8x5zSwzp


Re: Problem with foreach/iterator : array index out of bonus - Sew_Sumi - 12.03.2018

That's not what I said... Show the DEFINITION of those ARRAYS.... Not the implementation.

On a side note, you don't need a string 500 long to display information that's likely to not even break 140.


Re: Problem with foreach/iterator : array index out of bonus - sammp - 12.03.2018

It explains itself. You're attempting to access something illegally.


Re: Problem with foreach/iterator : array index out of bonus - None1337 - 12.03.2018

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
That's not what I said... Show the DEFINITION of those ARRAYS.... Not the implementation.

On a side note, you don't need a string 500 long to display information that's likely to not even break 140.
You mean this?

Код:
new Spectate[MAX_PLAYERS],
    ShowDMG[MAX_PLAYERS];



Re: Problem with foreach/iterator : array index out of bonus - Sew_Sumi - 12.03.2018

It'd be easier if this error came from OnPlayerTakeDamage as that'd usually be an issue with not checking for INVALID_PLAYER_ID.


But this does seem interesting as to why it really would bug out on that area.

If you haven't been using -d3 in your compiler options as CrashDetect requires, I'd suggest you sort that out and get an updated crashlog.

Quote:
Originally Posted by None1337
Посмотреть сообщение
You mean this?

Код:
new Spectate[MAX_PLAYERS],
    ShowDMG[MAX_PLAYERS];
Yes, that is the definition of the array. Implementation is where you use it.