SA-MP Forums Archive
Detect "custom deaths" - 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: Detect "custom deaths" (/showthread.php?tid=496149)



Detect "custom deaths" - Kyance - 20.02.2014

I've created a bombing script, and a minigun script, but, how can i detect "custom" deaths for it?
Like, i would want it, so the person who dropped the bomb( Create the minigun ), would get score(And it would show in the kill-list, that -- BOMBER (explosion/skull) TARGET --, or MINIGUN_USER (skull/minigun) TARGET )

All it does for me is show, that the player has "suicided"(skull).. But how can i make it, so (as i said above), it shows the killerid too?;d


Re: Detect "custom deaths" - xo - 20.02.2014

pawn Код:
if(reason == 38) SendDeathMessage(killerid, playerid, reason);
Under player death? maybe that what you need?
that send death message ( Kill list ) if killer id killed the player with minigun


Re: Detect "custom deaths" - Kyance - 20.02.2014

Quote:
Originally Posted by XO
Посмотреть сообщение
pawn Код:
if(reason == 38) SendDeathMessage(killerid, playerid, reason);
Under player death? maybe that what you need?
that send death message ( Kill list ) if killer id killed the player with minigun
No, i mean..
The bombing script creates an explosion ( lol .. ), which kills the player, with the "suicide" reason, and the same goes for the Minigun script..
It slowly reduces the players health, and kills the player, with the "suicide" reason.
I want the Minigun/Bombing script, to actually give a "kill reason" ;d


Re: Detect "custom deaths" - xo - 20.02.2014

pawn Код:
OnPlayerDeath(killerid,playerid,38);
will shows that he got killed by " Minigun" but you have to set the player hp to 0 before it tho. i already used that in my " bombing script " and to avoid multiple " Killist " msgs. make a variable to check if he died coz of bomb.


Re: Detect "custom deaths" - Kyance - 20.02.2014

Quote:
Originally Posted by XO
Посмотреть сообщение
pawn Код:
OnPlayerDeath(killerid,playerid,38);
will shows that he got killed by " Minigun" but you have to set the player hp to 0 before it tho. i already used that in my " bombing script " and to avoid multiple " Killist " msgs. make a variable to check if he died coz of bomb.
Eh, could you give me an example?


Re: Detect "custom deaths" - xo - 20.02.2014

pawn Код:
new HaveBomb[MAX_PLAYERS];
When you plant a bomb on someone or w/e is your script work ^^
pawn Код:
HaveBomb[playerid] = 1;
then set a timer on him to " explode or low his health till death " and use OnPlayerDeath like i said
and OnPlayerDeath
pawn Код:
If(!HaveBomb[playerid] == 1) SendDeathMessage(killerid, playerid, reason);



Re: Detect "custom deaths" - Kyance - 20.02.2014

Quote:
Originally Posted by Kyance
Посмотреть сообщение
Eh, could you give me an example?
Here's the timer of the minigun script (SetPlayerHealth/Dying stuff is in here)

pawn Код:
forward MinigunThing();
public MinigunThing()
{
    for(new i = 0; i < MAX_PLAYERS; i ++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInRangeOfPoint(i, 10.5, MPos[0], MPos[1], MPos[2]))
            {
                new Float:RotX,Float:RotY,Float:px,Float:py, Float:pAngle;
                GetPlayerPos(i, px,py,pAngle);
                GetObjectRot(Minigun, RotX, RotY, pAngle);
                SetObjectRot(Minigun, RotX, RotY, pAngle+2);
                new Float:health, Float:armour, string[92];
                GetPlayerHealth(i, health);
                GetPlayerArmour(i, armour);
                PlayerPlaySound(i, 1130, MPos[0],MPos[1],MPos[2]);
                if(armour >= 1)
                {
                    SetPlayerArmour(i, armour-MinigunDamage);
                }
                else
                {
                    SetPlayerHealth(i, health-MinigunDamage);
                }
                format(string, sizeof(string), "~w~DMG: ~r~%0.1f\n~w~POSITION:\n~w~X: ~r~%0.1f\n ~w~Y: ~r~%0.1f\n ~w~Z: ~r~%0.1f", MinigunDamage, MPos[0], MPos[1],MPos[2]);
                GameTextForPlayer(i, string, 3000, 3);
            }
        }
    }
    return 1;
}
So..
#1: Create a bool which detects death by minigun
Will it look like:

pawn Код:
/*The Minigun Timer stuff Here*/
if(health == 0)
{
    DeathByMinigun{ i } = true; /*I guess..?*/
}
/*Somewhere*/
if(DeathByMinigun{ playerid })
{
    SendDeathMessage(/*What do i put here?*/, playerid, 38);
}
Well, i have a "special feature", which lets me know who spawned in the minigun, but, how do i "transfer" it into the SendDeathMessage?

@XO: I have a Rustler bomb script, it's not a planting, it's just that a plane drops an explosive bomb (Like nuclear for an example!)


Re: Detect "custom deaths" - Kyance - 21.02.2014

Bump ( check message above me please ;d )