[NEED] OnPlayerDeath Messages
#1

Hello everybody

I need an OnPlayerDeath Script witch sends messages like when a player kills an other:

> Player1 kills player2 with [AK-47] (and SendDeathMessage too)

I hope someone will help me .. I notice that those scripts exist in all servers which I join but I didn't found those in web (SA-MP) :/

Sorry for my bad English :$

Thanks at began
Reply
#2

-cut-

Oh.. i didn't understand you earlier. You wan't a message in Chat too.

pawn Код:
#include        "a_samp"

public OnPlayerDeath(playerid, killerid, reason)
{
    new string[128];
    format(string, sizeof(string), "* Player %s [ID: %d] killed player %s [ID: %d] with: %s", PlayerName(killerid), killerid, PlayerName(playerid), playerid, reason);
    SendClientMessageToAll(-1, string);
    SendDeathMessage(killerid, playerid, reason);
    return true;
}

stock PlayerName(playerid)
{
    new Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, sizeof(Name));
    return Name;
}
Don't know about reason in chat. Test it by yourself and tell me is message working good. If not i'll make it other way.
Reply
#3

Quote:
Originally Posted by Riddick94
Посмотреть сообщение
pawn Код:
SendDeathMessage(killerid, playerid, reason);
Thanks .. But I knew that .. I put it already, What I need, its those message in each case:

Код:
Like if player death with /kill > Player X is dead [Suicide] ... :)
Reply
#4

Read my post up^
Reply
#5

pawn Код:
COMMAND:kill(playerid, params[])
{
    new Name[MAX_PLAYER_NAME], Message[128];
    GetPlayerName(playerid, Name, sizeof(Name));
    format(Message, sizeof(Message), "%s(%d) didnt like his life. So he did /kill", Name, playerid);
    SendClientMessageToAll(0xFF8000FF, Message);
    SetPlayerHealth(playerid, 0);
    return 1;
}
Like that?

Im to lazy but you could try the include OnPlayerShootPlayer to get the weapons. There is another way but I can be asked to do it all.
Reply
#6

@Riddick94: Yes, That is .. but this is just one reason .. I need the whole script .. when player drown, splat, suicide...

@techkid100: No, not that sorry .. but I need just OnPlayerDeath script
Reply
#7

Okey give me a few minutes.. i'll try to do something.
Reply
#8

Ended. I made it for you now this declaration ReasonNames:

pawn Код:
#include        "a_samp"

new ReasonNames[][] = // By Riddick.
{
    "Fists", "Brass Knuckles", "Golf Club", "Nite Stick", "Knife", "Baseball Bat", "Shovel",
    "Pool Cue", "Katana", "Chainsaw", "Purple Dildo", "Small White Vibrator", "Large White Vibrator",
    "Silver Vibrator", "Flower", "Cane", "Grenades", "Tear Gas (hitted)", "Molotov Cocktail",
    "9mm", "Silenced 9mm", "Desert Eagle", "Shotgun", "Sawn-off Shotgun", "Combat Shotgun",
    "Micro SMG", "MP5", "AK-47", "M4", "Tec9", "Country Rifle", "Sniper Rifle", "Rocket Launcher",
    "HS Rocker Launcher", "Flamethrower", "Minigun", "Satchel Charge", "Detonator",
    "Spray Can", "Fire Extinguisher", "Camera", "Nightvision Goggles", "Thermal Goggles",
    "Parachute", "Fake Pistol", "Vehicle", "Helicopter Blades", "Explosion", "Drowned", "Splat"
};

public OnPlayerDeath(playerid, killerid, reason)
{
    new string[128];
    format(string, sizeof(string), "* Player %s [ID: %d] killed player %s [ID: %d] with: %s", PlayerName(killerid), killerid, PlayerName(playerid), playerid, ReasonNames[reason]);
    SendClientMessageToAll(-1, string);
    SendDeathMessage(killerid, playerid, reason);
    return true;
}

stock PlayerName(playerid)
{
    new Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, sizeof(Name));
    return Name;
}
Test it and response here how it works.

@down
Aw.. i lost about GetWeaponName.. but i don't know is it work for drown etc. He can modify..
Reply
#9

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new string[128];
    new reasonname[32];
    GetWeaponName(reason, reasonname, sizeof(reasonname));
    format(string, sizeof(string), "* Player %s [ID: %d] killed player %s [ID: %d] with: %s", PlayerName(killerid), killerid, PlayerName(playerid), playerid, reasonname);
    SendClientMessageToAll(-1, string);
    return 1;
}
Reply
#10

Thanks .. It works ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)