Error in OnPlayerDeath
#1

Hello.

I have problem but i dont know where is, i cant find.


In Server_log:

Код:
[13:28:54] [debug] Run time error 4: "Array index out of bounds"
[13:28:54] [debug]  Accessing element at index 65535 past array upper bound 999
[13:28:54] [debug] AMX backtrace:
[13:28:54] [debug] #0 00030f98 in ?? (0, 65535, 255) from usrpbeta.amx
[13:28:54] [debug] #1 00005c70 in public OnPlayerDeath (0, 65535, 255) from usrpbeta.amx
OnplayerDeath:

Код:
	//=====[DROPGUN]
    if(AdminEventTickP[playerid] == 0 || staffDuty[playerid] == false)
    {
	    new Float:X,Float:Y,Float:Z;
	    GetPlayerPos(playerid, X, Y, Z);
	    DropGun(GetPlayerWeapon(playerid),GetPlayerAmmo(playerid),X,Y,Z,GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
	}
	
	//=====[VARIABLES]
    StaffGod[playerid] = 0;
    staffDuty[playerid] = false;
    PlayerDead[playerid] = 1;

    PlayerInfo[playerid][pHealth] = 10;
    PlayerInfo[playerid][pArmour] = 0;

	//=====[SET]
	SetPlayerColor(playerid, COLOR_NORMALPLAYER);
	
    foreach(Player, i)
    {
    SetPlayerMarkerForPlayer(i, playerid, COLOR_NORMALPLAYER );
    }

	//=====[DESTROYDYNAMIC3DTEXTLABEL]
	if(PlayerInfo[playerid][pStaff] == 1)
	{
    DestroyDynamic3DTextLabel(gaDutyl[playerid]);
    DestroyDynamic3DTextLabel(haDutyl[playerid]);
    DestroyDynamic3DTextLabel(aDutyl[playerid]);
    }

	//AKO JE VEC IGRAC U BOLNICI
 	if(PlayerInfo[playerid][pUbolnici] == 1)
	{
 	 	KillTimer(HospitalTimerT1[playerid]);

 	 	PlayerTextDrawHide(playerid, PlayerText:TextdrawHC0);

 	 	HospitalCountSeconds[playerid] = 0;
	}
	//


	//=====[EVENT-MESSAGE]
    if(AdminEventTickP[killerid] != 0)
    {
        new sstring[124];
   	    format(sstring, sizeof(sstring), "[ADMIN-EVENT]: "COL_WHITE"%s je ubio igraca: %s.", GetName(killerid), GetName(playerid));
   	    SendMessageToAEP(COLOR_BLUE, sstring);
   	    //
        new string2[124];
        format(string2, sizeof(string2), "[SERVER]: "COL_WHITE"Ubili ste igraca: %s.", GetName(playerid));
        SendClientMessage(killerid, COLOR_ORANGE, string2);
	}


	//
Thanks.
Reply
#2

You must check if(killerid != INVALID_PLAYER_ID) to use killerid in MAX_PLAYERS arrays
Код:
	//=====[EVENT-MESSAGE]
    if(killerid != INVALID_PLAYER_ID) {
        if(AdminEventTickP[killerid] != 0)
        {
        new sstring[124];
   	    format(sstring, sizeof(sstring), "[ADMIN-EVENT]: "COL_WHITE"%s je ubio igraca: %s.", GetName(killerid), GetName(playerid));
   	    SendMessageToAEP(COLOR_BLUE, sstring);
   	    //
        new string2[124];
        format(string2, sizeof(string2), "[SERVER]: "COL_WHITE"Ubili ste igraca: %s.", GetName(playerid));
        SendClientMessage(killerid, COLOR_ORANGE, string2);
	}
    }
Reply
#3

Thanks mate, rep+.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)