PDA

View Full Version : How Can I add reasons for death


AroseKhanNiazi
21/05/2014, 06:15 AM
How Can I add reasons for death in onplayerdeath my owner reason

Adityz
21/05/2014, 06:19 AM
Check this out - http://wiki.sa-mp.com/wiki/SendDeathMessage

AroseKhanNiazi
21/05/2014, 06:24 AM
i mean how can i add my own reasons for death

Rittik
21/05/2014, 06:37 AM
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, reason);
if(reason==16) //This is an example.ID 16 is for Grenade.
{
SendClientMessage(playerid,0xFFFFFFFF,"Death Reason: Killed by a Grenade");
}

return 1;
}
I think this is what you wanted for.

AroseKhanNiazi
21/05/2014, 06:57 AM
i mean i can add more reasons like aliens

Rittik
21/05/2014, 07:01 AM
Just specify a weapon for aliens and then try the above code.Just replace the Grenade/weapon of your choice by aliens in this text "Death Reason: Killed by a Grenade"

Adityz
21/05/2014, 07:01 AM
i mean i can add more reasons like aliens

You cannot add your own reasons in SAMP, though you can use any of the pre-existing reasons available here - http://wiki.sa-mp.com/wiki/Weapons

AroseKhanNiazi
21/05/2014, 07:04 AM
ok thanks anyway

Threshold
21/05/2014, 07:20 AM
You can add your own reasons, but they must be through player variables. For example, lets say someone takes damage from falling into a pit of 'lava' that you have created, you must have something like PlayerFallenIntoLava[playerid] = true. Then in OnPlayerDeath, check if that variable is true, then the reason can be "Lava".

That's just an example. I've seen a CnR with that exact kind of system. There are hundreds of ways to die, all created, not native to samp. (Obviously, this doesn't actually 'add' a 'reason' to OnPlayerDeath.

AroseKhanNiazi
21/05/2014, 07:44 AM
Thanks Man You Awesome