26.06.2014, 16:47
Hi, I've encountered a strange problem with my OnPlayerDeath, if there is player who died by a INVALID_PLAYER_ID for example if an admin does /sethp 0 0, he will spawn at 0,0,0 and be in the CJ skin..
It stopped when I removed this code under, it looks like it's crashing it somehow, if a player gets killed by a normal player with or without hit, it works fine, but if a player gets killed by a INVALID_PLAYER_ID, it bugs.
It stopped when I removed this code under, it looks like it's crashing it somehow, if a player gets killed by a normal player with or without hit, it works fine, but if a player gets killed by a INVALID_PLAYER_ID, it bugs.
Код:
if (AcceptedHit[playerid] == killerid && CharacterData[playerid][pBounty])
{
printf("OnPlayerDeath: %d | %d | %d | %d", playerid, killerid, reason, AcceptedHit[playerid]);
new string[128];
for(new i = 1; i < MAX_FACTIONS; i++)
{
if(FactionData[i][fac_Taken] == 1 && FactionData[i][fac_Type] == FAC_TYPE_HITMEN)
{
format(string, sizeof(string),"Hitman %s has failed the contract on %s and lost $%d.", PlayerRPName(playerid), PlayerRPName(killerid), CharacterData[killerid][pBounty]/2);
SendFactionMessage(i, YELLOW, string);
}
}
format(string, sizeof(string),"You have killed a hitman and gained $%d, the contract on your head has been removed.", CharacterData[killerid][pBounty]/2);
SendClientMessage(killerid, YELLOW, string);
CharacterData[playerid][pFailedHits] ++;
//PlayerJustDied[playerid] = 1;
GiveMoney(playerid, -CharacterData[killerid][pBounty]/2);
GiveMoney(killerid, CharacterData[killerid][pBounty]/2);
AcceptedHit[playerid] = 999;
CharacterData[killerid][pBounty] = 0;
printf("OnPlayerDeath: %d | %d | %d | %d", playerid, killerid, reason, AcceptedHit[playerid]);
}

