CrashDetect Warning on 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: CrashDetect Warning on OnPlayerDeath (
/showthread.php?tid=419786)
CrashDetect Warning on OnPlayerDeath - Patrick - 02.03.2013
hello guys i have a problem which someone dies it shows me the crash detect warning
pawn Код:
[12:30:20] [debug] Run time error 4: "Array index out of bounds"
[12:30:20] [debug] Accessing element at index 65535 past array upper bound 499
[12:30:20] [debug] AMX backtrace:
[12:30:20] [debug] #0 0001ea74 in public FC_OnPlayerDeath () from lscnr_mysql.amx
[12:30:20] [debug] #1 native CallLocalFunction () [00471e90] from samp-server.exe
[12:30:20] [debug] #2 0000218c in public OnPlayerDeath () from lscnr_mysql.amx
OnPlayerDeath Callback
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
//Adds Player Death and kills
pInfo[killerid][Kills] ++;
pInfo[playerid][Deaths] ++;
zoneupdates[playerid] =0;
SetPlayerWantedLevel(playerid, 0);
if(HasHit[playerid] >= 1)
{
if(gTeam[playerid] == TEAM_HITMAN)
{
new string[128];
format(string,sizeof(string),"{FFDA00}[HIT DEATH]:{FFFFFF} %s(%d) has been killed by %s(%d) for a hit contract.",PlayerName(playerid),playerid,PlayerName(killerid),killerid);
SendClientMessageToAll(-1,string);
//
GivePlayerMoney(killerid,HitMoney[playerid]);
SendClientMessage(killerid,COLOR_GREY,"[[_Contract Completed_]]");
format(string,sizeof(string),"~b~Hit Contract Completed~n~~b~Received ~p~$%d",HitMoney[playerid]);
GameTextForPlayer(killerid,string,5000,3);
IncreaseWantedLevel(killerid,20);
//
format(string,sizeof(string),"[DISPATCH] Suspect %s(%d) has murdered %s(%d) and has been caught on CCTV. Arrest the suspect ASAP.",PlayerName(killerid),killerid,PlayerName(playerid),playerid);
SendClientMessageToAllCops(string);
//
HasHit[playerid] =0;
HitMoney[playerid] =0;
SetPlayerWantedLevel(playerid, 0);
pInfo[killerid][TotalHitFinished] ++;
}
return 1;
}
//Sends a Death Message
SendDeathMessage(killerid,playerid,reason);
//Reset the HouseID where the player is located
APlayerData[playerid][CurrentHouse] = 0;
return 1;
}
Re: CrashDetect Warning on OnPlayerDeath -
Yves - 02.03.2013
check on your public FC_OnPlayerDeath something wrong on that part
sorry didnt see public OnPlayerDeath there
Re: CrashDetect Warning on OnPlayerDeath - Patrick - 02.03.2013
I dont have any
FC_OnPlayerDeath callback
Re: CrashDetect Warning on OnPlayerDeath -
Vince - 02.03.2013
First line.
pawn Код:
pInfo[killerid][Kills] ++;
If the player kills himself (fire, fall damage, ...) then killerid is INVALID_PLAYER_ID = 0xFFFF = 65535.
Re: CrashDetect Warning on OnPlayerDeath - Patrick - 02.03.2013
yes. that is when the command /kill or /reclass executed.
so what should it be? how could i avoid that? from crashdetect warning. any idea how can i fix it?
Is This Right?
pawn Код:
if(killerid != INVALID_PLAYER_ID)
{
pInfo[killerid][Kills]++;
}