private void addWeaponBullets(int weaponId, string bulletType, int cuantity) { if (vorp_inventoryClient.userWeapons.ContainsKey(weaponId)) { vorp_inventoryClient.userWeapons[weaponId].addAmmo(cuantity, bulletType); if (vorp_inventoryClient.userWeapons[weaponId].getUsed()) { API.SetPedAmmoByType(API.PlayerPedId(), API.GetHashKey(bulletType), vorp_inventoryClient.userWeapons[weaponId].getAmmo(bulletType)); } } NUIEvents.LoadInv(); }
private void subItem(string name, int cuantity) { Debug.WriteLine($"Me llaman con cantidad a poner = {cuantity}"); if (vorp_inventoryClient.useritems.ContainsKey(name)) { vorp_inventoryClient.useritems[name].setCount(cuantity); if (vorp_inventoryClient.useritems[name].getCount() == 0) { vorp_inventoryClient.useritems.Remove(name); } } NUIEvents.LoadInv(); }
private void addItem(int count, int limit, string label, string name, string type, bool usable, bool canRemove) { if (vorp_inventoryClient.useritems.ContainsKey(name)) { vorp_inventoryClient.useritems[name].addCount(count); } else { ItemClass auxitem = new ItemClass(count, limit, label, name, type, usable, canRemove); vorp_inventoryClient.useritems.Add(name, auxitem); } NUIEvents.LoadInv(); }
private void subWeapon(int weaponId) { if (vorp_inventoryClient.userWeapons.ContainsKey(weaponId)) { if (vorp_inventoryClient.userWeapons[weaponId].getUsed()) { API.RemoveWeaponFromPed(API.PlayerPedId(), (uint)API.GetHashKey(vorp_inventoryClient.userWeapons[weaponId].getName()), true, 0); //Falta revisar que pasa con esto } vorp_inventoryClient.userWeapons.Remove(weaponId); } NUIEvents.LoadInv(); }
}//Update weapon ammo private void receiveItem(string name, int count) { if (useritems.ContainsKey(name)) { useritems[name].addCount(count); } else { useritems.Add(name, new ItemClass(count, citems[name]["limit"], citems[name]["label"], name, "item_standard", true, citems[name]["can_remove"])); } NUIEvents.LoadInv(); }
}//Update weapon ammo private void receiveItem(string name, int count) { if (useritems.ContainsKey(name)) { useritems[name].addCount(count); TriggerEvent("vorp:TipRight", "Hai ricevuto " + count.ToString() + " di " + citems[name]["label"], 4000); } else { useritems.Add(name, new ItemClass(count, citems[name]["limit"], citems[name]["label"], name, "item_standard", true, citems[name]["can_remove"])); TriggerEvent("vorp:TipRight", "Hai ricevuto " + count.ToString() + " di " + citems[name]["label"], 4000); } NUIEvents.LoadInv(); }
private void receiveWeapon(int id, string propietary, string name, ExpandoObject ammo, List<dynamic> components) { Dictionary<string, int> ammoaux = new Dictionary<string, int>(); foreach (KeyValuePair<string, object> amo in ammo) { ammoaux.Add(amo.Key, int.Parse(amo.Value.ToString())); } List<string> auxcomponents = new List<string>(); foreach (var comp in components) { auxcomponents.Add(comp.ToString()); } WeaponClass weapon = new WeaponClass(id, propietary, name, ammoaux, auxcomponents, false,false); if (!userWeapons.ContainsKey(weapon.getId())) { userWeapons.Add(weapon.getId(), weapon); } NUIEvents.LoadInv(); }