public static void AddItem(int itemtype, CoffreInfo coffreid, int nombre, int data1 = 0, int data2 = 0, int data3 = 0, bool updatable = true) { ItemInfo moneys = ItemExiste(itemtype, coffreid); if (moneys != null) { if (moneys.Updatable) { moneys.Nombre += nombre; moneys.Data1 += data1; moneys.Data2 += data2; moneys.Data3 += data3; string requete = "UPDATE Item SETnombre={moneys.Nombre}, data1={moneys.Data1}, data2={moneys.Data2}, data3={moneys.Data3} WHERE id={moneys.Id};"; API.shared.exported.database.executeQuery(requete); return; } else { new ItemInfo(coffreid.Id, itemtype, nombre, data1, data2, data3, updatable); return; } } else { new ItemInfo(coffreid.Id, itemtype, nombre, data1, data2, data3, updatable); } return; }
public static void RemoveItem(int itemtype, CoffreInfo coffreid, int nombre, int data1 = 0, int data2 = 0, int data3 = 0, bool updatable = true) { ItemInfo moneys = ItemExiste(itemtype, coffreid); if (moneys != null) { if (moneys.Updatable) { moneys.Nombre -= nombre; moneys.Data1 -= data1; moneys.Data2 -= data2; moneys.Data3 -= data3; string requete = "UPDATE Item SETnombre={moneys.Nombre}, data1={moneys.Data1}, data2={moneys.Data2}, data3={moneys.Data3} WHERE id={moneys.Id};"; API.shared.exported.database.executeQuery(requete); return; } else { CoffreInfo.ItemInfoList.Remove(moneys); API.shared.exported.database.executeQuery("DELETE FROM Item WHERE id=" + moneys.Id + ""); return; } } return; }
public static void DeleteItemInCoffre(CoffreInfo coffreid) { foreach (ItemInfo item in CoffreInfo.ItemInfoList) { if (item.IdCoffre != coffreid.Id) { continue; } CoffreInfo.ItemInfoList.Remove(item); } API.shared.exported.database.executeQuery("DELETE FROM Item WHERE coffreid=" + coffreid.Id + ""); return; }
public static ItemInfo ItemExiste(int itemtype, CoffreInfo coffreid) { foreach (ItemInfo item in CoffreInfo.ItemInfoList) { if (item.IdCoffre != coffreid.Id) { continue; } if (item.Type != itemtype) { continue; } return(item); } return(null); }
public VehiculeInfo(VehicleHash model, Vector3 pos, Vector3 rot, int color1, int color2, string plaque, int dimension = 0) { Vehicle vehicule = API.shared.createVehicle(model, pos, rot, color1, color2, dimension); API.shared.sleep(100); this.handle = vehicule; VehiculeList.Add(this); this.ID = VehiculeList.IndexOf(this); this.label = API.shared.createTextLabel("", API.shared.getEntityPosition(vehicule), 50f, 0.4f, true); API.shared.attachEntityToEntity(this.label, vehicule, null, new Vector3(0, 0, 1f), new Vector3()); this.pos = pos; this.rot = rot; this.color1 = color1; this.color2 = color2; this.model = model; this.coffre = null; API.shared.setVehicleNumberPlate(this.handle, plaque); }
public static void ShowCoffre(CoffreInfo coffre, Client player) { API.shared.triggerClientEvent(player, "ShowCoffre"); }
public void DeleteCoffre(CoffreInfo coffre) { //Delete les items }