[18:36:30] [debug] Run time error 4: "Array index out of bounds" [18:36:30] [debug] Attempted to read/write array element at index 65535 in array of size 1000 [18:36:30] [debug] AMX backtrace: [18:36:30] [debug] #0 00101798 in public OnPlayerDeath (playerid=0, killerid=65535, reason=54) at D:\RPG V3 EDITED\gamemodes\gtarg.pwn:13966 [18:36:30] [debug] #1 000f947c in public OnPlayerTakeDamage (playerid=0, issuerid=65535, Float:amount=3.30000, weaponid=54, bodypart=3) at D:\RPG V3 EDITED\gamemodes\gtarg.pwn:13357
if(PlayerInfo[killerid][pPaintKills] == 190) { PlayerInfo[killerid][pPaintRank] = 14; Update(killerid, pPaintRankx); PlayerInfo[killerid][pCash] += 700000; Update(killerid, pCashx); GivePlayerCash(killerid, 500000); PlayerInfo[killerid][pExp] += 10; Update(killerid, pRP); PlayerInfo[playerid][pPremiumPoints] += 7; Update(playerid, pPremiumPointsx); SCM(playerid, COLOR_GREEN, "Xep hang tang! Ban bay gio la Distinguished Master Guardian."); SCM(playerid, COLOR_GREEN, "Ban nhan duoc $700.000, 10 RP va 7 PP(vip xu)"); format(rankz, sizeof(rankz), "Distinguished Master Guardian"); PlayerInfo[killerid][pRankName] = rankz; Update(killerid, pRankNamex); }
#0 00101798 in public OnPlayerDeath (playerid=0, killerid=65535, reason=54) #1 000f947c in public OnPlayerTakeDamage (playerid=0, issuerid=65535, Float:amount=3.30000, weaponid=54, bodypart=3) |
the killerid and issuerid should be checked that they dont equal to invalid playerid |
one that is correct
Two. Your killerid and playerid is reaching 65535. playerid's only reach 1000. so either there is something wrong with your code or you are using mysql with 6000+ registered players/accounts. correct your loops on that coz you are not giving the right playerid's on issuerid and killerid's |
public OnPlayerDeath(playerid, killerid, reason)
{
if(killerid != INVALID_PLAYER_ID) { //This will make sure there is no array out of bound due to INVALID_PLAYER_ID
Player_Stats[killerid]++;
}
Player_Stats[playerid]++;
}
That "Rep+" isn't even valid lol.
https://sampwiki.blast.hk/wiki/OnPlayerDeath Provides a great example. |