public void Depanner(Client player, String id) { int idveh = Int32.Parse(id); VehiculeInfo objveh = VehiculeInfo.GetVehicleInfoById(idveh); if (player.position.DistanceTo(objveh.handle.position) > 2) { API.sendChatMessageToPlayer(player, Constante.TuEsTropLoin); } else if (Inventaire.GetItemNumberInBDD(player, 4) <= 0) { API.sendChatMessageToPlayer(player, "Tu n'as pas de kit d'outils pour dépanner ton véhicule."); } else { if (API.getVehicleHealth(objveh.handle) >= 600) { API.sendChatMessageToPlayer(player, "Tu dois emmener ton véhicule au garage pour le réparer complètement."); } else { API.setVehicleHealth(objveh.handle, 600); API.sendChatMessageToPlayer(player, "Tu viens de dépanner ton véhicule, emmène le au garage si tu veux le réparer complètement."); Inventaire.RemoveItemToPlayerInventaire(player, 4, 1); } } }
public void Delier(Client player, String idOrName) { PlayerInfo target = PlayerInfo.GetPlayerInfotByIdOrName(idOrName); if (player.position.DistanceTo(API.getEntityPosition(target.Handle)) >= 2) { API.sendChatMessageToPlayer(player, Constante.TuEsTropLoin); return; } else if (target.IsMenotter == false) { API.sendChatMessageToPlayer(player, "Cette personne ~r~n'est pas ~s~menottée."); return; } else { if (Inventaire.PlayerHaveItemInBDD(player, 15)) { API.sendChatMessageToPlayer(player, "Tu viens de ~g~démenotter ~s~cette personne avec ta pince."); API.sendChatMessageToPlayer(target.Handle, "Tu viens d'être ~g~démenotté ~s~."); target.IsMenotter = false; API.setPlayerClothes(target.Handle, 7, 0, 0); API.stopPlayerAnimation(target.Handle); } else { API.sendChatMessageToPlayer(player, "Tu n'as rien pour briser les menottes."); } } }
public void AssemblerArme(Client player, int Nombre) { if (Nombre == 0 || Nombre >= 5) { API.sendChatMessageToPlayer(player, "Tu dois entrer un nombre valide! (1 = Pistolet, 2 = P-Mitrailleur, 3 = Pompe, 4 = fusil)"); } else { if (Nombre == 1) { if (Inventaire.GetItemNumberInBDD(player, 16) <= 0) { API.sendChatMessageToPlayer(player, Constante.PasDeKit); } else { API.triggerClientEvent(player, "KitPistolet"); } } if (Nombre == 2) { if (Inventaire.GetItemNumberInBDD(player, 17) <= 0) { API.sendChatMessageToPlayer(player, Constante.PasDeKit); } else { API.triggerClientEvent(player, "KitPMitr"); } } if (Nombre == 3) { if (Inventaire.GetItemNumberInBDD(player, 18) <= 0) { API.sendChatMessageToPlayer(player, Constante.PasDeKit); } else { API.triggerClientEvent(player, "KitPompe"); } } if (Nombre == 4) { if (Inventaire.GetItemNumberInBDD(player, 19) <= 0) { API.sendChatMessageToPlayer(player, Constante.PasDeKit); } else { API.triggerClientEvent(player, "KitFusil"); } } } }
public void TrafiquerArmes(Client player) { if (API.getPlayerCurrentWeapon(player) == WeaponHash.Musket && (Inventaire.PlayerHaveItemInBDD(player, 5))) { if (API.getPlayerWeaponAmmo(player, WeaponHash.Musket) > 6) { API.delay(4000, true, () => { API.removePlayerWeapon(player, WeaponHash.Musket); API.givePlayerWeapon(player, WeaponHash.DoubleBarrelShotgun, 6, true, true); API.sendChatMessageToPlayer(player, "Tu viens de trafiquer ton arme."); Random aleatoire = new Random(); int resultat = aleatoire.Next(0, 10); if (resultat >= 8) { API.sendChatMessageToPlayer(player, "Ta scie s'est cassé en trafiquant ton arme."); Inventaire.RemoveItemToPlayerInventaire(player, 5, 1); } else { return; } }); } else { API.delay(4000, true, () => { API.removePlayerWeapon(player, WeaponHash.Musket); API.givePlayerWeapon(player, WeaponHash.DoubleBarrelShotgun, 2, true, true); API.sendChatMessageToPlayer(player, "Tu viens de trafiquer ton arme."); }); } } else { API.sendChatMessageToPlayer(player, "~r~Tu n'as pas le nécessaire pour trafiquer ton arme ou elle ne peut pas être trafiquée."); } }
public void ClientEvent(Client player, PlayerInfo objplayer, string eventName) { switch (eventName) { #region Bouton E case "Bouton.E": //Entrée Auto-Ecole if (!player.isInVehicle && player.position.DistanceTo(Constante.Pos_EntrerAutoEcole) < 2) { API.setEntityPosition(player, Constante.Pos_SortieAutoEcole); return; } if (!player.isInVehicle && player.position.DistanceTo(Constante.Pos_EntrerPrison) < 4 && objplayer.factionid == Constante.Faction_Gardien) { API.setEntityPosition(player, Constante.Pos_SortiePrison); objplayer.IsFactionDuty = true; API.sendChatMessageToPlayer(player, "~#d2d628~", "Tu viens de prendre ton service."); if (objplayer.sexe == 0) { API.setPlayerClothes(player, 3, 0, 0); API.setPlayerClothes(player, 4, 35, 0); API.setPlayerClothes(player, 5, 0, 0); API.setPlayerClothes(player, 6, 25, 0); API.setPlayerClothes(player, 7, 0, 0); API.setPlayerClothes(player, 8, 58, 0); API.setPlayerClothes(player, 11, 55, 0); } else { API.setPlayerClothes(player, 3, 14, 0); API.setPlayerClothes(player, 4, 34, 0); API.setPlayerClothes(player, 5, 0, 0); API.setPlayerClothes(player, 6, 25, 0); API.setPlayerClothes(player, 7, 0, 0); API.setPlayerClothes(player, 8, 35, 0); API.setPlayerClothes(player, 11, 48, 0); } API.givePlayerWeapon(player, WeaponHash.Flashlight, 1, true, true); API.givePlayerWeapon(player, WeaponHash.StunGun, 1, true, true); API.givePlayerWeapon(player, WeaponHash.Nightstick, 1, true, true); return; } if (!player.isInVehicle && player.position.DistanceTo(Constante.Pos_SortiePrison) < 4 && objplayer.factionid == Constante.Faction_Gardien) { API.setEntityPosition(player, Constante.Pos_EntrerPrison); objplayer.IsFactionDuty = false; API.removeAllPlayerWeapons(player); objplayer.armure = 0; API.sendChatMessageToPlayer(player, "~#d2d628~", "Tu viens de terminer ton service."); API.call("Connexion", "LoadVetements", player); API.call("Connexion", "LoadAccessoires", player); return; } //Sortie Auto-Ecole if (!player.isInVehicle && player.position.DistanceTo(Constante.Pos_SortieAutoEcole) < 2) { API.setEntityPosition(player, Constante.Pos_EntrerAutoEcole); return; } //Job eboueur if (!player.isInVehicle && player.position.DistanceTo(Constante.Pos_ServiceEboueur) < 2) { if (objplayer.jobid == Constante.Job_Eboueur) { if (objplayer.IsJobDuty == false) { API.setPlayerClothes(player, 3, 119, 0); API.setPlayerClothes(player, 4, 36, 0); API.setPlayerClothes(player, 6, 51, 0); API.setPlayerClothes(player, 8, 59, 0); API.setPlayerClothes(player, 11, 57, 0); objplayer.IsJobDuty = true; } else { objplayer.IsJobDuty = false; if (objplayer.pendingpaye > 0) { API.sendChatMessageToPlayer(player, "Merci pour ton travail, tu reçevra ton argent sur ta prochaine paye!"); } Connexion lv = new Connexion(); lv.LoadVetements(player); lv.LoadAccessoires(player); return; } } else { API.sendChatMessageToPlayer(player, "~r~Tu ne fais pas partie ~s~de ce job, fais toi d'abord recruter. ~m~(/rejoindreeboueur)"); } } //Menu Auto-Ecole if (!player.isInVehicle && player.position.DistanceTo(new Vector3(-139.1808, -631.9503, 168.8204)) < 2) { API.triggerClientEvent(player, "MenuAutoEcole"); return; } //Menu Armurerie if (police.isArmurerieLSPD(player)) { if (!Fonction.IsPlayerInFaction(objplayer, "Police", true)) { return; } if (objplayer.IsFactionDuty == true) { API.triggerClientEvent(player, "MenuArmurerieLSPD"); } else { API.sendChatMessageToPlayer(player, Constante.PasEnService); } return; } //menu cellule if (police.isCellule(player)) { if (!Fonction.IsPlayerInFaction(objplayer, "Police", true)) { return; } if (objplayer.IsFactionDuty == true) { API.triggerClientEvent(player, "MenuCelluleLSPD"); } else { API.sendChatMessageToPlayer(player, Constante.PasEnService); } return; } //Menu Distrib if (police.isDistrib(player)) { API.triggerClientEvent(player, "MenuDistrib"); return; } //Menu Service if (police.isService(player)) { if (Fonction.IsPlayerInFaction(objplayer, "Police", true)) { API.triggerClientEvent(player, "MenuService"); } return; } //Menu Armurerie civile if (Fonction.isArmurerieCivil(player)) { API.triggerClientEvent(player, "MenuArmurerieCivil"); return; } //Menu ATM if (ATMInfo.GetATMInfoClosePos(player.position, 2) != null) { if (Fonction.IsPlayerInFaction(objplayer, "Gardien", false) && objplayer.IsJobDuty == true) { objplayer.sacbanque = false; API.setPlayerClothes(player, 5, 0, 0); } else { API.triggerClientEvent(player, "showATM"); objplayer.IdATM = ATMInfo.GetATMInfoClosePos(player.position, 2).ID; API.setEntitySyncedData(player, "SoldeCompte", objplayer.bank); } return; } //Menu Banque if (BanqueInfo.GetBanqueInfoClosePos(player.position, 1) != null) { API.triggerClientEvent(player, "MenuBanque"); objplayer.IdBanque = BanqueInfo.GetBanqueInfoClosePos(player.position, 1).ID; return; } //Menu Magasin if (Magasin.isMagasin(player)) { API.triggerClientEvent(player, "MenuMagasin"); return; } //Menu Revendeur if (Magasin.isRevendeur(player)) { API.triggerClientEvent(player, "MenuRevendeur"); return; } //Menu Logement if (Logement.IsLogement(player)) { if (Logement.HasProprietaire(player, Logement.GetLogementIDProche(player))) { if (Logement.PlayerHaveKeyHouse(player, Logement.GetLogementIDProche(player))) { API.triggerClientEvent(player, "MenuMaisonAchetéeProprio"); } else { API.triggerClientEvent(player, "MenuMaisonAchetéeNonProprio"); } } else { API.triggerClientEvent(player, "MenuMaisonAVendre"); } return; } //Entrée Planque if (CommandesFaction.IsEntreePlanque(player) && objplayer.dimension == 0) { System.Data.DataTable result = API.shared.exported.database.executeQueryWithResult("SELECT * FROM PlanqueFaction"); if (result.Rows.Count != 0) { foreach (System.Data.DataRow row in result.Rows) { String nominte = Convert.ToString(row["nominte"]); int PorteOuverture = Convert.ToInt32(row["locked"]); if (PorteOuverture == 1) { API.shared.sendNotificationToPlayer(player, "La porte est fermée."); } else { if (nominte == "InteArmes") { API.shared.setEntityPosition(player, CommandesFaction.InteArmes); objplayer.IsOnInt = true; objplayer.IsOnPlanqueArmes = true; API.shared.setEntityDimension(player, Convert.ToInt32(row["ID"])); objplayer.dimension = Convert.ToInt32(row["ID"]); return; } if (nominte == "InteDrogues") { //API.shared.setEntityPosition(player, InteDrogues); API.shared.sendChatMessageToPlayer(player, "En maintenance."); objplayer.IsOnInt = true; objplayer.IsOnPlanqueArmes = true; API.shared.setEntityDimension(player, Convert.ToInt32(row["ID"])); objplayer.dimension = Convert.ToInt32(row["ID"]); return; } } } } } //Sortie Planque if (CommandesFaction.IsSortiePlanque(player) && objplayer.dimension != 0) { System.Data.DataTable result = API.shared.exported.database.executeQueryWithResult("SELECT * FROM PlanqueFaction"); if (result.Rows.Count != 0) { foreach (System.Data.DataRow row in result.Rows) { objplayer.IsOnInt = false; API.shared.setEntityDimension(player, 0); objplayer.dimension = 0; Vector3 logpos = new Vector3(float.Parse(String.Format("" + row["PosX"])), float.Parse(String.Format("" + row["PosY"])), float.Parse(String.Format("" + row["PosZ"]))); API.shared.setEntityPosition(player, logpos); objplayer.IsOnPlanqueArmes = false; return; } } } //Menu hackeur if (Hackeur.isRepairePNJ(player)) { API.triggerClientEvent(player, "MenuPNJHackeur"); return; } if (API.getEntityData(player, "OrdiHack") == true) { API.triggerClientEvent(player, "MenuHackeur"); return; } if (Hackeur.isRepaireDehors(player)) { API.setEntityPosition(player, new Vector3(1274.184, -1719.719, 54.77145)); return; } if (Hackeur.isRepaireDedans(player)) { API.setEntityPosition(player, new Vector3(882.7369, -1052.517, 33.00666)); return; } //menu exte veh if (!player.isInVehicle) { VehiculeInfo objveh = VehiculeInfo.GetVehicleArroundPlayer(player); if (objveh != null) { API.triggerClientEvent(player, "MenuExteVeh"); } return; } //menu veh eboueur if (player.position.DistanceTo(Constante.Pos_CamionEboueur) < 2) { if (objplayer.jobid == Constante.Job_Eboueur) { if (objplayer.IsJobDuty == true) { API.triggerClientEvent(player, "MenuVehEboueur"); } else { API.sendChatMessageToPlayer(player, "Tu n'es pas en service."); } } else { API.sendChatMessageToPlayer(player, "Tu n'es pas éboueur."); } return; } break; #endregion #region Bouton F1 case "Bouton.F1": //menu inte veh if (player.isInVehicle == true) { if (player.isInVehicle == true) { API.triggerClientEvent(player, "MenuInteVeh"); } return; } break; #endregion #region Bouton F2 case "Bouton.F2": //menu Unite LSPD if (objplayer.factionid == Constante.Faction_Police && UnitesLSPDInfo.GetUniteLSPDInfoByMembre(player) != null) { API.triggerClientEvent(player, "MenuUniteLSPD"); return; } break; #endregion #region Bouton R case "Bouton.R": //event rechargement if (Inventaire.GetItemNumberInBDD(player, 11) != 0) { API.triggerClientEvent(player, "RechargementPistol"); } if (Inventaire.GetItemNumberInBDD(player, 12) != 0) { API.triggerClientEvent(player, "RechargementSMG"); } if (Inventaire.GetItemNumberInBDD(player, 13) != 0) { API.triggerClientEvent(player, "RechargementRifle"); } if (Inventaire.GetItemNumberInBDD(player, 14) != 0) { API.triggerClientEvent(player, "RechargementPompe"); } break; #endregion } }
public void Accepter(Client player, String option, String idOrName) { PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player); PlayerInfo target = PlayerInfo.GetPlayerInfotByIdOrName(idOrName); if (option == "arme") { if (player.position.DistanceTo(target.Handle.position) >= 2) { API.sendChatMessageToPlayer(player, Constante.TuEsTropLoin); } else { if (API.getEntityData(player, "PrixArme") <= 0) { API.sendChatMessageToPlayer(player, "Personne ne t'a proposé d'arme."); } else { if (API.getEntityData(player, "ArmeActuelle") == 0) { API.sendChatMessageToPlayer(player, "Personne ne t'a proposé d'arme."); } else { API.sendChatMessageToPlayer(player, "Tu viens d'acheter cette arme pour~g~ " + API.getEntityData(player, "PrixArme") + "~s~$."); API.sendChatMessageToPlayer(target.Handle, "Tu viens de vendre une arme pour~g~ " + API.getEntityData(player, "PrixArme") + "~s~$."); API.givePlayerWeapon(player, API.getEntityData(player, "ArmeActuelle"), API.getEntityData(player, "MunitionsActuelle"), true, true); API.removePlayerWeapon(target.Handle, API.getEntityData(target.Handle, "ArmeActuelle")); var anciennemoney = objplayer.money; var anciennemoneyvendeur = target.money; objplayer.money = anciennemoney - API.getEntityData(player, "PrixArme"); target.money = anciennemoneyvendeur + API.getEntityData(player, "PrixArme"); API.setEntityData(player, "PrixArme", 0); API.setEntityData(player, "ArmeActuelle", 0); API.setEntityData(target.Handle, "ArmeActuelle", 0); API.setEntityData(player, "MunitionsActuelle", 0); } } } } if (option == "kit") { if (player.position.DistanceTo(target.Handle.position) >= 2) { API.sendChatMessageToPlayer(player, Constante.TuEsTropLoin); } else { if (API.getEntityData(player, "TypeKit") <= 0) { API.sendChatMessageToPlayer(player, "Personne ne t'a proposé de kit."); } else { if (API.getEntityData(player, "QuantitéKit") == 0) { API.sendChatMessageToPlayer(player, "Personne ne t'a proposé de kit."); } else { API.sendChatMessageToPlayer(player, "Tu viens d'acheter~b~ " + API.getEntityData(player, "QuantitéKit") + " ~s~kit pour~g~ " + API.getEntityData(player, "PrixKit") + "~s~$."); API.sendChatMessageToPlayer(target.Handle, "Tu viens de vendre~b~" + API.getEntityData(player, "QuantitéKit") + " ~s~kit pour~g~ " + API.getEntityData(player, "PrixKit") + "~s~$."); if (API.getEntityData(player, "TypeKit") == 1) { int Item = Inventaire.KitPistolet; Inventaire saveitem = new Inventaire(); saveitem.AddItemToPlayerInventaire(player, Item, API.getEntityData(player, "QuantitéKit")); Inventaire.RemoveItemToPlayerInventaire(target.Handle, Item, API.getEntityData(player, "QuantitéKit")); } if (API.getEntityData(player, "TypeKit") == 2) { int Item = Inventaire.KitPMitrailleur; Inventaire saveitem = new Inventaire(); saveitem.AddItemToPlayerInventaire(player, Item, API.getEntityData(player, "QuantitéKit")); Inventaire.RemoveItemToPlayerInventaire(target.Handle, Item, API.getEntityData(player, "QuantitéKit")); } if (API.getEntityData(player, "TypeKit") == 3) { int Item = Inventaire.KitPompe; Inventaire saveitem = new Inventaire(); saveitem.AddItemToPlayerInventaire(player, Item, API.getEntityData(player, "QuantitéKit")); Inventaire.RemoveItemToPlayerInventaire(target.Handle, Item, API.getEntityData(player, "QuantitéKit")); } if (API.getEntityData(player, "TypeKit") == 4) { int Item = Inventaire.KitFusil; Inventaire saveitem = new Inventaire(); saveitem.AddItemToPlayerInventaire(player, Item, API.getEntityData(player, "QuantitéKit")); Inventaire.RemoveItemToPlayerInventaire(target.Handle, Item, API.getEntityData(player, "QuantitéKit")); } var anciennemoney = objplayer.money; var anciennemoneyvendeur = target.money; objplayer.money = anciennemoney - API.getEntityData(player, "PrixKit"); target.money = anciennemoneyvendeur + API.getEntityData(player, "PrixKit"); API.setEntityData(target.Handle, "TypeKit", 0); API.setEntityData(target.Handle, "PrixKit", 0); API.setEntityData(target.Handle, "QuantitéKit", 0); } } } } }
public void Ordi(Client player, String option) { if (option == "allumer") { if (API.getEntityData(player, "OrdiHack") == false) { if (Inventaire.PlayerHaveItemInBDD(player, 6) & (Inventaire.PlayerHaveItemInBDD(player, 10))) { API.setEntityData(player, "OrdiHack", true); API.sendChatMessageToPlayer(player, "Tu viens d'~g~allumer ~s~ton ordinateur, appuie sur '~b~E~s~' pour l'utiliser."); } else { API.sendChatMessageToPlayer(player, "~r~Tu ne peux pas utiliser ton ordinateur sans le routeur."); } } else { API.sendChatMessageToPlayer(player, "Ton ordinateur est déjà allumé."); } } if (option == "eteindre") { if (API.getEntityData(player, "OrdiHack") == true) { if (Inventaire.PlayerHaveItemInBDD(player, 6) & (Inventaire.PlayerHaveItemInBDD(player, 10))) { API.setEntityData(player, "OrdiHack", false); API.sendChatMessageToPlayer(player, "Tu viens d'~r~éteindre ~s~ton ordinateur."); } else { return; } } else { API.sendChatMessageToPlayer(player, "Ton ordinateur est déjà éteint."); } } if (option == "puce") { if (!Inventaire.PlayerHaveItemInBDD(player, 7) && (!Inventaire.PlayerHaveItemInBDD(player, 8))) { API.sendChatMessageToPlayer(player, "~r~Trouves le matériel nécessaire pour faire ça."); } else if (!Inventaire.PlayerHaveItemInBDD(player, 8) || Inventaire.GetItemNumberInBDD(player, 8) < 1) { API.sendChatMessageToPlayer(player, "~r~Il te manque la puce pour faire fonctionner ton routeur."); } else if (!Inventaire.PlayerHaveItemInBDD(player, 7)) { API.sendChatMessageToPlayer(player, "~r~Tu n'as pas de routeur."); } else { int Item = Inventaire.RouteurPuce; Inventaire saveitem = new Inventaire(); saveitem.AddItemToPlayerInventaire(player, Item, 1); API.sendChatMessageToPlayer(player, "Tu as placer la puce dans ton routeur."); Inventaire.RemoveItemToPlayerInventaire(player, 7, 1); Inventaire.RemoveItemToPlayerInventaire(player, 8, 1); } } }
public void VendreKit(Client player, String idOrName, int Nombre, int Qtt, int Prix) { PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player); PlayerInfo target = PlayerInfo.GetPlayerInfotByIdOrName(idOrName); if (objplayer.factionid == 0) { API.sendChatMessageToPlayer(player, Constante.PasDeFact); } else { if (player.position.DistanceTo(target.Handle.position) >= 2) { API.sendChatMessageToPlayer(player, Constante.TuEsTropLoin); } else { if (Nombre == 0 || Nombre >= 5) { API.sendChatMessageToPlayer(player, "Tu dois entrer un nombre valide! (1 = Pistolet, 2 = P-Mitrailleur, 3 = Pompe, 4 = fusil)"); } else { if (Qtt == 0) { API.sendChatMessageToPlayer(player, "Tu dois entrer une quantité valide!"); } else { if (Nombre == 1) { if (Inventaire.GetItemNumberInBDD(player, 16) <= 0) { API.sendChatMessageToPlayer(player, "Tu n'as pas de kit à vendre."); } else { API.sendChatMessageToPlayer(player, "Tu proposes à cette personne~b~ " + Qtt + " ~b~kit de pistolet~s~ pour~g~ " + Prix + "~s~$."); API.sendChatMessageToPlayer(target.Handle, "Cette personne te propose~b~ " + Qtt + " ~b~kit de pistolet~s~ pour~g~ " + Prix + "~s~$."); API.sendChatMessageToPlayer(target.Handle, "(Tapes ~b~/accepter kit~s~ pour accepter l'offre.)"); API.setEntityData(target.Handle, "TypeKit", 1); API.setEntityData(target.Handle, "PrixKit", Prix); API.setEntityData(target.Handle, "QuantitéKit", Qtt); } } if (Nombre == 2) { if (Inventaire.GetItemNumberInBDD(player, 17) <= 0) { API.sendChatMessageToPlayer(player, "Tu n'as pas de kit à vendre."); } else { API.sendChatMessageToPlayer(player, "Tu proposes à cette personne~b~ " + Qtt + " ~b~kit de pistolet-mitrailleur~s~ pour~g~ " + Prix + "~s~$."); API.sendChatMessageToPlayer(target.Handle, "Cette personne te propose~b~ " + Qtt + " ~b~kit de pistolet-mitrailleur~s~ pour~g~ " + Prix + "~s~$."); API.sendChatMessageToPlayer(target.Handle, "(Tapes ~b~/accepter kit~s~ pour accepter l'offre.)"); API.setEntityData(target.Handle, "TypeKit", 2); API.setEntityData(target.Handle, "PrixKit", Prix); API.setEntityData(target.Handle, "QuantitéKit", Qtt); } } if (Nombre == 3) { if (Inventaire.GetItemNumberInBDD(player, 18) <= 0) { API.sendChatMessageToPlayer(player, "Tu n'as pas de kit à vendre."); } else { API.sendChatMessageToPlayer(player, "Tu proposes à cette personne~b~ " + Qtt + " ~b~kit de fusil à pompe~s~ pour~g~ " + Prix + "~s~$."); API.sendChatMessageToPlayer(target.Handle, "Cette personne te propose~b~ " + Qtt + " ~b~kit de fusil à pompe~s~ pour~g~ " + Prix + "~s~$."); API.sendChatMessageToPlayer(target.Handle, "(Tapes ~b~/accepter kit~s~ pour accepter l'offre.)"); API.setEntityData(target.Handle, "TypeKit", 3); API.setEntityData(target.Handle, "PrixKit", Prix); API.setEntityData(target.Handle, "QuantitéKit", Qtt); } } if (Nombre == 4) { if (Inventaire.GetItemNumberInBDD(player, 19) <= 0) { API.sendChatMessageToPlayer(player, "Tu n'as pas de kit à vendre."); } else { API.sendChatMessageToPlayer(player, "Tu proposes à cette personne~b~ " + Qtt + " ~b~kit de fusil d'assaut~s~ pour~g~ " + Prix + "~s~$."); API.sendChatMessageToPlayer(target.Handle, "Cette personne te propose~b~ " + Qtt + " ~b~kit de fusil d'assaut~s~ pour~g~ " + Prix + "~s~$."); API.sendChatMessageToPlayer(target.Handle, "(Tapes ~b~/accepter kit~s~ pour accepter l'offre.)"); API.setEntityData(target.Handle, "TypeKit", 4); API.setEntityData(target.Handle, "PrixKit", Prix); API.setEntityData(target.Handle, "QuantitéKit", Qtt); } } } } } } }
public void KitArme(Client player, int Nombre, int Qtt) { PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player); DataTable result = API.shared.exported.database.executeQueryWithResult("SELECT * FROM PlanqueFaction WHERE factionid = '" + objplayer.factionid + "'"); if (result.Rows.Count != 0) { foreach (DataRow row in result.Rows) { if (objplayer.IsOnPlanqueArmes == false) { API.sendChatMessageToPlayer(player, "Tu ne peux pas trouver de kit d'armes ici."); } else { int KitPistoletFournisseur = Convert.ToInt32(row["kitpisto"]); int KitPMitrFournisseur = Convert.ToInt32(row["kitpmitr"]); int KitPompeFournisseur = Convert.ToInt32(row["kitpompe"]); int KitFusilFournisseur = Convert.ToInt32(row["kitfusil"]); if (Nombre == 0 || Nombre >= 5) { API.sendChatMessageToPlayer(player, "Tu dois entrer un nombre valide! (1 = Pistolet, 2 = P-Mitrailleur, 3 = Pompe, 4 = fusil)"); } if (Qtt == 0) { API.sendChatMessageToPlayer(player, "Tu dois entrer une quantité valide!"); } else { if (Nombre == 1) { if (Qtt > KitPistoletFournisseur) { API.sendChatMessageToPlayer(player, "Il n'y a pas autant de kit dans la planque."); } else { API.sendChatMessageToPlayer(player, "Tu viens de retirer~g~ " + Qtt + " ~s~kit pistolet de la planque."); int Item = Inventaire.KitPistolet; Inventaire saveitem = new Inventaire(); saveitem.AddItemToPlayerInventaire(player, Item, Qtt); int NouveauNombre = KitPistoletFournisseur - Qtt; API.shared.exported.database.executeQuery("UPDATE PlanqueFaction SET kitpisto ='" + NouveauNombre + "' WHERE factionid = '" + objplayer.factionid + "'"); return; } } if (Nombre == 2) { if (Qtt > KitPMitrFournisseur) { API.sendChatMessageToPlayer(player, "Il n'y a pas autant de kit dans la planque."); } else { API.sendChatMessageToPlayer(player, "Tu viens de retirer~g~ " + Qtt + " ~s~kit pistolet-mitrailleur de la planque."); int Item = Inventaire.KitPMitrailleur; Inventaire saveitem = new Inventaire(); saveitem.AddItemToPlayerInventaire(player, Item, Qtt); int NouveauNombrePM = KitPMitrFournisseur - Qtt; API.shared.exported.database.executeQuery("UPDATE PlanqueFaction SET locked ='" + NouveauNombrePM + "' WHERE factionid = '" + objplayer.factionid + "'"); return; } } if (Nombre == 3) { if (Qtt > KitPompeFournisseur) { API.sendChatMessageToPlayer(player, "Il n'y a pas autant de kit dans la planque."); } else { API.sendChatMessageToPlayer(player, "Tu viens de retirer~g~ " + Qtt + " ~s~kit fusil à pompe de la planque."); int Item = Inventaire.KitPompe; Inventaire saveitem = new Inventaire(); saveitem.AddItemToPlayerInventaire(player, Item, Qtt); int NouveauNombrePompe = KitPompeFournisseur - Qtt; API.shared.exported.database.executeQuery("UPDATE PlanqueFaction SET locked ='" + NouveauNombrePompe + "' WHERE factionid = '" + objplayer.factionid + "'"); return; } } if (Nombre == 4) { if (Qtt > KitFusilFournisseur) { API.sendChatMessageToPlayer(player, "Il n'y a pas autant de kit dans la planque."); } else { API.sendChatMessageToPlayer(player, "Tu viens de retirer~g~ " + Qtt + " ~s~kit fusil d'assaut de la planque."); int Item = Inventaire.KitFusil; Inventaire saveitem = new Inventaire(); saveitem.AddItemToPlayerInventaire(player, Item, Qtt); int NouveauNombreFusil = KitFusilFournisseur - Qtt; API.shared.exported.database.executeQuery("UPDATE PlanqueFaction SET locked ='" + NouveauNombreFusil + "' WHERE factionid = '" + objplayer.factionid + "'"); return; } } } } } } }