SendDeathMessage
#1

OnPlayerDeath:
Код:
SendDeathMessage(killerid, playerid, reason);
Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
    if(damagedid != INVALID_PLAYER_ID)
    {
        if(weaponid == 8) SetPlayerHealth(damagedid, 0);
    }
    return 1;
}
If i kill a player with katana,reason do not display as i killed player with katana!

but displayed that player death with suicide..
Reply
#2

I think you should put "SendDeathMessage(killerid, playerid, reason);"

Down there in the code, under "if(weaponid == SetPlayerHealth(damagedid, 0);"

Since that's not a normal death, this is a "SCRIPTED" death.
Reply
#3

Yeah normal.

You kill the player with function "SetPlayerHealth" to for the script it's a suicide.
OnPlayerDeath is called with INVALID_PLAYER_ID to killerid and SendDeathMessage displayed a suicide.

For fix that, you need this script :

PHP код:
public OnPlayerGiveDamage(playeriddamagedidFloatamountweaponid)
{
    if(
damagedid != INVALID_PLAYER_ID)
    {
        if(
weaponid == 8)
        {
            
SetPlayerHealth(damagedid0);
            
SendDeathMessage(playeriddamagedid8);
        }
    }
    return 
1;
}

public 
OnPlayerDeath(playeridkilleridreason)
{
    if(
IsPlayerConnected(killerid)) SendDeathMessage(killeridplayeridreason);
       return 
1;

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)