public static WeaponJson FromJson(string json) { Debug.Log("Loading weapons loadout from json..."); WeaponJson weaponJson = JsonConvert.DeserializeObject <WeaponJson>(json); return(weaponJson); }
public void SetWeapons(Ped ped) { _ped = ped; Weapon current = Game.Player.Character.Weapons.Current; foreach (WeaponHash weapon in (WeaponHash[])Enum.GetValues(typeof(WeaponHash))) { if (_ped.Weapons.HasWeapon(weapon)) { _ped.Weapons.Select(weapon, false); //int ammoType = Helpers.GetAmmoTypeFromPedWeapon(_ped, weapon); int ammo = _ped.Weapons.Current.Ammo; WeaponJson weaponJson = new WeaponJson { hash = weapon, ammo = ammo, }; ownedWeapons.Add(weaponJson); } } _ped.Weapons.Select(current, false); }