Sign in to follow this  
Followers 0
Bonuspunkt

bonusAmmoWarning

1 post in this topic

plays a audio clue when you fire a weapon below the low ammo warning

local lastActiveWeapon = -1;
local lastAmmo = 0;

local widgetName = "bonusAmmoWarning"
local widget = {
  draw = function()

    local player = _G.getPlayer()
    if not player then return end

    local activeWeapon = player.weapons[player.weaponIndexSelected]

    if lastActiveWeapon ~= player.weaponIndexSelected then
      lastActiveWeapon = player.weaponIndexSelected
      lastAmmo = activeWeapon.ammo
    end

    if activeWeapon.ammo < activeWeapon.lowAmmoWarning and lastAmmo > activeWeapon.ammo then
      _G.playSound('internal/weapons/weapon_lowammo')
    end
    lastAmmo = activeWeapon.ammo
  end
};

_G[widgetName] = widget
_G.registerWidget(widgetName);

 

sensi_ and DEZ like this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0