SA-MP Forums Archive
Call OnPlayerDeath function - 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: Call OnPlayerDeath function (/showthread.php?tid=518623)



Call OnPlayerDeath function - Battlezone - 10.06.2014

Hi, i want to call OnPlayerDeath function when a player pickups a pickup ( the pickup owner will kill the pickup pickuper)
But this is the first time I call a function and i don't know how to do it.. thanks
Remark : the other player will be the killerid


Re: Call OnPlayerDeath function - Lynn - 10.06.2014

Can you explain a little better? Do you want them to die, when they pickup the pickup?


Re: Call OnPlayerDeath function - PrivatioBoni - 10.06.2014

Why not just SetPlayerHealth(playerid, 0);?

There is a way of calling functions manually but I forget at the moment. Sure it's easily ******able though.


Re: Call OnPlayerDeath function - Battlezone - 10.06.2014

Yep, and the killerid will be the one who created the pickup ( i )

pawn Код:
for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) {continue;}
        if(status[i] == 0) {continue;}
        if(pickupid == minePickup[i])
        {
            new Float:X, Float:Y, Float:Z;
            GetObjectPos(mine[i][0], X, Y, Z);
            CreateExplosion(X, Y, Z, 7, 1);
            DestroyPickup(minePickup[i]);
            DestroyObject(mine[i][0]);
            DestroyObject(mine[i][1]);
            status[i] = 0;
        }
    }
EDIT:PrivatioBoni, come one man im not a noob if i wanted to set the health automatically i could do it easily..


Re: Call OnPlayerDeath function - ReD_HunTeR - 10.06.2014

pawn Код:
new DeathPickup;

public OnPlayerPickUpPickup(playerid, pickupid)
{
   if(pickupid == DeathPickup)
   {
     SetPlayerHealth(playerid, 0);
   }
   return 1;
}
this?


Re: Call OnPlayerDeath function - Battlezone - 10.06.2014

Please read the topic again, no not that i can do that easily


Re: Call OnPlayerDeath function - Jefff - 10.06.2014

Give more variables owner and rest


Re: Call OnPlayerDeath function - PrivatioBoni - 11.06.2014

Quote:
Originally Posted by Battlezone
Посмотреть сообщение
EDIT:PrivatioBoni, come one man im not a noob if i wanted to set the health automatically i could do it easily..
I'm not sure if you have some issues reading, but I said why not do that, it was a suggestion, I never said or implied you didn't know how to do it.

You are also seemingly failing to comprehend that setting your health will kill you, thus will call OnPlayerDeath. It's not a difficult concept to grasp, especially because you're "not a noob".


Re: Call OnPlayerDeath function - TakeiT - 11.06.2014

To call a function, you simply add to your code
pawn Код:
OnPlayerDeath(playerid, killerid, reason);
just like calling any other public function


Re: Call OnPlayerDeath function - Battlezone - 11.06.2014

Quote:
Originally Posted by PrivatioBoni
Посмотреть сообщение
I'm not sure if you have some issues reading, but I said why not do that, it was a suggestion, I never said or implied you didn't know how to do it.

You are also seemingly failing to comprehend that setting your health will kill you, thus will call OnPlayerDeath. It's not a difficult concept to grasp, especially because you're "not a noob".
So you still insist? oh so when i set player health to 0 he won't die? wow ! what a mistery! come on, you won't re-teach me samp bascis.. I told you i don't wanna use that for a reason, still not understanding? pm me if so .-.