OnPlayerDeath drops a simple pick up
#1

Simple stuff, player dies, he drops a health pickup with like 50hp increase of its health.
So when the other player picks up the health pickup his
health will be Refilled by 50hp or so(i will probably adjusting this a bit)
But only ONE player can pick the health up, so the pick up gets terminated
after it gets picked up...
I can add this to the Weapon Drop FS....
Regards.
Reply
#2

tried to serach on the forum, but didnt found anything usefull...
so if anyone can help me with that...
Reply
#3

pawn Код:
//top
new DeathPickup[MAX_PLAYERS];
OnPlayerDeath:
pawn Код:
new Float:px, Float:py, Float:pz;
GetPlayerPos(playerid, px, py, pz);
DeathPickup[playerid] = CreatePickup(1240,8,px,py,pz, 0);
OnPlayerPickupPickUp (don't know if you need this)
pawn Код:
if(pickupid == DeathPickup) return DestroyPickup(DeathPickup);
Reply
#4

thakns
Reply
#5

ehm where can i change the amount of health is being refilled?
Reply
#6

Oh sorry
pawn Код:
if(pickupid == DeathPickup)
{
   new Float:health;
   GetPlayerHealth(playerid, health);
   SetPlayerHealth(playerid, health+50);
   DestroyPickup(DeathPickup);
   return 1;
}
Reply
#7

hmh shoud it go somewhere outside any callbacks?
Reply
#8

No it goes into OnPlayerPickUpPickup callback.
Reply
#9

i have this in this format
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(1240 == DeathPickup)
    {
        new Float:health;
        GetPlayerHealth(playerid, health);
        SetPlayerHealth(playerid, health+50);
        DestroyPickup(DeathPickup);
        return 1;
    }
    return 0;
}
and its getting me these 2 errors

error 033: array must be indexed (variable "DeathPickup")
error 035: argument type mismatch (argument 1)
Reply
#10

You don't need 1240
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == DeathPickup)
    {
        new Float:health;
        GetPlayerHealth(playerid, health);
        SetPlayerHealth(playerid, health+50);
        DestroyPickup(DeathPickup);
        return 1;
    }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)