Death messages doesn't send for id 0
#1

Hey, So I have this weird bug where if someone kills id 0 it won't show it in the deathlog and the kills and deaths won't increase but when the player relogs with the same id it gets fixed somehow. The server doesn't detect if id 0 has been killed it shows as if he suicided but when he relogs it gets fixed.

OnPlayerDeath
PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
       new 
string[128], killername[MAX_PLAYER_NAME];
       
GetPlayerName(lasthit[playerid], killernameMAX_PLAYER_NAME);
    if(
killstreak[playerid] >= 3)
    {
     
format(string,sizeof(string), "~ %s has ended %s's killstreak"killernameGetName(playerid));
     
SendClientMessageToAll(COLOR_ORANGEstring);
     
SetPlayerColor(playeridCOLOR_WHITE);
    }
    
killstreak[playerid] = 0;
    
HandleKS(killerid);
    
ResetPlayerWeapons(playerid);
    
GameTextForPlayer(playerid,"~r~~h~WASTED",8000,1);
    if(
PlayerInfo[killerid][pDonator] == 1)
    {
        
GivePlayerCash(killerid200);
    }
    else {
        
GivePlayerCash(killerid100);
    }
    
SetPlayerScore(killeridGetPlayerScore(killerid) + 1);
    
GivePlayerCash(killerid100);
    
PlayerInfo[killerid][pKills]++;
    
PlayerInfo[playerid][pDeaths]++;
    
SaveAccountStats(playerid);
       if(
lasthit[playerid] == INVALID_PLAYER_ID)
    {
        
SendDeathMessage(INVALID_PLAYER_IDplayeridreason);
        return 
1;
    }
    if(
lasthit[playerid] != INVALID_PLAYER_ID)
     {
        
format(stringsizeof(string), "* %s[%d] has been killed by %s."GetName(playerid),playeridkillername);
         
SendDeathMessage(lasthit[playerid],playerid,GetPlayerWeapon(lasthit[playerid]));
         
SendClientMessageToAll(COLOR_WHITEstring);
         return 
1;
     }
     
lasthit[playerid] = INVALID_PLAYER_ID;
    return 
1;

Also I guess this is caused by the skinhit system.

PHP код:
public OnPlayerGiveDamage(playeriddamagedidFloatamountweaponid)
{
    if(
damagedid != INVALID_PLAYER_ID)
    {
        new 
Float:armourGetPlayerArmour(damagedid,armour);
        if(
armour 1)
        {
            new 
Float:healthGetPlayerHealth(damagedidhealth);
            
SetPlayerHealth(damagedid,health-amount);
            
lasthit[damagedid] = playerid;
            return 
1;
        }
        if(
armour 0)
        {
            if(
armour amount)
            {
                new 
Float:healthGetPlayerHealth(damagedidhealth);
                new 
Float:value amount-armour;
                
SetPlayerArmour(damagedid,0);
                
SetPlayerHealth(damagedid,health-value);
                
lasthit[damagedid] = playerid;
                return 
1;
            }
            if(
armour amount)
            {
                
SetPlayerArmour(damagedid,armour-amount);
                
lasthit[damagedid] = playerid;
                return 
1;
            }
            return 
1;
        }
        return 
1;
    }
    return 
1;

Also I know I made this topic before but this isn't the same topic I fixed most of the stuff myself from the old topic but I can't fix this. This just seems weird.
Reply


Messages In This Thread
Death messages doesn't send for id 0 - by Exhibit - 11.05.2018, 22:40
Re: Death messages doesn't send for id 0 - by RogueDrifter - 12.05.2018, 05:54
Re: Death messages doesn't send for id 0 - by Sew_Sumi - 12.05.2018, 10:16
Re: Death messages doesn't send for id 0 - by Exhibit - 12.05.2018, 10:42
Re: Death messages doesn't send for id 0 - by Sew_Sumi - 12.05.2018, 10:56
Re: Death messages doesn't send for id 0 - by Exhibit - 12.05.2018, 11:12
Re: Death messages doesn't send for id 0 - by RogueDrifter - 12.05.2018, 14:10
Re: Death messages doesn't send for id 0 - by Exhibit - 12.05.2018, 17:07
Re: Death messages doesn't send for id 0 - by Sew_Sumi - 12.05.2018, 17:49
Re: Death messages doesn't send for id 0 - by RogueDrifter - 13.05.2018, 11:52

Forum Jump:


Users browsing this thread: 1 Guest(s)