Call OnPlayerDeath function
#1

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

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

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

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

pawn Код:
new DeathPickup;

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

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

Give more variables owner and rest
Reply
#8

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)