Run Time Error 4
#1

Код:
[23:57:24] [debug] Run time error 4: "Array index out of bounds"
[23:57:24] [debug]  Accessing element at index 65535 past array upper bound 49
[23:57:24] [debug] AMX backtrace:
[23:57:24] [debug] #0 0001d4c0 in ?? (0, 65535, 255) from TDM.amx
[23:57:24] [debug] #1 00005718 in public OnPlayerDeath (0, 65535, 255) from TDM.amx
This the public:
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	SendDeathMessage(killerid, playerid, reason);
	pInfo[playerid][pDeath] ++;
	pInfo[killerid][pKills] ++;
	
	if(pInfo[killerid][pKills] % 50 == 0)
	{
	    pInfo[killerid][pLevel] ++;
	    SendFormatMessageToAll(-1, "{FFBB11}.%d щтмд мшод {838383}%s(ID:%02d) {FFBB11}ожм иеб мщзчп", pInfo[killerid][pLevel], GetName(killerid), killerid);
	}
	
	if(gTeam[killerid] == COPS)
	{
	    CopsKills ++;
	    format(zString, sizeof(zString), "Cops Score: %d", CopsKills);
	    TextDrawSetString(CopsScore[playerid], zString);
	}
	
	if(gTeam[killerid] == TERRORIST)
	{
	    TerroristsKills ++;
	    format(zString, sizeof(zString), "Terrorist Score: %d", CopsKills);
	    TextDrawSetString(TerroristsScore[playerid], zString);
	}
	return 1;
}
I can't find the problem or anything what causes the bug.
Reply
#2

Show how do you create:
Код:
TerroristsScore[]
CopsScore[]
pInfo[]
gTeam[]
Reply
#3

Check if killerid is not equal to INVALID_PLAYER_ID, if yes, return 1; or do only stuff whenever player is killed.
Код:
if(killerid==INVALID_PLAYER_ID) return 1;
Reply
#4

show the size u given for
TerroristsScore
CopsScore
pInfo
gTeam
Reply
#5

Quote:
Originally Posted by czerwony03
Посмотреть сообщение
Check if killerid is not equal to INVALID_PLAYER_ID, if yes, return 1; or do only stuff whenever player is killed.
Код:
if(killerid==INVALID_PLAYER_ID) return 1;
PHP код:
if(killerid != INVALID_PLAYER_ID) return 1
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)