public void Invite(Client player, String idOrName) { PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player); PlayerInfo target = PlayerInfo.GetPlayerInfotByIdOrName(idOrName); if (objplayer.factionid != 0) { if (objplayer.rangfaction <= 4) { API.sendChatMessageToPlayer(player, Constante.PasLeader); } else { if (player.position.DistanceTo(target.Handle.position) >= 2) { API.sendChatMessageToPlayer(player, Constante.TuEsTropLoin); } else if (target.factionid != 0) { API.sendChatMessageToPlayer(player, "Cette personne ~r~a déjà ~s~une faction."); } else { target.factionid = objplayer.factionid; target.rangfaction = 1; API.sendChatMessageToPlayer(player, "Tu as invité ~b~" + Fonction.RemoveUnderscore(target.PlayerName) + " ~s~dans ta faction."); API.sendChatMessageToPlayer(target.Handle, "Tu as ~g~rejoins ~s~une faction."); } } } else { API.sendChatMessageToPlayer(player, Constante.PasDeFact); } }
public void BaliseCoupee(Client player) { PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player); if (!Fonction.IsPlayerInFaction(objplayer, "Police", true)) { return; } objplayer.BaliseLSPD = false; List <Client> PlayerDuty = new List <Client>(); foreach (Client target in API.getAllPlayers()) { PlayerInfo objtarget = PlayerInfo.GetPlayerInfoObject(target); if (objtarget.factionid == Constante.Faction_Police && objtarget.IsFactionDuty == true) { PlayerDuty.Add(target); var msgreceveur = Fonction.RemoveUnderscore(player.name) + " dit: Demande de renfort annulée."; API.sendChatMessageToPlayer(target, Constante.RadioFaction, msgreceveur); } } foreach (Client TargetDuty in PlayerDuty) { System.Threading.Thread.Sleep(5000); API.triggerClientEvent(TargetDuty, "DeleteBaliseLSPD", String.Format("Balise{0}", player.name)); } Fonction.SendCloseMessage(player, 15.0f, Constante.VioletMe, Fonction.RemoveUnderscore(player.name) + " utilise sa balise GPS."); }
public void Megaphone(Client player, string message) { PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player); if (!Fonction.IsPlayerInFaction(objplayer, "Police", true)) { return; } if (!objplayer.IsFactionDuty) { API.sendChatMessageToPlayer(player, Constante.PasEnService); return; } VehiculeInfo objveh = VehiculeInfo.GetVehicleInfoByNetHandle(player.vehicle); if (!player.isInVehicle) { API.sendChatMessageToPlayer(player, "Tu n'as pas de ~r~mégaphone ~s~sur toi."); return; } if (objveh.factionid != Constante.Faction_Police) { API.sendChatMessageToPlayer(player, "Tu n'as pas de ~r~mégaphone ~s~dans ton véhicule."); } else { Fonction.SendCloseMessage(player, 40.0f, Constante.JauneMegaphone, Fonction.RemoveUnderscore(player.name) + " dit au mégaphone : " + message); } }
public void Command_OocAdmin(Client player, string message) { PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player); if (objplayer.adminlvl < 1) { API.sendChatMessageToPlayer(player, "~r~Tu n'as pas le droit d'utiliser cette commande admin."); } else { var msg = Fonction.RemoveUnderscore(player.name) + ": (( " + message + " ))"; API.sendChatMessageToAll(msg); } }
public void Cmd_id(Client player, string idOrName) { PlayerInfo target = PlayerInfo.GetPlayerInfotByIdOrName(idOrName); if (target == null) { API.sendChatMessageToPlayer(player, Constante.message_id_incorrect); } else { API.sendChatMessageToPlayer(player, string.Format(Fonction.RemoveUnderscore(player.name) + " - id: " + target.id)); } return; }
[Command("veh")]//Parler en vehicule seulement public void Command_veh(Client player, string message) { if (player.isInVehicle) { var usersInCar = API.getVehicleOccupants(API.getPlayerVehicle(player)); foreach (var joueurs in usersInCar) { API.sendChatMessageToPlayer(player, "(Vehicule) " + Fonction.RemoveUnderscore(player.name) + ": " + message); } } else { API.sendChatMessageToPlayer(player, "~r~Tu n'es pas dans un véhicule!"); } }
public void Command_pm(Client player, String idOrName, string message) { PlayerInfo target = PlayerInfo.GetPlayerInfotByIdOrName(idOrName); if (target == null) { API.sendChatMessageToPlayer(player, Constante.message_id_incorrect); } else { var msg_to_sender = "PM envoyé à " + Fonction.RemoveUnderscore(target.PlayerName) + ": " + message; API.sendChatMessageToPlayer(player, msg_to_sender); var msg = "PM reçu de " + Fonction.RemoveUnderscore(player.name) + ": " + message; API.sendChatMessageToPlayer(target.Handle, msg); } return; }
public void RejoindreUnite(Client player, int NumeroUnite) { PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player); if (!Fonction.IsPlayerInFaction(objplayer, "Police", true)) { return; } if (objplayer.IsFactionDuty == false) { API.sendChatMessageToPlayer(player, Constante.PasEnService); return; } if (UnitesLSPDInfo.GetUniteLSPDInfoByMembre(player) != null) { API.sendChatMessageToPlayer(player, "~r~Tu es déjà dans une unité."); return; } UnitesLSPDInfo objUnite = UnitesLSPDInfo.GetUniteLSPDInfoByID(NumeroUnite - 1); if (objUnite == null) { API.sendChatMessageToPlayer(player, "~r~L'unité demandée n'éxiste pas."); return; } if (objUnite.Membres.Count == 3) { API.sendChatMessageToPlayer(player, "~r~L'unité demandée est complète."); return; } else { objUnite.Membres.Add(player); for (int i = 0; i < objUnite.Membres.Count; i++) { if (objUnite.Membres[i] != player) { API.sendNotificationToPlayer(objUnite.Membres[i], "~g~" + Fonction.RemoveUnderscore(player.name) + "~s~ a rejoint ton unité."); } } } }
[Command("t", GreedyArg = true)]//Chuchoter a une personne uniquement public void Command_t(Client player, String idOrName, String message) { PlayerInfo target = PlayerInfo.GetPlayerInfotByIdOrName(idOrName); if (target == null) { API.sendChatMessageToPlayer(player, Constante.message_id_incorrect); } else { if (player.position.DistanceTo(API.getEntityPosition(target.Handle)) >= 2) { API.sendChatMessageToPlayer(player, Constante.TuEsTropLoin); return; } var msgsender = "Tu chuchotes à " + Fonction.RemoveUnderscore(target.PlayerName) + ": " + message; API.sendChatMessageToPlayer(player, msgsender); var msgdest = Fonction.RemoveUnderscore(player.name) + " te chuchote : " + message; API.sendChatMessageToPlayer(target.Handle, msgdest); } return; }
public void Balise(Client player) { PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player); if (!Fonction.IsPlayerInFaction(objplayer, "Police", true)) { return; } objplayer.BaliseLSPD = true; List <PlayerInfo> Joueurs = PlayerInfo.PlayerList; List <Client> JoueursDuty = new List <Client>(); foreach (PlayerInfo joueur in Joueurs) { if (joueur.factionid == Constante.Faction_Police && joueur.IsFactionDuty == true) { JoueursDuty.Add(joueur.Handle); var msgreceveur = Fonction.RemoveUnderscore(player.name) + " dit: Besoin de renfort sur notre balise GPS."; API.sendChatMessageToPlayer(joueur.Handle, Constante.RadioFaction, msgreceveur); } } Fonction.SendCloseMessage(player, 15.0f, Constante.VioletMe, Fonction.RemoveUnderscore(player.name) + " utilise sa balise GPS."); foreach (Client TargetDuty in JoueursDuty) { API.sendChatMessageToPlayer(player, "test 1"); API.triggerClientEvent(player, "BaliseLSPD", player.position.X, player.position.Y, player.position.Z, String.Format("Balise{0}", player.name)); } while (objplayer.BaliseLSPD == true) { System.Threading.Thread.Sleep(2000); foreach (Client TargetDuty in JoueursDuty) { API.sendChatMessageToPlayer(player, "test 2"); API.triggerClientEvent(TargetDuty, "DeleteBaliseLSPD", String.Format("Balise{0}", player.name)); API.triggerClientEvent(player, "BaliseLSPD", player.position.X, player.position.Y, player.position.Z, String.Format("Balise{0}", player.name)); } } }
public void Virer(Client player, String idOrName) { PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player); PlayerInfo target = PlayerInfo.GetPlayerInfotByIdOrName(idOrName); if (objplayer.factionid != 0) { if (objplayer.rangfaction <= 4) { API.sendChatMessageToPlayer(player, Constante.PasLeader); } else { if (target.factionid != objplayer.factionid) { API.sendChatMessageToPlayer(player, "Tu ne peux pas ~r~virer ~s~une personne qui ~r~n'est pas ~s~dans ta faction."); } else { if (player.position.DistanceTo(target.Handle.position) >= 2) { API.sendChatMessageToPlayer(player, Constante.TuEsTropLoin); } else { target.factionid = 0; target.rangfaction = 0; API.sendChatMessageToPlayer(player, "Tu as viré ~b~" + Fonction.RemoveUnderscore(target.PlayerName) + " ~s~de ta faction."); API.sendChatMessageToPlayer(target.Handle, "Tu as été ~r~virer ~s~de ta faction."); } } } } else { API.sendChatMessageToPlayer(player, Constante.PasDeFact); } }
public void Command_do(Client player, string action) { Fonction.SendCloseMessage(player, 15.0f, Constante.VioletMe, action + " " + "((" + Fonction.RemoveUnderscore(player.name) + "))"); }
public void OnPlayerChat(Client player, string message, CancelEventArgs e) { API.exported.database.executeQuery("INSERT INTO LogTextJoueur VALUE ('', 'Message', '" + player.name + "', '" + message + "')"); PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player); if (objplayer.EnAppel == true) { API.sendChatMessageToPlayer(objplayer.Correspondant, "~b~Téléphone~s~: " + message); } Fonction.SendCloseMessage(player, 15.0f, "~#ffffff~", Fonction.RemoveUnderscore(player.name) + " dit: " + message); if (objplayer.addquestion == 1) { API.exported.database.executeQuery("INSERT INTO QuestionAutoEcole VALUES ('','" + message + "', '', '', '')"); DataTable result = API.exported.database.executeQueryWithResult("SELECT * FROM QuestionAutoEcole WHERE Question='" + message + "'"); foreach (DataRow row in result.Rows) { objplayer.IDBDDquestion = Convert.ToInt32(row["ID"]); objplayer.addquestion = 2; API.sendChatMessageToPlayer(player, "[2/4] Entre maintenant la bonne réponse."); e.Cancel = true; return; } } if (objplayer.addquestion == 2) { API.exported.database.executeQuery("UPDATE QuestionAutoEcole SET BR='" + message + "' WHERE ID='" + objplayer.IDBDDquestion + "'"); API.sendChatMessageToPlayer(player, "[3/4] Entre maintenant une mauvaise réponse."); objplayer.addquestion = 3; e.Cancel = true; return; } if (objplayer.addquestion == 3) { API.exported.database.executeQuery("UPDATE QuestionAutoEcole SET R2='" + message + "' WHERE ID='" + objplayer.IDBDDquestion + "'"); API.sendChatMessageToPlayer(player, "[4/4] Entre maintenant une autre mauvaise réponse."); objplayer.addquestion = 4; e.Cancel = true; return; } if (objplayer.addquestion == 4) { API.exported.database.executeQuery("UPDATE QuestionAutoEcole SET R3='" + message + "' WHERE ID='" + objplayer.IDBDDquestion + "'"); API.sendChatMessageToPlayer(player, "La question a bien été ajoutée."); objplayer.addquestion = 0; e.Cancel = true; return; } if (objplayer.DansQuestionnaire == true) { if (message == Convert.ToString(objplayer.BonneReponse)) { if (objplayer.QuestionEnCours != objplayer.OrdreQuestionAutoEcole.Count) { objplayer.QuestionEnCours += 1; if (objplayer.QuestionEnCours != objplayer.OrdreQuestionAutoEcole.Count) { for (int p = 0; p < 10; p++) { API.sendChatMessageToPlayer(player, " "); } AutoEcole.LoadQuestion(player); e.Cancel = true; return; } else { for (int p = 0; p < 10; p++) { API.sendChatMessageToPlayer(player, " "); } API.sendChatMessageToPlayer(player, "~g~Félicitation~s~, tu as ~g~réussi~s~ l'épreuve du ~b~code de la route~s~ !"); API.sendChatMessageToPlayer(player, "Tu peux maintenant ~g~passer~s~ l'épreuve de ~b~conduite~s~."); objplayer.DansQuestionnaire = false; objplayer.CodeDeLaRoute = true; objplayer.OrdreQuestionAutoEcole.Clear(); } } } } e.Cancel = true; return; }
[Command("s", GreedyArg = true)] //crier public void Command_s(Client player, string message) { Fonction.SendCloseMessage(player, 25.0f, "~#ffffff~", Fonction.RemoveUnderscore(player.name) + " crie: " + message + "!"); }
public static void Command_R(Client player, string message) { PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player); FactionInfo objfaction = FactionInfo.GetFactionInfoById(objplayer.factionid); if (objfaction == null) { API.shared.sendChatMessageToPlayer(player, Constante.PasDeFact); } if (!objfaction.HasRadio) { API.shared.sendChatMessageToPlayer(player, Constante.PasDeRadioFact); } else { if (objplayer.IsFactionDuty == false) { API.shared.sendChatMessageToPlayer(player, Constante.PasEnService); } else { switch (objplayer.factionid) { case Constante.Faction_Police: { if (UnitesLSPDInfo.GetUniteLSPDInfoByMembre(player) != null) { UnitesLSPDInfo objUnite = UnitesLSPDInfo.GetUniteLSPDInfoByMembre(player); var msgsender = "[Radio] " + Fonction.RemoveUnderscore(player.name) + " " + UnitesLSPDInfo.GetUniteName(objUnite.ID) + " dit: " + message; API.shared.sendChatMessageToPlayer(player, msgsender); List <Client> PlayerDuty = API.shared.getAllPlayers(); foreach (Client target in PlayerDuty) { PlayerInfo objtarget = PlayerInfo.GetPlayerInfoObject(target); if (objtarget.factionid == Constante.Faction_Police && objtarget.IsFactionDuty == true && objtarget.Handle != player.handle) { var msgreceveur = "[Radio] " + Fonction.RemoveUnderscore(player.name) + " " + UnitesLSPDInfo.GetUniteName(objUnite.ID) + " : " + message; API.shared.sendChatMessageToPlayer(target, Constante.RadioFaction, msgreceveur); } } } else { var msgsender = "[Radio]" + Fonction.RemoveUnderscore(player.name) + " dit: " + message; API.shared.sendChatMessageToPlayer(player, msgsender); List <Client> PlayerDuty = API.shared.getAllPlayers(); foreach (Client target in PlayerDuty) { PlayerInfo objtarget = PlayerInfo.GetPlayerInfoObject(target); if (objtarget.factionid == Constante.Faction_Police && objtarget.IsFactionDuty == true) { var msgreceveur = Fonction.RemoveUnderscore(player.name) + ": " + message; API.shared.sendChatMessageToPlayer(target, Constante.RadioFaction, msgreceveur); } } } break; } case Constante.Faction_Gardien: { var msgsender = "[Radio]" + Fonction.RemoveUnderscore(player.name) + " dit: " + message; API.shared.sendChatMessageToPlayer(player, msgsender); List <Client> PlayerDuty = API.shared.getAllPlayers(); foreach (Client target in PlayerDuty) { PlayerInfo objtarget = PlayerInfo.GetPlayerInfoObject(target); if (objtarget.factionid == Constante.Faction_Gardien && objtarget.IsFactionDuty == true) { var msgreceveur = Fonction.RemoveUnderscore(player.name) + ": " + message; API.shared.sendChatMessageToPlayer(target, Constante.RadioFaction, msgreceveur); } } break; } } } } }
[Command("melow", GreedyArg = true)] // /me avec petit radius public void Command_melow(Client player, string action) { Fonction.SendCloseMessage(player, 7.5f, Constante.VioletMe, Fonction.RemoveUnderscore(player.name) + " " + action); }
public void Amende(Client player, String idOrName, int montant, string raison) { PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player); PlayerInfo objtarget = PlayerInfo.GetPlayerInfotByIdOrName(idOrName); if (!Fonction.IsPlayerInFaction(objplayer, "Police", true)) { return; } if (!objplayer.IsFactionDuty) { API.sendChatMessageToPlayer(player, Constante.PasEnService); return; } API.sendChatMessageToPlayer(player, "Tu viens de donner une amende de ~g~" + montant + "~s~$ à " + Fonction.RemoveUnderscore(objtarget.PlayerName)); API.sendChatMessageToPlayer(objtarget.Handle, "Tu viens de recevoir une amende de ~r~" + montant + "~s~$ par " + Fonction.RemoveUnderscore(objplayer.PlayerName) + " pour " + raison); int date; Int32.TryParse(DateTime.Now.ToString("ddMMyyyyhhmmss"), out date); AmendeInfo amende = new AmendeInfo(objtarget.Handle, montant, raison, objplayer.PlayerName, date); if (objtarget.money >= montant) { API.sendChatMessageToPlayer(objtarget.Handle, "Tu possèdes assez d'argent sur toi pour la payer maintenant ~m~(/payeramende " + amende.id + ")~s~."); API.sendChatMessageToPlayer(objtarget.Handle, "Pour la payer plus tard au poste tu peux. Si tu attends trop, elle sera prélevée sur ton salaire."); return; } else { API.sendChatMessageToPlayer(objtarget.Handle, "Rends toi au poste dès que possible pour régler ton amende. Sinon, elle sera prélevée sur ton salaire."); API.sendChatMessageToPlayer(objtarget.Handle, "Id de ton amende : " + amende.id + "."); } API.exported.database.executeQuery("INSERT INTO UtilisateurAmende SET playername = '" + objtarget.PlayerName + "', montant = " + amende.montant + ", raison='" + amende.raison + "', auteur='" + amende.auteur + "', date=" + amende.date); }
public void Donnerrang(Client player, String idOrName, int rang) { PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player); PlayerInfo target = PlayerInfo.GetPlayerInfotByIdOrName(idOrName); if (objplayer.factionid != 0) { if (objplayer.rangfaction <= 5) { API.sendChatMessageToPlayer(player, Constante.PasLeader); } else { if (target.factionid != objplayer.factionid) { API.sendChatMessageToPlayer(player, "Tu ne peux pas gérer le ~r~rang ~s~d'une personne qui ~r~n'est pas ~s~dans ta faction."); } else { if (rang <= 0 || rang >= 7) { API.sendChatMessageToPlayer(player, "Le rang doit être compris entre 1 et 6."); } else { target.rangfaction = rang; API.sendChatMessageToPlayer(player, "Tu viens de passer ~b~" + Fonction.RemoveUnderscore(target.PlayerName) + " ~s~rang ~g~" + rang + " ~s~de ta faction."); API.sendChatMessageToPlayer(target.Handle, "Tu as été promu rang ~g~" + rang + " ~s~de ta faction par ton chef."); } } } } else { API.sendChatMessageToPlayer(player, Constante.PasDeFact); } }
//Verification compte existant + Freeze et application de la camera connexion private void OnPlayerFinishedDownloadHandler(Client player) { if (IsBan(player)) { API.kickPlayer(player, "~r~Tu es banni du serveur, Rendez-vous sur Generation-Five.fr pour plus d'informations"); } else { PlayerInfo objplayer = new PlayerInfo(player); //player.freeze(true); Cams.createCameraActive(player, new Vector3(332.8148, -1625.127, 98.49599), new Vector3(0, 0, 18.26657)); //API.setEntityPosition(player, new Vector3(334.1689, -1628.986, 98.49599)); API.sleep(5000); API.triggerClientEvent(player, "showLogin"); if (CompteJoueurExistant(player) != -1) { API.sendChatMessageToPlayer(player, "~s~Bienvenue sur ~b~GenerationFive~s~."); API.sendChatMessageToPlayer(player, "~s~Tu es connecté avec le compte social club~b~ " + player.socialClubName + "~s~."); API.sendChatMessageToPlayer(player, "~s~Ton compte rôleplay a été trouvé au nom de ~b~" + Fonction.RemoveUnderscore(player.name) + "~s~."); API.sendChatMessageToPlayer(player, "~s~Version actuelle du serveur ~b~" + Constante.Version + "~s~."); return; } else { API.sendChatMessageToPlayer(player, "~s~Bienvenue sur ~b~GenerationFive~s~."); API.sendChatMessageToPlayer(player, "~s~Tu es connecté avec le compte social club~b~ " + player.socialClubName + " ~s~."); API.sendChatMessageToPlayer(player, "~s~Tu n'as ~b~pas encore de compte rôleplay~s~, entre un ~b~mot de passe ~s~pour en créer un."); API.sendChatMessageToPlayer(player, "~s~Version actuelle du serveur ~b~" + Constante.Version + "~s~."); } } }
[Command("o", GreedyArg = true)] //ooc public void Command_o(Client player, string message) { Fonction.SendCloseMessage(player, 15.0f, "~#ffffff~", Fonction.RemoveUnderscore(player.name) + " dit: " + "(( " + message + " ))"); }
public void Donnerclefveh(Client player, String idOrName, int IDVehicule) { PlayerInfo objtarget = PlayerInfo.GetPlayerInfotByIdOrName(idOrName); if (objtarget == null) { API.sendChatMessageToPlayer(player, Constante.message_id_incorrect); } VehiculeInfo objveh = VehiculeInfo.GetVehicleInfoById(IDVehicule); if (objveh == null) { API.sendChatMessageToPlayer(player, Constante.message_idveh_incorrect); } if (Concess.GetVehKeyNumberPlayer(player, objveh.dbid) == 0) { API.sendChatMessageToPlayer(player, "~r~Tu ne possède pas de clé de ce vehicule."); return; } if (Concess.PlayerIsProprio(player, objveh.dbid)) { if (Concess.GetVehKeyNumberPlayer(player, objveh.dbid) == 1) { API.sendChatMessageToPlayer(player, "~r~Tu ne peux pas donner la derniere clé de ton vehicule."); return; } else { Concess.RemoveKeyVehToPlayer(player, objveh.dbid); Concess.AddKeyVehToPlayer(objtarget.Handle, objveh.dbid); API.sendChatMessageToPlayer(player, String.Format("Tu viens de ~g~donner ~s~une clé du véhicule ~b~{0} ~s~au joueur ~b~{1}~s~.", IDVehicule, Fonction.RemoveUnderscore(objtarget.PlayerName))); API.sendChatMessageToPlayer(objtarget.Handle, String.Format("~b~{0} ~s~vient de te ~g~donner ~s~une clé du véhicule ~b~{1}~s~.", Fonction.RemoveUnderscore(player.name), IDVehicule)); return; } } else { Concess.RemoveKeyVehToPlayer(player, objveh.dbid); Concess.AddKeyVehToPlayer(objtarget.Handle, objveh.dbid); API.sendChatMessageToPlayer(player, String.Format("Tu viens de ~g~donner ~s~une cléf du véhicule ~b~{0} ~s~au joueur ~b~{1}~s~.", IDVehicule, Fonction.RemoveUnderscore(objtarget.PlayerName))); API.sendChatMessageToPlayer(objtarget.Handle, String.Format("~b~{0} ~s~vient de te ~g~donner ~s~une clé du véhicule ~b~{1}~s~.", Fonction.RemoveUnderscore(player.name), IDVehicule)); } }
[Command("chu", GreedyArg = true)] //chuchotter public void Command_chu(Client player, string message) { Fonction.SendCloseMessage(player, 7.5f, "~#ffffff~", Fonction.RemoveUnderscore(player.name) + " chuchotte: " + message); }