Array index out of bounds.
#1

Problem: When i log in my account after the server kick me.

[debug] Accessing element at index 270 past array upper bound 68
[debug] AMX backtrace:
[debug] #0 0017dd34 in public PassCheck (0) from aaa.amx

What wrong is in that public?
https://pastebin.com/Q7sF59wH
Reply
#2

One of these:
Код:
format(szMessage, sizeof(szMessage), "(Group) MOTD: "EMBED_WHITE"%s", groupVariables[playerVariables[extraid][pGroup]][gGroupMOTD]);

format(string,256,"%s%s",clanVariables[playerVariables[extraid][pClan]][cClanTag],playerVariables[extraid][pNormalName]);

format(string,256,"%s%s",playerVariables[extraid][pNormalName],clanVariables[playerVariables[extraid][pClan]][cClanTag]);
It checks if group or clan is >= 1 only. Checking the upper bound will prevent the run time error:
pawn Код:
if(playerVariables[extraid][pGroup] >= 1 && playerVariables[extraid][pGroup] < sizeof (groupVariables))
// and
if(playerVariables[extraid][pClan] >= 1 && playerVariables[extraid][pClan] < sizeof (clanVariables))
but it might be logical error. What I mean is there are 68 groups or clans defined and the group or clan sql id is 270. Find the array index and use that, not the sql id.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)