public void Creerpatrouille(Client player) { 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; } if (!player.isInVehicle || VehiculeInfo.GetVehicleInfoByNetHandle(player.vehicle.handle).factionid != Constante.Faction_Police) { API.sendChatMessageToPlayer(player, "~r~Il faut etre dans un véhicule pour creer une unité."); } else { UnitesLSPDInfo Uniteobj = new UnitesLSPDInfo(player, player.vehicle); API.sendChatMessageToPlayer(player, "Numéro d'unité : ~g~" + (Uniteobj.ID + 1) + "~s~ | Numéro du véhicule : ~g~" + VehiculeInfo.GetVehicleInfoByNetHandle(player.vehicle.handle).ID); return; } }
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 OnPlayerEnterVehicleHandle(Client player, NetHandle vehicle, int targetSeat) { PlayerInfo objplayer = PlayerInfo.GetPlayerInfoObject(player); VehiculeInfo objvehicule = VehiculeInfo.GetVehicleInfoByNetHandle(vehicle); if (objvehicule.jobid == Constante.Job_Convoyeur) { if (!Fonction.IsPlayerInFaction(objplayer, "Gardien", true)) { return; } } if (objvehicule.EnVente == true) { API.triggerClientEvent(player, "MenuVehConcess"); } }
public void Forcer(Client player, String option) { NetHandle veh = CreationMenus.GetClosestVehicle(player); VehiculeInfo vehobj = VehiculeInfo.GetVehicleInfoByNetHandle(veh); if (option == "vehicule") { if (API.getPlayerCurrentWeapon(player) == WeaponHash.Crowbar) { API.delay(5000, true, () => { Random aleatoire = new Random(); int resultat = aleatoire.Next(1, 10); if (resultat == 10) { API.sendChatMessageToPlayer(player, "Tu as ~g~réussis ~s~à forcer la porte du véhicule."); API.setVehicleLocked(vehobj.handle, false); vehobj.locked = false; return; } else if (resultat >= 3) { API.sendChatMessageToPlayer(player, "Tu n'as ~r~pas réussis ~s~à forcer la porte du véhicule."); return; } else { API.removePlayerWeapon(player, WeaponHash.Crowbar); API.sendChatMessageToPlayer(player, "Tu as ~g~réussis ~s~à forcer la porte du véhicule, mais ton pied de biche s'est cassé."); API.setVehicleLocked(vehobj.handle, false); vehobj.locked = false; } }); } else { API.sendChatMessageToPlayer(player, "Tu n'as rien pour ~r~forcer ~s~la porte de ce véhicule."); } } if (option == "maison") { API.sendChatMessageToPlayer(player, "J'arrive bientôt."); } }
private void OnResourceStopHandler() { foreach (var veh in API.getAllVehicles()) { VehiculeInfo objveh = VehiculeInfo.GetVehicleInfoByNetHandle(veh); if (objveh == null) { API.deleteEntity(veh); } else { SaveTuningVehicule(objveh.dbid); if (objveh.factionid != 0 || objveh.jobid != 0) { SaveEssenceVehicule(objveh.dbid, objveh.essence); VehiculeInfo.Delete(veh); } else { SavePosVehicule(objveh.dbid); SaveEssenceVehicule(objveh.dbid, objveh.essence); VehiculeInfo.Delete(veh); } } } API.consoleOutput("[SAVE] Vehicules OK."); foreach (var label in API.getAllLabels()) { API.deleteEntity(label); } API.consoleOutput("[DELETE] Labels OK."); foreach (var blip in API.getAllBlips()) { API.deleteEntity(blip); } API.consoleOutput("[DELETE] Blips OK."); foreach (StationsEssencesInfo station in StationsEssencesInfo.StationsList) { API.exported.database.executeQuery("UPDATE StationsEssences SET Stockage = '" + station.Stockage + "', Argents = '" + station.Argents + "' WHERE ID = '" + station.IDBDD + "'"); } API.consoleOutput("[SAVE] Station Essence OK."); SaveATM(); SaveClefs(); }
public void ScriptEvent(Client sender, PlayerInfo objplayer, string eventName) { if (eventName == "ConvoyeurKeyPressed" && !API.isPlayerInAnyVehicle(sender)) { VehiculeInfo objvehicule = VehiculeInfo.GetVehicleArroundPlayer(sender); if (objvehicule == null) { return; /* ??? c bon sa*/ } if (objplayer.sacbanque == true) { var sacs = objvehicule.sacs; if (sacs != 5) { var asacs = sacs + 1; objvehicule.sacs = asacs; objplayer.sacbanque = false; API.setPlayerClothes(sender, 5, 0, 0); if (asacs == 5) { API.sendChatMessageToPlayer(sender, "~g~Le camion est plein ! Tu peux y aller !"); } } } else { var sacs = objvehicule.sacs; if (sacs != 0) { objplayer.sacbanque = true; var nsacs = sacs - 1; API.setPlayerClothes(sender, 5, 45, 0); objvehicule.sacs = nsacs; if (nsacs == 0) { API.sendChatMessageToPlayer(sender, "~g~Tu viens de prendre le dernier sac ! Remplis l'ATM puis choisis entre recommencer (se rendre au point indiqué) ou arreter (/stopjob) !"); API.triggerClientEvent(sender, "pointconv"); } } } } if (eventName == "DepotConvKey" && !API.isPlayerInAnyVehicle(sender) && sender.position.DistanceTo(Constante.Pos_DepotConvoyeur) < 2) { if (Fonction.IsPlayerInFaction(objplayer, "Gardien", false)) { if (objplayer.IsJobDuty != true) { if (objplayer.sexe == 0) { int[] draw = { 0, 0, -1, 44, 31, 0, 24, 0, 23, 0, 0, 130 }; int[] tex = { 0, 0, -1, 0, 0, 0, 0, 0, 2, 0, 0, 0 }; for (int i = 0; i < draw.Length; i++) { API.setPlayerClothes(sender, i, draw[i], tex[i]); } API.setPlayerAccessory(sender, 0, 65, 0); } else { int[] draw = { 0, 0, -1, 49, 32, 0, 25, 0, 2, 0, 0, 127 }; int[] tex = { 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; for (int i = 0; i < draw.Length; i++) { API.setPlayerClothes(sender, i, draw[i], tex[i]); } API.setPlayerAccessory(sender, 0, 64, 0); } objplayer.IsJobDuty = true; objplayer.sacbanque = false; API.sendNotificationToPlayer(sender, "~g~Montes dans un ~r~camion ~g~et rends toi au ~r~point ~g~indiqué."); API.triggerClientEvent(sender, "pointconv"); } else { API.sendNotificationToPlayer(sender, "~g~Tu viens de te retirer du service."); Connexion lv = new Connexion(); API.clearPlayerAccessory(sender, 0); lv.LoadVetements(sender); lv.LoadAccessoires(sender); objplayer.IsJobDuty = false; } } else { API.sendChatMessageToPlayer(sender, "~r~Tu n'es pas Convoyeur de Fonds"); } } if (eventName == "ConvoyeurKeyPressed" && API.isPlayerInAnyVehicle(sender) && objplayer.retourconv == true && sender.position.DistanceTo(new Vector3(490.227, -1402.756, 29.32529)) < 4) { VehiculeInfo objvehicule = VehiculeInfo.GetVehicleInfoByNetHandle(sender.vehicle); if (objvehicule.jobid == Constante.Job_Convoyeur) { Client[] jo = API.getVehicleOccupants(objvehicule.handle); foreach (Client value in jo) { API.warpPlayerOutOfVehicle(value); objplayer.retourconv = false; } API.setEntityPosition(objvehicule.handle, objvehicule.pos); API.setEntityRotation(objvehicule.handle, objvehicule.rot); objvehicule.sacs = 0; API.setVehicleEngineStatus(objvehicule.handle, false); } } }
public static void SetVehSpawnPoint(NetHandle vehicule, Vector3 Pos, Vector3 Rot) { VehiculeInfo objveh = VehiculeInfo.GetVehicleInfoByNetHandle(vehicule); API.shared.exported.database.executeQuery("UPDATE Vehicules SET PosX='" + Pos.X + "', PosY='" + Pos.Y + "', PosZ='" + Pos.Z + "', RotX='" + Rot.X + "', RotY='" + Rot.Y + "', RotZ= '" + Rot.Z + "' WHERE ID = '" + objveh.dbid + "'"); }