Onplayertakedamage function spamming
#1

Why it keeps spamming when I do a headshot over 1 times in the same time.

Codes:

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    if(issuerid != INVALID_PLAYER_ID && bodypart == 9 && GetPlayerTeam(playerid) != GetPlayerTeam(issuerid) && OnDuty[playerid] == 0)
    {
        SetPlayerHealth(playerid, 0.0);
        new killedname[MAX_PLAYER_NAME], killername[MAX_PLAYER_NAME], Message[128];
        GetPlayerName(playerid, killedname, MAX_PLAYER_NAME);
        GetPlayerName(issuerid, killername, MAX_PLAYER_NAME);
        format(Message, sizeof(Message), "%s (%d) Has Been Killed By A Headshot From %s (%d)!", killedname, playerid, killername, issuerid);
        SendClientMessageToAll(0x00FBFFFF, Message);
        format(Message, sizeof(Message), "You Have Been Killed By A Headshot From %s (%d)!", killername, issuerid);
        SendClientMessage(playerid, 0xFF0000AA, Message);
        format(Message, sizeof(Message), "Congratulations! You Have Killed %s (%d) By A Headshot! Received Extra 2K!", killedname, playerid);
        SendClientMessage(issuerid, 0xFFEE00FF, Message);
        GivePlayerMoney(issuerid, 2000);
        GameTextForPlayer(issuerid, "~r~Headshot", 5000, 4);
    }
    return 1;
}
Reply
#2

You didn't mark the player as dead.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)