Health and armor pickup fixing
#1

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

Set a timer.
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)