array index out of bounds problem
#1

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

Did you verify that giveplayerid is valid ?
Reply
#3

pawn Код:
new giveplayerid;
is there anything wrong?
Reply
#4

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.
pawn Код:
enum USER_BAN
When you should have been using 'USER_BANNED'.
Reply
#5

Ok Thank you its worked, Repped You Both
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)