How Can I add reasons for death - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How Can I add reasons for death (
/showthread.php?tid=514354)
How Can I add reasons for death -
AroseKhanNiazi - 21.05.2014
How Can I add reasons for death in onplayerdeath my owner reason
Re: How Can I add reasons for death -
Adityz - 21.05.2014
Check this out -
https://sampwiki.blast.hk/wiki/SendDeathMessage
Re: How Can I add reasons for death -
AroseKhanNiazi - 21.05.2014
i mean how can i add my own reasons for death
Re: How Can I add reasons for death -
Rittik - 21.05.2014
Код:
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.
Re: How Can I add reasons for death -
AroseKhanNiazi - 21.05.2014
i mean i can add more reasons like aliens
Re: How Can I add reasons for death -
Rittik - 21.05.2014
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"
Re: How Can I add reasons for death -
Adityz - 21.05.2014
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
Re: How Can I add reasons for death -
AroseKhanNiazi - 21.05.2014
ok thanks anyway
Re: How Can I add reasons for death -
Threshold - 21.05.2014
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.
Re: How Can I add reasons for death -
AroseKhanNiazi - 21.05.2014
Thanks Man You Awesome