SA-MP Forums Archive
Run Time Error 4 - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Run Time Error 4 (/showthread.php?tid=602712)



Run Time Error 4 - Ilai14 - 11.03.2016

Код:
[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.


Re: Run Time Error 4 - czerwony03 - 11.03.2016

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



Re: Run Time Error 4 - czerwony03 - 11.03.2016

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;



Re: Run Time Error 4 - SyS - 12.03.2016

show the size u given for
TerroristsScore
CopsScore
pInfo
gTeam


Re: Run Time Error 4 - itsCody - 12.03.2016

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