GetPlayerWeaponAmmo Not returning ammo for a weapon

  • So, if you want to get ammo for a weapon (that you have in inventory) and have 2 weapons from same category (e.g. 2 heavy weapon) and one have 20 rockets(rpg), and one 1000 bullets (minigun), will return bullets from first weapon.

    Try to see:

    [Command("mw")]

    public void CMD_MyWeapons(Client player)

    {

    API.sendChatMessageToPlayer(player, "Your weapons:");


    WeaponHash[] player_weapons = API.getPlayerWeapons(player);

    foreach (WeaponHash weapon in player_weapons)

    {

    API.sendChatMessageToPlayer(player, "-> " + weapon + " " + API.getPlayerWeaponAmmo(player, weapon).ToString());

    }

    }

    you need to have one minigun and one rpg.