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

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

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

@EDIT

ok ok hmm, 'l think it is not possible..
Reply
#3

i think this is not possible.. not perfectly
Reply
#4

Set the ammunation to infinity..an then newkeys & KEY_FIRE check if he had the disabled weapon and play a animation if he wanna shoot..like falling down or sth else
Reply
#5

There's no other way around it?
Reply
#6

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

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

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

Ehhh... Use "1 ammo" as 0 ammo.
PHP код:
public OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
{
   new 
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. 
   
else{
   return 
1;}

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).
Reply
#10

You should use Attached object
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)