SendDeathMessageEx
#1

Hello, I'm facing some problems with the Deathmessages. When every a player kills someone it sends the message that the player has suicided while a player has killed him ( This happens 75% of the times ). It seems like it doesn't detect the killer.

SendDeathMessageEx
PHP код:
SendDeathMessageEx(playeridkilleridreason)
{
    new 
string[128], killername[MAX_PLAYER_NAME], deathreason[24], modelid;
    if (
reason != INVALID_REASON && !IsPlayerNPC(killerid))
    {
        
modelid killerid != INVALID_PLAYER_ID GetPlayerState(killerid) == PLAYER_STATE_DRIVER GetVehicleModel(GetPlayerVehicleID(killerid)) : 0;
        if (
reason == 31)
        {
            switch (
modelid)
            {
                case 
447deathreason "Sparrow Machine Gun";
                case 
464deathreason "RC Baron Machine Gun";
                case 
476deathreason "Rustler Machine Gun";
                default: 
deathreason "M4";
            }
        }
        else if (
reason == 37)
        {
            
deathreason "Fire";
        }
        else if (
reason == 38)
        {
            switch (
modelid)
            {
                case 
425deathreason "Hunter Machine Gun";
                default: 
deathreason "Minigun";
            }
        }
        else if (
reason == 50)
        {
            switch (
modelid)
            {
                case 
417425447465469487488497501548563deathreason "Helicopter";
                default:
                {
                    
deathreason "Collision";
                    
reason 49;
                }
            }
        }
        else if (
reason == 51)
        {
            switch (
modelid)
            {
                case 
425deathreason "Hunter Missile";
                case 
432deathreason "Rhino Turret";
                case 
520deathreason "Hydra Missile";
                default: 
deathreason "Explosion";
            }
        }
        else
        {
            
format(deathreason24"%s"WeaponName[reason]);
        }
        if (
killerid != INVALID_PLAYER_ID)
        {
               
GetPlayerName(killeridkillernameMAX_PLAYER_NAME);
            
format(string128"* %s has been killed by %s (%s)."GetName(playerid), killernamedeathreason);
        }
        else 
format(string128"* %s has died (%s)."GetName(playerid), deathreason);
    }
    else
    {
        
format(string128"* %s has died (%s)."GetName(playerid), WeaponName[sizeof(WeaponName)-1]);
    }
    
SendClientMessageToAll(COLOR_WHITEstring);
    
SendDeathMessage(killeridplayeridreason);

Also, I have some hits that my skinhit system would be causing this so here take a look 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;

Thanks to anyone who helps!
Reply


Messages In This Thread
SendDeathMessageEx - by Exhibit - 10.05.2018, 18:15
Re: SendDeathMessageEx - by CrystalGamer - 10.05.2018, 18:53
Re: SendDeathMessageEx - by Exhibit - 10.05.2018, 19:27
Re: SendDeathMessageEx - by CyNiC - 11.05.2018, 01:52
Re: SendDeathMessageEx - by Exhibit - 11.05.2018, 10:47
Re: SendDeathMessageEx - by Exhibit - 11.05.2018, 11:22

Forum Jump:


Users browsing this thread: 1 Guest(s)