Log in to reply
 

C# NativeUI: Trying to get ammo type from current weapon in menu. Need help with code.



  • I'm passing the current weapon to the function provided below. If I use the SET_PED_AMMO Func it works perfectly however I'm trying to get ammo for FMJ rounds or etc. for each weapon. The text in bold is what i'm having trouble with. Any help would be great.

    internal static void FillAmmo(WeaponHash weapon)
    {
    bool hasPedGotWeapon = Function.Call<bool>(Hash.HAS_PED_GOT_WEAPON, Game.Player.Character, (int)weapon, false);
    Ped Player = Game.Player.Character;

        if (!hasPedGotWeapon)
        {
            MainMenu.DisplayMessage("You do not have this Weapon Equiped");
        }
        else
        {
            **//Get Ammo Type from current weapon in menu
            Hash ammoType = Function.Call<Hash>(Hash._GET_PED_AMMO_TYPE, Player, (int)weapon);
            //Set ped ammo to 9999 by type 'FMJ or etc'
            Function.Call(Hash.SET_PED_AMMO_BY_TYPE, Player, (int)ammoType, 9999);**
        }
    }

Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.