14.02.2017, 01:48
How to make the max ammo, for example M4 is 50-450 example, if taken further, it is, "You can not get more ammunition, weapons can not accommodate you," someone help me with
anyone give me suggestions or code
CMD:giveammo(playerid, params[]) { if(GetPlayerWeapon(playerid) == WEAPON_M4) { new ammo = GetPlayerAmmo(playerid) if(ammo <= 50 || ammo >= 450) { SetPlayerAmmo(playerid, 450); } else { SendClientMessage(playerid, -1, "You can't have more then 50 ammo!"); } } return true; }
https://sampwiki.blast.hk/wiki/GivePlayerWeapon
https://sampwiki.blast.hk/wroot/index.ph...=SetPlayerAmmo https://sampwiki.blast.hk/wiki/GetPlayerAmmo Код:
CMD:giveammo(playerid, params[]) { if(GetPlayerWeapon(playerid) == WEAPON_M4) { new ammo = GetPlayerAmmo(playerid) if(ammo <= 50 || ammo >= 450) { SetPlayerAmmo(playerid, 450); } else { SendClientMessage(playerid, -1, "You can't have more then 50 ammo!"); } } return true; } Haven't tested the code, no idea if it'll actually work. |