array index out of bounds problem - 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: array index out of bounds problem (
/showthread.php?tid=552004)
array index out of bounds problem -
ohmy - 22.12.2014
Hello,
why i got this problem
pawn Код:
array index out of bounds (variable "Banned")
this is my enum
pawn Код:
enum USER_BAN
{
USER_BANNED,
USER_REASON[100] //BANNED REASON
};
new Banned[MAX_PLAYERS][USER_BAN];
And the error line is
pawn Код:
Banned[giveplayerid][USER_BAN] = 1;
I Already write the "giveplayerid" code
Can you tell me what is the problem?
Re: array index out of bounds problem -
Pottus - 22.12.2014
Did you verify that giveplayerid is valid ?
Re: array index out of bounds problem -
ohmy - 22.12.2014
is there anything wrong?
Re: array index out of bounds problem -
Threshold - 22.12.2014
You must ensure that 'giveplayerid' is not less than 0, and does not exceed the value of 'MAX_PLAYERS'.
However, as far as I'm concerned, the line should be this:
pawn Код:
Banned[giveplayerid][USER_BANNED] = 1;
You are using the enum name in the third index.
When you should have been using 'USER_BANNED'.
Re: array index out of bounds problem -
ohmy - 22.12.2014
Ok Thank you its worked, Repped You Both