Error in OnPlayerDeath - 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: Error in OnPlayerDeath (
/showthread.php?tid=617079)
Error in OnPlayerDeath -
Cr4nh - 15.09.2016
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.
Re: Error in OnPlayerDeath -
Shinja - 15.09.2016
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);
}
}
Re: Error in OnPlayerDeath -
Cr4nh - 15.09.2016
Thanks mate, rep+.