04.12.2015, 20:15
So the problem is simple, crashdetect is outputing large ammount of messages (well they are all the same ones)
I believe the issue is inside the loop
Because the simple fact the only thing thats supposted to be 20 is #define MAX_FACTIONS 20
PHP код:
[15:12:23] [debug] Run time error 4: "Array index out of bounds"
[15:12:23] [debug] Accessing element at index 20 past array upper bound 19
[15:12:23] [debug] AMX backtrace:
[15:12:23] [debug] #0 00089b4c in ?? (0, 1995808, 0) from RPV2.amx
[15:12:23] [debug] #1 00043718 in ?? (0, 1995760, 0) from RPV2.amx
[15:12:23] [debug] #2 000455d4 in ?? (0, 1995760, 0, 0, 0, 8, 0, 1995760, 0, 0, ... <1073741813 arguments>) from RPV2.amx
[15:12:23] [debug] #3 00008388 in public OnPlayerCommandText (0, 1995760) from RPV2.amx
PHP код:
CMD:viewdeposit(playerid,params[]) {
new string[256];
for(new x = 0; x <= MAX_FACTIONS; x++) {
if(IsPlayerInRangeOfPoint(playerid,50.0,FactionInfo[x][FactionExitX],FactionInfo[x][FactionExitY],FactionInfo[x][FactionExitZ])) {
if(FactionInfo[x][FactionID] == AccInfo[playerid][PlayerFaction]) {
if(AccInfo[playerid][PlayerLeader] == 0) return SendClientMessage(playerid,COLOR_RED,"You are not a faction leader!");
format(string,sizeof(string),"FactionDeposit -- Faction Name: %s ",FactionInfo[x][FactionName]);
SendClientMessage(playerid,COLOR_GREEN,string);
print(string);
}
}
}
return true;
}