Advertisement
Crimenet

Infinite ammo

Dec 15th, 2013
3,995
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. -- Infinite ammo (resets ammo on reload & also when ammo runs out, just in case you activate it late)
  2. if not _onReload then _onReload = RaycastWeaponBase.on_reload end
  3. function RaycastWeaponBase:on_reload()
  4. if managers.player:player_unit() == self._setup.user_unit then
  5. self.set_ammo(self, 1.0)
  6. else
  7. _onReload(self)
  8. end
  9. end
  10.  
  11. if not _fireWep then _fireWep = NewRaycastWeaponBase.fire end
  12. function NewRaycastWeaponBase:fire( from_pos, direction, dmg_mul, shoot_player, spread_mul, autohit_mul, suppr_mul, target_unit )
  13. local result = _fireWep( self, from_pos, direction, dmg_mul, shoot_player, spread_mul, autohit_mul, suppr_mul, target_unit )
  14.  
  15. if managers.player:player_unit() == self._setup.user_unit and self:get_ammo_total() == 0 then
  16. self.set_ammo(self, 1.0)
  17. end
  18.  
  19. return result
  20. end
  21.  
  22. -- Message on screen
  23. if managers.hud then
  24. managers.hud:show_hint( { text = "Infinite ammo" } )
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement