SA-MP Forums Archive
OnPlayerDeath drops a simple pick up - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnPlayerDeath drops a simple pick up (/showthread.php?tid=158245)



OnPlayerDeath drops a simple pick up - OldDirtyBastard - 09.07.2010

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.


Re: OnPlayerDeath drops a simple pick up - OldDirtyBastard - 09.07.2010

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


Re: OnPlayerDeath drops a simple pick up - CAR - 09.07.2010

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);



Re: OnPlayerDeath drops a simple pick up - OldDirtyBastard - 09.07.2010

thakns


Re: OnPlayerDeath drops a simple pick up - OldDirtyBastard - 09.07.2010

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


Re: OnPlayerDeath drops a simple pick up - CAR - 09.07.2010

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



Re: OnPlayerDeath drops a simple pick up - OldDirtyBastard - 09.07.2010

hmh shoud it go somewhere outside any callbacks?


Re: OnPlayerDeath drops a simple pick up - Zimon95 - 09.07.2010

No it goes into OnPlayerPickUpPickup callback.


Re: OnPlayerDeath drops a simple pick up - OldDirtyBastard - 09.07.2010

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)



Re: OnPlayerDeath drops a simple pick up - CAR - 09.07.2010

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;
}