How would one make a weapon not dissapear, even at 0 ammunition?

Self explanatory title. Is there an easy trick to do such a thing?

Example: Player crafts a 9mm with 0 ammo. Weapon is unusable, but still in inventory.

Sorry not quite understand, do not disappear or not finish the ammo of your hand? GivePlayerWeapon(playerid, ID, 99999); :-/ ??


ok ok hmm, 'l think it is not possible..

i think this is not possible.. not perfectly

Set the ammunation to then newkeys & KEY_FIRE check if he had the disabled weapon and play a animation if he wanna falling down or sth else

There's no other way around it?

You should save it on a variable, it's not possible to keep it in the weapon reel, unless maybe you save a variable as soon as he fires his gun with 1 ammo, make it like WeaponDisabled[playerid][weaponid]=1, and check if thats 1, you play idle stance animation to cancel his shot nexttime

How much i knew that weapon is disappear when you have 0 bullets this is how it works in SAMP. But i am not confirmed that is there any way that we can save that weapon in inventory. As if ur weapon is 0 bullet then it would be auto hide.but as i said as much i knew the gun would be disappear.

in my cod gm inventory disapear,,
but in my zombie gm,inventory not disapear,,even at 0 ammo

Ehhh... Use "1 ammo" as 0 ammo.
PHP код:
public OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
ammo GetPlayerAmmo(playerid); // Getting player his current ammo.
new weapon GetPlayerWeapon(playerid); // Getting player his current weapon.
if(ammo == 1){ // Check if player has 1 ammo.
SetPlayerAmmo(playeridweapon1); // Prevent the weapon from dissappearing.
return 0;} // Bullet won't do damage. 

Tested it and works perfect.
It won't shoot any bullet when having 1 ammo.
REMINDER: Since a minigun and someother weapons are shooting to fast you'll have to raise the amount of ammo for these. Tested this with Desert Deagle, Colt45, Shotgun, Spaz-12 and Grenades and was working perfectly.
It didn't work with Miniguns since it was shooting to fast. Just raise up if(ammo == 1) to if(ammo == 2).

You should use Attached object

Forum Jump:

Users browsing this thread: