SA-MP Forums Archive
[Help] Run time error 4: "Array index out of bounds" - 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: [Help] Run time error 4: "Array index out of bounds" (/showthread.php?tid=415995)



[Help] Run time error 4: "Array index out of bounds" - David (Sabljak) - 15.02.2013

Crash detector

Код:
[14:02:49] [debug] Run time error 4: "Array index out of bounds"
[14:02:49] [debug]  Accessing element at index 65535 past array upper bound 499
[14:02:49] [debug] AMX backtrace:
[14:02:49] [debug] #0 001bfc80 in public OnPlayerDeath () from CHFR.amx
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid, playerid, reason);
    if(killerid != INVALID_PLAYER_ID) GivePlayerCash(killerid,100);   

    antifakekill[playerid] ++;
    SetTimerEx("antifakekill2", 2000,false,"i",playerid);

    new string[128];
    if(PlayerInfo[killerid][war1] == 1 && PlayerInfo[playerid][war2] == 1)
	{
	crveni1++;
	format(string, sizeof(string), "(WAR) %s je ubio protivnika %s", PlayerName(killerid),  PlayerName(playerid));
	SendWarMessage(WarLjubicasta, string);
	}
	else if(PlayerInfo[killerid][war2] == 1 && PlayerInfo[playerid][war1] == 1)
	{
	plavi1++;
	format(string, sizeof(string), "(WAR) %s je ubio protivnika %s", PlayerName(killerid), PlayerName(playerid));
	SendWarMessage(WarLjubicasta, string);
	}
	else if((PlayerInfo[killerid][war2] == 1 || PlayerInfo[killerid][war2] == 2)  && (PlayerInfo[playerid][war2] == 1 || PlayerInfo[playerid][war2] == 2))
	{
  	plavi1--;
	plavi1--;
	format(string, sizeof(string), "(WAR) Igrac %s je napravio TK! Ekipa je izgubila 2 poena!", PlayerName(killerid));
	SCM(killerid,0xFFFF00AA,"Napravio si TK! Tvoja ekipa je izgubila 2 poena!");
	SendWarMessage(SLjubicasta, string);
	}
	else if((PlayerInfo[killerid][war1] == 1 || PlayerInfo[killerid][war1] == 2)  && (PlayerInfo[playerid][war1] == 1 || PlayerInfo[playerid][war1] == 2))
	{
	crveni1--;
	crveni1--;
	format(string, sizeof(string), "(WAR) Igrac %s je napravio TK! Ekipa je izgubila 2 poena!", PlayerName(killerid));
	SCM(killerid,0xFFFF00AA,"Napravio si TK! Tvoja ekipa je izgubila 2 poena!");
	SendWarMessage(SLjubicasta, string);
	}
    else if(PlayerInfo[killerid][war1] == 1 && PlayerInfo[playerid][war2] == 2)
	{
	crveni1++;
	format(string, sizeof(string), "(WAR) %s je ubio protivnika %s", PlayerName(killerid),  PlayerName(playerid));
	SendWarMessage(WarLjubicasta, string);
	}
	else if(PlayerInfo[killerid][war2] == 1 && PlayerInfo[playerid][war1] == 2)
	{
	plavi1++;
	format(string, sizeof(string), "(WAR) %s je ubio protivnika %s", PlayerName(killerid), PlayerName(playerid));
	SendWarMessage(WarLjubicasta, string);
	}
	else if(PlayerInfo[killerid][war2] == 2 && PlayerInfo[playerid][war1] == 1)
	{
	plavi1++;
	plavi1++;
	format(string, sizeof(string), "(WAR) %s je ubio protivnika %s", PlayerName(killerid), PlayerName(playerid));
	SendWarMessage(WarLjubicasta, string);
	}
	else if(PlayerInfo[killerid][war2] == 2 && PlayerInfo[playerid][war1] == 2)
	{
	plavi1++;
	plavi1++;
	format(string, sizeof(string), "(WAR) %s je ubio protivnika %s", PlayerName(killerid), PlayerName(playerid));
	SendWarMessage(WarLjubicasta, string);
	}
	else if(PlayerInfo[killerid][war1] == 2 && PlayerInfo[playerid][war2] == 1)
	{
	crveni1++;
	crveni1++;
	format(string, sizeof(string), "(WAR) %s je ubio protivnika %s", PlayerName(killerid),  PlayerName(playerid));
	SendWarMessage(WarLjubicasta, string);
	}
	else if(PlayerInfo[killerid][war1] == 2 && PlayerInfo[playerid][war2] == 2)
	{
	crveni1++;
	crveni1++;
	format(string, sizeof(string), "(WAR) %s je ubio protivnika %s", PlayerName(killerid),  PlayerName(playerid));
	SendWarMessage(WarLjubicasta, string);
	}
    return 1;
}
I dont know if you need to kwow what messages means XD