How Can I add reasons for death
#1

How Can I add reasons for death in onplayerdeath my owner reason
Reply
#2

Check this out - https://sampwiki.blast.hk/wiki/SendDeathMessage
Reply
#3

i mean how can i add my own reasons for death
Reply
#4

Код:
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.
Reply
#5

i mean i can add more reasons like aliens
Reply
#6

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"
Reply
#7

Quote:
Originally Posted by AroseKhanNaizi
Посмотреть сообщение
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 - https://sampwiki.blast.hk/wiki/Weapons
Reply
#8

ok thanks anyway
Reply
#9

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.
Reply
#10

Thanks Man You Awesome
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)