SA-MP Forums Archive
Health and armor pickup fixing - 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: Health and armor pickup fixing (/showthread.php?tid=400161)



Health and armor pickup fixing - Mustafa6155 - 17.12.2012

pawn Код:
#include <a_samp>
new Health;
new Armor;

public OnPlayerDeath(playerid, killerid, reason)
{
                new Float:x,Float:y,Float:z;
                GetPlayerPos(playerid,x,y,z);
                Health = CreatePickup(1240,4,x+2,y,z,0);
                GetPlayerPos(playerid,x,y,z);
                Armor = CreatePickup(1242,4,x-2,y,z,0);
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == Health) SetPlayerHealth(playerid,100), DestroyPickup(Health);
    if(pickupid == Armor) SetPlayerArmour(playerid,100), DestroyPickup(Armor);
    return 1;
}
New its on OnPlayerPickUpPickup
Its when al player get on armor or health it destroy then how to make it will gone in 15 seconds?
Or every where in the dead pos it didnt gone.


Re: Health and armor pickup fixing - Huxley - 17.12.2012

Set a timer.


Re: Health and armor pickup fixing - Konstantinos - 17.12.2012

In OnPlayerDeath, after creating the pickups, set a timer as the user above said.
pawn Код:
SetTimer("Health_Armour", 15000, false);
Somewhere to your script, not inside a callback.
pawn Код:
forward Health_Armour();
public Health_Armour()
{
    DestroyPickup(Health);
    DestroyPickup(Armor);
    return 1;
}