DeathMessage doesn't show
#4

The wiki page says:
Quote:

You do not need to check whether killerid is INVALID_PLAYER_ID before using it in SendDeathMessage. INVALID_PLAYER_ID is a valid killerid ID parameter in that function.

Also, the code was a little bit messy and I really had some issues on reading it properly.
I tried to improve it.

I am not sure if it works because I haven't tested it, so let me know:

pawn Код:
if(IsSpawned[killerid] == false || IsOnDuty[killerid] == true && killerid != INVALID_PLAYER_ID) // If the killer is NOT spawned OR if the killer is ON admin duty AND the killer exists.
    UnfairDeath[playerid] = true;

if(IsOnDuty[killerid] == true && killerid != INVALID_PLAYER_ID) // If the killer is ON admin duty AND the killer exists.
    printf("Admin %s (%d) has killed %s (%d) unfairly.", GetName(killerid), killerid, GetName(playerid), playerid);
   
if(UnfairDeath[playerid] == false) // If the death is FAIR.
{
    if(killerid != INVALID_PLAYER_ID) // If the killer is VALID.
    {
        SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
        Kills[killerid]++;
        Cash[killerid] += 2000;
        new weapname[28];
        GetWeaponName(reason, weapname, sizeof(weapname));
        printf("%s (%d) Killed By %s (%d) - %s", GetName(playerid), playerid, GetName(killerid), killerid, weapname);
        format(string, sizeof(string), "%s (%d) Died. Killed By %s (%d) - %s", GetName(playerid), playerid, GetName(killerid), killerid, weapname);
           
        for(new i = 0; i < MAX_SLOT; i++)
            if(IsPlayerConnected(i) && ShowDeathMessage[i] == true)
                SendClientMessage(i, COLOR_BROWN, string);
    }
    else // If the killer is NOT VALID.
    {
        new weapname[28];
        GetWeaponName(reason, weapname, sizeof(weapname));
        printf("%s (%d) Killed By %s (%d) - %s", GetName(playerid), playerid, GetName(killerid), killerid, weapname);
        format(string, sizeof(string), "%s (%d) Died. (%s)", GetName(playerid), playerid, weapname);
       
        for(new i = 0; i < MAX_SLOT; i++)
            if(IsPlayerConnected(i) && ShowDeathMessage[i] == true)
                SendClientMessage(i, COLOR_BROWN, string);
    }
   
    Deaths[playerid]++;
    SendDeathMessage(killerid, playerid, reason);
}
Reply


Messages In This Thread
DeathMessage doesn't show - by Skimmer - 29.05.2013, 20:00
AW: DeathMessage doesn't show - by HurtLocker - 29.05.2013, 21:00
Re: DeathMessage doesn't show - by Pottus - 29.05.2013, 21:01
Re: DeathMessage doesn't show - by GiamPy. - 29.05.2013, 21:08
AW: DeathMessage doesn't show - by Skimmer - 30.05.2013, 09:04
AW: DeathMessage doesn't show - by Skimmer - 31.05.2013, 19:34

Forum Jump:


Users browsing this thread: 1 Guest(s)