Headshot
#1

I've made a headshot,and if the person gets headshot, it shows on the Kill Camera that "he is drowned". I've tried SendDeathMessageToPlayer using the loops but it doesn't work. It says undefined symbol. How?

EDIT: OnPlayerGiveDamage script
pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
    if(weaponid == 34 && bodypart == 9)
    {
        // One shot to the head to kill with sniper rifle
        new name1[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME];
        SetPlayerHealth(damagedid, 0.0);
        GameTextForPlayer(damagedid, "~r~Headshot!", 1000, 5);
        GameTextForPlayer(playerid, "~r~Headshot!", 1000, 5);
        PlayerInfo[playerid][pHeadshots]++;
        PlayerInfo[playerid][pKills]++;
        PlayerInfo[damagedid][pDeaths]++;
        GetPlayerName(playerid, name1, sizeof(name1));
        GetPlayerName(damagedid, name2, sizeof(name2));
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            SendDeathMessageToPlayer(i, playerid, damagedid, weaponid);
        }
        printf("[part] %s [%d] has been headshotted by %s [%d].",name1,playerid,name2,damagedid);
    }
    if(weaponid == 34 && damagedid == GetPlayerTeam(playerid))
    {
        GameTextForPlayer(playerid, "~r~Do not teamkill!", 1000, 5);
    }
    return 1;
}
Reply
#2

Send the death message (witch is on the death list) on OnPlayerDeath. That will fix it. Too do that just create a variable and set it to 1 (On the headshot code) for the player who died and OnPlayerDeath do a condition (Where it sends the death message, remember that OnPlayerDeath has a reason parameter, I suggest that you format the reasons so that you can use them in a message if you like) and then set it back to 0 for the player who died.
Reply
#3

Fixed. Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)