Array index out of bounds
#4

The command was edited. An invalid player ID (65535) cannot pass the `IsPlayerConnected` check so it would never access the array.

Avoid using global variables that may be used inside functions (which are called from these commands) and you get unexpected results.

The logic is retrieving the player, checking if the player is connected, access arrays.

pawn Код:
new id, AdminLevel;

if(sscanf(params, "ui", id, AdminLevel)) return ...
if(!IsPlayerConnected(id)) return ...
if(AdminLevel < 1 || AdminLevel > 4) return ...

...

PlayerInfo[id][pAdmin] = AdminLevel;
where ... are your messages.
Reply


Messages In This Thread
Array index out of bounds - by Mo123 - 28.10.2018, 13:28
Re: Array index out of bounds - by v1k1nG - 28.10.2018, 13:47
Re: Array index out of bounds - by Mo123 - 28.10.2018, 14:23
Re: Array index out of bounds - by Calisthenics - 28.10.2018, 14:27

Forum Jump:


Users browsing this thread: 2 Guest(s)