Pickups.
#1

Can anyone help me? How can I make 4 pickups health for the players and they can use them with money and if their money is less than $1200, the server will not allow them to use this pickup.
Reply
#2

https://sampwiki.blast.hk/wiki/CreatePickup
https://sampwiki.blast.hk/wiki/OnPlayerPickUpPickup

Under OnPlayerPickUpPickup where the pickupid is the one of the health ones:
Code:
new playermoney = GetPlayerMoney(playerid);
if(playermoney < 1200)
{
   //do what you want
   return 0;
}
Reply
#3

Somewhere:
Code:
new healthpickups[4];
In OnGameModeInit (change the x, y, z):
Code:
healthpickups[0] = CreatePickup(1240, 1, x, y, z);
healthpickups[1] = CreatePickup(1240, 1, x, y, z);
healthpickups[2] = CreatePickup(1240, 1, x, y, z);
healthpickups[3] = CreatePickup(1240, 1, x, y, z);
}
In OnPlayerPickUpPickup:
Code:
for (new p = 0; p < sizeof(healthpickups); p++)
{
    if (healthpickups[p] != pickupid) continue;
    if (GetPlayerMoney(playerid) >= 1200)
    {
        new Float:health;
        GetPlayerHealth(playerid, health);
        if (health < 100.0)
        {
            GivePlayerMoney(playerid, -1200);
            SetPlayerHealth(playerid, 100.0);
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)