06.05.2020, 12:02
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.
new playermoney = GetPlayerMoney(playerid); if(playermoney < 1200) { //do what you want return 0; }
new healthpickups[4];
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); }
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; }