public BahamaMamas() { Tick += OnTick; asd = World.CreateBlip(new Vector3(-1387.975f, -587.7377f, 30.21593f)); asd.Sprite = BlipSprite.Bar; asd.Color = BlipColor.Blue; //You can change this color to Blue, Green, White, Yellow or Red. Case sensitive. }
/// <summary> /// OnCalloutAccepted is where we begin our callout's logic. In this instance we create our pursuit and add our ped from eariler to the pursuit as well /// </summary> /// <returns></returns> public override bool OnCalloutAccepted() { //We accepted the callout, so lets initilize our blip from before and attach it to our ped so we know where he is. myBlip = myPed.AttachBlip(); this.pursuit = Functions.CreatePursuit(); Functions.AddPedToPursuit(this.pursuit, this.myPed); return base.OnCalloutAccepted(); }
public override bool OnCalloutAccepted() { SuspectVehicle = new Vehicle("ZENTORNO", SpawnPoint); SuspectVehicle.IsPersistent = true; Suspect = SuspectVehicle.CreateRandomDriver(); Suspect.IsPersistent = true; Suspect.BlockPermanentEvents = true; SuspectBlip = Suspect.AttachBlip(); SuspectBlip.IsFriendly = false; Suspect.Tasks.CruiseWithVehicle(20f, VehicleDrivingFlags.Emergency); return base.OnCalloutAccepted(); }
private void PerformProcedures() { Procedures(); if (_takeToHospital) { MovePatientToAmbulance(_patient); } _blipEmt = new Blip(PedWorker) { Color = System.Drawing.Color.Green, Sprite = BlipSprite.Health, Scale = 0.25f }; Game.DisplayHelp("Talk to EMS to receive a medical report."); Proc.SwapProcesses(PerformProcedures, WaitForDialogueActivation); }
/// <summary> /// Called when the player accepts the callout /// </summary> /// <returns></returns> public override bool OnCalloutAccepted() { //Set the player as en route to the scene state = EMuggingState.EnRoute; //Attach a blip to the Aggressor, so the player knows where to go, and can find the aggressor if he flees ABlip = Aggressor.AttachBlip(); //Have the aggressor aim at the victim, and have the victim put their hands up. -1 makes the task permanent, or until we clear the task, which we do later. NativeFunction.CallByName <uint>("TASK_AIM_GUN_AT_ENTITY", Aggressor, Victim, -1, true); Victim.Tasks.PutHandsUp(-1, Aggressor); //Block permanent events, so the victim doesn't flee if something disturbs them(A vehicle tapping them, etc..), as this would completely disrupt the callout's logic. Victim.BlockPermanentEvents = true; //Display a message to let the user know that the callout was accepted. Game.DisplaySubtitle("Get to the ~r~scene~w~.", 6500); return(base.OnCalloutAccepted()); }
/// <summary> /// 把含有 Blip 元素的 Drawing 元素删除 /// </summary> /// <param name="blipElement"></param> public void DeleteImage(Blip blipElement) { OpenXmlElement parent = blipElement.Parent; while (parent != null && !(parent is DocumentFormat.OpenXml.Wordprocessing.Drawing)) { parent = parent.Parent; } if (parent != null) { Drawing drawing = parent as Drawing; drawing.Parent.RemoveChild <Drawing>(drawing); // 触发 ImagesChanged 事件. this.OnImagesChanged(); } }
public static bool AvoidAdaptSize = false; //Jpeg compression creates different images in TeamCity /// <param name="title">Word Image -> Right Click -> Format Picture -> Alt Text -> Title </param> public static void ReplaceImage(WordprocessingDocument doc, string title, Bitmap bitmap, string newImagePartId, bool adaptSize = false, ImagePartType imagePartType = ImagePartType.Png) { Blip blip = FindBlip(doc, title); if (adaptSize && !AvoidAdaptSize) { var part = doc.MainDocumentPart.GetPartById(blip.Embed); Bitmap oldBmp = (Bitmap)Bitmap.FromStream(part.GetStream()); bitmap = ImageResizer.Resize(bitmap, oldBmp.Width, oldBmp.Height); } doc.MainDocumentPart.DeletePart(blip.Embed); ImagePart img = CreateImagePart(doc, bitmap, newImagePartId, imagePartType); blip.Embed = doc.MainDocumentPart.GetIdOfPart(img); }
void TestScript1_Tick(object sender, EventArgs e) { if (myPed == null) { myPed = World.CreatePed(PedID.WFYSEX, Player.Character.Position.Around(10), 23); myBlip = Blip.AddBlip(myPed); myBlip.Color = BlipColor.Pickup; Player.Character.Weapons[WeaponID.Assault_M4].Load(); Player.Character.Weapons[WeaponID.Assault_M4].Ammo = 200; Player.Character.Weapons[WeaponID.Assault_M4].Select(); } if (!myPed.IsAlive) { myBlip.Delete(); myPed = null; } }
/// <summary> /// The mission setup. This spawns things like vehicles, blips, etc /// </summary> public override void Start() { this.pay = 5000; voltic = World.CreateVehicle(new Model("voltic"), new Vector3(-926.974f, 11.819f, 47.719f), 214.167f); Main.spawnedVehicles.Add(voltic); volticBlip = voltic.AddBlip(); volticBlip.Name = "Voltic"; volticBlip.Color = BlipColor.Blue; mansionBlip = World.CreateBlip(new Vector3(-926.974f, 11.819f, 47.719f)); mansionBlip.Color = BlipColor.Yellow; mansionBlip.Name = "Mansion"; mansionBlip.ShowRoute = true; Main.drawnBlips.Add(mansionBlip); Main.drawnBlips.Add(volticBlip); UI.ShowSubtitle("Go to the ~y~Mansion", 15000); }
/// <summary> /// Called when the player accepts the callout /// </summary> /// <returns></returns> public override bool OnCalloutAccepted() { //Set the player as en route to the scene state = EMuggingState.EnRoute; //Attach a blip to the Aggressor, so the player knows where to go, and can find the aggressor if he flees ABlip = Aggressor.AttachBlip(); //Have the aggressor aim at the victim, and have the victim put their hands up. -1 makes the task permanent, or until we clear the task, which we do later. NativeFunction.CallByName<uint>("TASK_AIM_GUN_AT_ENTITY", Aggressor, Victim, -1, true); Victim.Tasks.PutHandsUp(-1, Aggressor); //Block permanent events, so the victim doesn't flee if something disturbs them(A vehicle tapping them, etc..), as this would completely disrupt the callout's logic. Victim.BlockPermanentEvents = true; //Display a message to let the user know that the callout was accepted. Game.DisplaySubtitle("Get to the ~r~scene~w~.", 6500); return base.OnCalloutAccepted(); }
public void hit() { if (Game.Player.Character.IsInRangeOf(start, 3f) && !_isStarted) { UI.Notify("Picked up package"); _isStarted = true; blip?.Remove(); blip = World.CreateBlip(end); blip.Color = BlipColor.Red; } if (Game.Player.Character.IsInRangeOf(end, 3f) && _isStarted) { _isStarted = false; UI.Notify("Finished!"); Game.Player.Money += RandGen.Next(2, 5); blip.Remove(); isActive = false; } }
public override bool OnCalloutAccepted() { Game.SetRelationshipBetweenRelationshipGroups("COUGAR", "PED", Relationship.Hate); Game.SetRelationshipBetweenRelationshipGroups("COUGAR", "PLAYER", Relationship.Hate); Game.SetRelationshipBetweenRelationshipGroups("PED", "PLAYER", Relationship.Companion); attackedPed.MaxHealth = 200; attackedPedBlip = new Blip(attackedPed); attackedPedBlip.Color = Color.ForestGreen; animalBlip = new Blip(animal); animalBlip.Color = Color.DarkRed; attackedPed.ReactAndFlee(animal); animal.AttackPed(attackedPed); return(base.OnCalloutAccepted()); }
public void OnPlayerSpawned(int playerid) { foreach (Player player in Players) { if (player.Character.AttachedBlip == null && player.Handle != Game.Player.Handle) { Blip b = player.Character.AttachBlip(); b.IsShortRange = false; b.Color = BlipColor.White; b.Name = player.Name; int pHandle = player.Handle; if (NetworkIsFriend(ref pHandle)) { SetBlipFriend(b.Handle, true); } } } }
public override void Spawn() { CarshopMarker = NAPI.Marker.CreateMarker(0, Data.Position, new Vector3(1f, 1f, 1f), new Vector3(1f, 1f, 1f), 1f, new Color(255, 106, 148, 40)); ColShape = NAPI.ColShape.CreateCylinderColShape(Data.Position, 2f, 5f); ColShape.OnEntityEnterColShape += (shape, entity) => { if (NAPI.Entity.GetEntityType(entity) != EntityType.Player) { return; } Client player = NAPI.Player.GetPlayerFromHandle(entity); string compactsJson = JsonConvert.SerializeObject(CarshopScript.Vehicles.Where(v => v.Category == VehicleClass.Compact && v.CarshopTypes == Data.Type)); string coupesJson = JsonConvert.SerializeObject(CarshopScript.Vehicles.Where(v => v.Category == VehicleClass.Coupe && v.CarshopTypes == Data.Type)); string suvsJson = JsonConvert.SerializeObject(CarshopScript.Vehicles.Where(v => v.Category == VehicleClass.Suv && v.CarshopTypes == Data.Type)); string sedansJson = JsonConvert.SerializeObject(CarshopScript.Vehicles.Where(v => v.Category == VehicleClass.Sedans && v.CarshopTypes == Data.Type)); string sportsJson = JsonConvert.SerializeObject(CarshopScript.Vehicles.Where(v => v.Category == VehicleClass.Sports && v.CarshopTypes == Data.Type)); string motorcyclesJson = JsonConvert.SerializeObject(CarshopScript.Vehicles.Where(v => v.Category == VehicleClass.Motorcycles && v.CarshopTypes == Data.Type)); string bicyclesJson = JsonConvert.SerializeObject(CarshopScript.Vehicles.Where(v => v.Category == VehicleClass.Cycle && v.CarshopTypes == Data.Type)); NAPI.ClientEvent.TriggerClientEvent(player, "OnPlayerEnteredCarshop", compactsJson, coupesJson, suvsJson, sedansJson, sportsJson, motorcyclesJson, bicyclesJson); }; CarshopBlip = NAPI.Blip.CreateBlip(Data.Position); CarshopBlip.Sprite = 490; CarshopBlip.Transparency = 100; }
public Parkinglot(Guid id, Vector3 position, long money = 0, List <ParkingSpace> spawns = null) { ID = id; Position = position; Spawns = spawns ?? new List <ParkingSpace>(); Money = money; // create blip Blip = API.shared.createBlip(position); Blip.name = "Estacionamento"; Blip.scale = 1f; Blip.shortRange = true; UpdateBlip(); // create colshape ColShape = API.shared.createCylinderColShape(position, 0.85f, 0.85f); ColShape.onEntityEnterColShape += (s, ent) => { Client player; if ((player = API.shared.getPlayerFromHandle(ent)) != null) { player.setData("ParkinglotMarker_ID", ID); } }; ColShape.onEntityExitColShape += (s, ent) => { Client player; if ((player = API.shared.getPlayerFromHandle(ent)) != null) { player.resetData("ParkinglotMarker_ID"); } }; // create marker Marker = API.shared.createMarker(1, position - new Vector3(0.0, 0.0, 1.0), new Vector3(), new Vector3(), new Vector3(1.0, 1.0, 0.5), 150, 255, 165, 0); // create text label Label = API.shared.createTextLabel("~o~Estacionamento~s~\nPresione ~o~F3 ~s~para usar\n~g~$~s~100", position, 15f, 0.65f); }
public TeleportCameraScript() { currentPosition = Player.Character.Position; inCameraMode = false; cameraActivated = false; zoomIn = false; zoomOut = false; zoom = 1000.0f; direction = MoveDirection.None; GTA.Timer gfxupdate = new Timer(1); gfxupdate.Tick += (s, o) => { onUpdate(); }; gfxupdate.Start(); PerFrameDrawing += TeleportCameraScript_PerFrameDrawing; KeyDown += TeleportCameraScript_KeyDown; KeyUp += TeleportCameraScript_KeyUp; BindConsoleCommand("room", (o) => { Game.Console.Print(Player.Character.CurrentRoom.ToString()); }); BindConsoleCommand("savepos", Client_ScriptCommand); BindConsoleCommand("saveall", Client_SaveAllCommand); BindConsoleCommand("disablevehicles", (o) => { World.CarDensity = 999.0f; //World.GetAllVehicles().ToList().ForEach(op => op.Delete()); }); BindConsoleCommand("tp2wp", (o) => { Blip wp = GTA.Game.GetWaypoint(); if (wp != null) { var pos = wp.Position; Player.TeleportTo(pos.X, pos.Y); } }); }
private void CreateEntities() { veh = new Vehicle(VehicleModel, vehSpawn.Position); veh.Heading = vehSpawn.Heading; veh.IsInvincible = true; veh.MakePersistent(); blipVeh = new Blip(veh); blipVeh.Scale = BLIP_VEH_SCALE; blipVeh.Color = System.Drawing.Color.Blue; copDriver = new Ped(CopDriverModel, veh.Position.Around(2f), 0f); copDriver.WarpIntoVehicle(veh, -1); copDriver.KeepTasks = true; copDriver.BlockPermanentEvents = true; copDriver.Tasks.DriveToPosition(pickupPos, SpeedArrival, DrivingFlagsArrival); ph.SwapProcesses(CreateEntities, WaitForArrival); }
/// <summary> /// 从 Blip 元素中得到图片 /// </summary> public Image GetImageInBlip(Blip blipElement) { // 获取被 Blip 元素引用的 ImagePart var imagePart = Document.MainDocumentPart.GetPartById(blipElement.Embed.Value) as ImagePart; if (imagePart != null) { using (Stream imageStream = imagePart.GetStream()) { Bitmap img = new Bitmap(imageStream); return(img); } } else { throw new ApplicationException("不能发现图片部分:" + blipElement.Embed.Value); } }
private void SpawnHospital() { try { blip = API.createBlip(hospos); API.setBlipName(blip, "Hôpital"); API.setBlipSprite(blip, 61); API.setBlipShortRange(blip, true); pnj = API.createPed((PedHash)(-1420211530), hospos, 37.54668f, 0); pnj.setSyncedData("Interaction", "Hospital"); API.playPedScenario(pnj, "WORLD_HUMAN_SMOKING"); pnjservice = API.createPed((PedHash)(-1286380898), pnjservicepos, 42.87561f, 0); pnjservice.setSyncedData("Interaction", "EMS"); } catch (Exception e) { API.consoleOutput("~r~[ERROR][Hospital] : ~s~" + e.ToString()); } }
private void CreateBlips() { API.consoleOutput("Create general Information Blips"); // Rookiespawn Blip rblip = API.createBlip(new Vector3(259.8162, -1204.156, 29.28907)); rblip.color = 83; rblip.name = "Rookiespawn"; rblip.sprite = 480; rblip.shortRange = true; // City Hall Blip cHBlip = API.createBlip(new Vector3(245, -381.8, 44.5)); cHBlip.color = 83; cHBlip.name = "Stadthalle"; cHBlip.sprite = 419; cHBlip.shortRange = true; }
private async void endTaxiJob() { inRangeOfPed = true; // This is to error out the waiting thread before a npc is picked up (just incase) if (taxiDestination != null) { taxiDestination.Delete(); } taxiDestination = null; targetPed.BlockPermanentEvents = false; targetPed.AttachedBlips.ToList().ForEach(o => { o.Delete(); }); if (targetPed.IsInVehicle()) { targetPed.Task.LeaveVehicle(targetPed.CurrentVehicle, true); } targetPed.Task.GoTo(World.GetNextPositionOnSidewalk(targetPed.Position)); targetPed = null; inTaxiJob = false; }
override public void GamemodeFinalizer() { Debug.WriteLine($"^2---- Gammode Finalized with {CheckpointMarkers.Count} markers. ----"); foreach (var marker in CheckpointMarkers) { Blip b = marker.blip; b.Delete(); //deletes blip from game Checkpoint c = marker.checkpoint; c.Delete(); //deletes checkpoint from game Debug.WriteLine($"Marker has blip: {b.Handle} and checkpoint: {c.Handle}"); } CheckpointMarkers.Clear(); //TODO: this isn't right? Blips seem to get removed correctly now. foreach (var b in World.GetAllBlips()) { Debug.WriteLine("Undeleted blip: " + b.Handle); } }
public override bool OnCalloutAccepted() { suspectVehicle = new Vehicle(spawnPoint); suspectVehicle.IsPersistent = true; suspect = suspectVehicle.CreateRandomDriver(); suspect.IsPersistent = true; suspect.BlockPermanentEvents = true; blip = suspect.AttachBlip(); blip.IsFriendly = false; blip.IsRouteEnabled = true; suspectVehicle.AlarmTimeLeft = new TimeSpan(0, 0, 30); suspect.Tasks.CruiseWithVehicle(20f, VehicleDrivingFlags.Emergency); Functions.SetPedResistanceChance(suspect, 70f); return(base.OnCalloutAccepted()); }
// Start Day 1 Stage 4 public static void Day1Stage4() { // Update Day and Stage Main.currentDay = 1; Main.currentStage = 4; // Remove trashTruck blip var trashTruckBlipExists = Function.Call<bool>(Hash.DOES_BLIP_EXIST, trashTruck.CurrentBlip); if (trashTruckBlipExists) trashTruck.CurrentBlip.Remove(); // Spawn a blip at HumaneLabs humaneLabs = Common.SpawnBlip(3370.720f, 3695.381f, 37.211f, BlipSprite.BigCircle, 21, true); // Tranisition weather to be foggy Function.Call(Hash._SET_WEATHER_TYPE_OVER_TIME, "FOGGY", 50000); // TODO : Remove default guard from checkpoint // Display mission objective UI.ShowSubtitle("Drive to the ~b~Humane Research Facility~s~.", 15000); Common.runDebug(); }
public static void Back_to_charactor() { Function.Call(Hash.CHANGE_PLAYER_PED, Game.Player, Character, true, true); Script.Wait(500); Game.FadeScreenIn(500); Blip loction = World.CreateBlip(new Vector3(1264, 3141, 40)); loction.Color = BlipColor.Green; while (!Game.Player.Character.IsInRangeOf(new Vector3(1264, 3141, 40), 20)) { UI.ShowSubtitle("Drive to Doc's Location"); Script.Wait(10); } loction.Remove(); ExperimentScene.Delorean_scene_start(); }
public override bool OnCalloutAccepted() { /// <summary /// Once accepted creates the blips, the routes, and gives the ped a weapon. /// </summary caller.Tasks.StandStill(-1); callerBlip = caller.AttachBlip(); callerBlip.EnableRoute(System.Drawing.Color.MintCream); callerBlip.Color = System.Drawing.Color.MintCream; calloutState = CalloutState.Enroute; suspect.Tasks.Wander(); suspect.Inventory.GiveNewWeapon(1593441988, 120, false); Game.DisplayNotification("Attend to the caller to find out information."); //change to dispatch Game.LogTrivial("RG:Callout created"); return(base.OnCalloutAccepted()); }
/// <summary> /// Get the image from the Blip element. /// </summary> public Image GetImageInBlip(Blip blipElement) { // Get the ImagePart referred by the Blip element. var imagePart = Document.MainDocumentPart.GetPartById(blipElement.Embed.Value) as ImagePart; if (imagePart != null) { using (Stream imageStream = imagePart.GetStream()) { Bitmap img = new Bitmap(imageStream); return(img); } } else { throw new ApplicationException("Can not find image part : " + blipElement.Embed.Value); } }
private void SetupDefaultBusinesses(List <BusinessPacket> packets) { foreach (var packet in packets) { //Create Marker Blip Blip blip = World.CreateBlip(packet.Business.MarkerPosition.ToVector3()); blip.Sprite = (BlipSprite)packet.Business.MarkerSpriteId; blip.Color = (BlipColor)packet.Business.MarkerColorId; blip.IsShortRange = true; blip.Name = packet.Business.Name; this.businesses.Add(packet.Business); foreach (var position in packet.Positions) { position.Business = packet.Business; this.businessPositions.Add(position); } } }
protected override void depopulateDestructibleElements(bool removePhysicalElements = false) { if (startPositionBlip != null && startPositionBlip.Exists()) { startPositionBlip.Remove(); startPositionBlip = null; } if (removePhysicalElements) { foreach (Ped ballasPed in ballasPeds) { if (ballasPed != null && ballasPed.Exists()) { ballasPed.Delete(); } } ballasPeds.Clear(); } }
// OnCalloutAccepted is where we begin our callout's logic. In this instance we create our pursuit and add our ped from earlier to the pursuit as well public override bool OnCalloutAccepted() { // We accepted the callout, so lets initialize our blip from before and attach it to our ped so we know where he is. ABlip = Aggressor.AttachBlip(); ABlip2 = Aggressor2.AttachBlip(); B1 = Victim.AttachBlip(); B1.Color = Color.Orange; Game.DisplaySubtitle("Get to the ~r~pursuit~w~.", 6500); this.pursuit = Functions.CreatePursuit(); Functions.AddPedToPursuit(pursuit, Aggressor); Functions.AddPedToPursuit(pursuit, Aggressor2); Functions.RequestBackup(SpawnPoint, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.LocalUnit); Functions.RequestBackup(SpawnPoint, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.LocalUnit); Functions.RequestBackup(SpawnPoint, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.AirUnit); return(base.OnCalloutAccepted()); }
private void Load() { try { michaelsAccount = JsonConvert.DeserializeObject <BankAccount>(File.ReadAllText(michaelsBank)); franklinsAccount = JsonConvert.DeserializeObject <BankAccount>(File.ReadAllText(franklinsBank)); trevorsAccount = JsonConvert.DeserializeObject <BankAccount>(File.ReadAllText(trevorsBank)); globalAccount = JsonConvert.DeserializeObject <BankAccount>(File.ReadAllText(globalBank)); configuration = JsonConvert.DeserializeObject <Configuration>(File.ReadAllText(modConfig)); foreach (Bank bank in configuration.banks) { Vector3 bankPos = new Vector3(bank.XPos, bank.YPos, bank.ZPos); Blip blp = World.CreateBlip(bankPos); blp.IsShortRange = true; blp.Sprite = BlipSprite.Store; blp.Color = BlipColor.Green; if (bank.typeOfBank == BankType.fleeca) { blp.Name = "Fleeca Bank"; } else if (bank.typeOfBank == BankType.blaineCounty) { blp.Name = "Blaine County Bank"; } else if (bank.typeOfBank == BankType.pacificStandard) { blp.Name = "Pacific Standard Bank"; } blips.Add(blp); if (configuration.settings.showDebugMessages) { UI.Notify($"DEBUG: Banco de carregamento: {bank.typeOfBank.ToString()} at {bankPos.ToString()}"); } } } catch (Exception ex) { UI.Notify($"Ocorreu um erro: {ex.Message}"); } }
/// <summary> /// Toggles blips on/off. /// </summary> /// <param name="enable"></param> private void ToggleBlips(bool enable) { if (enable) { try { foreach (var bl in vMenuShared.ConfigManager.GetLocationBlipsData()) { int blipID = AddBlipForCoord(bl.coordinates.X, bl.coordinates.Y, bl.coordinates.Z); SetBlipSprite(blipID, bl.spriteID); BeginTextCommandSetBlipName("STRING"); AddTextComponentSubstringPlayerName(bl.name); EndTextCommandSetBlipName(blipID); SetBlipColour(blipID, bl.color); SetBlipAsShortRange(blipID, true); Blip b = new Blip(bl.coordinates, bl.spriteID, bl.name, bl.color, blipID); blips.Add(b); } } catch (JsonReaderException ex) { Debug.Write($"\n\n[vMenu] 加載locations.json文件時發生錯誤。 請與服務器服主聯繫以解決此問題。請提供以下錯誤詳細信息:\n{ex.Message}.\n\n\n"); } } else { if (blips.Count > 0) { foreach (Blip blip in blips) { int id = blip.blipID; if (DoesBlipExist(id)) { RemoveBlip(ref id); } } } blips.Clear(); } }
//Use this for cathing the KeyUp Event void OnKeyUp(object sender, KeyEventArgs e) { //Set SpawnPos for Team A if (e.KeyCode == Keys.H) { //A Reference to the Player Ped player = Game.Player.Character; //Use this for one meter in front of the player //spawnLoc = player.Position + (player.ForwardVector * 1); //Define the playerpos as the spawnpos for the team spawnLocA = player.Position; //notice that location is defined IsSpawnLocADefined = true; //A Blip for the spawn pos Blip blip = World.CreateBlip(spawnLocA, 1.5f); blip.Color = BlipColor.Red; blip.Scale = 5f; UI.Notify("Point A is ready"); } //Set SpawnPos for Team B if (e.KeyCode == Keys.J) { //for code comments see a few lines up Ped player = Game.Player.Character; spawnLocB = player.Position; IsSpawnLocBDefined = true; Blip blip = World.CreateBlip(spawnLocB, 1.5f); blip.Color = BlipColor.Yellow; blip.Scale = 5f; //feedback UI.Notify("Point B is ready"); } }
/// <summary> /// Toggles blips on/off. /// </summary> /// <param name="enable"></param> private void ToggleBlips(bool enable) { if (enable) { try { foreach (var bl in vMenuShared.ConfigManager.GetLocationBlipsData()) { int blipID = AddBlipForCoord(bl.coordinates.X, bl.coordinates.Y, bl.coordinates.Z); SetBlipSprite(blipID, bl.spriteID); BeginTextCommandSetBlipName("STRING"); AddTextComponentSubstringPlayerName(bl.name); EndTextCommandSetBlipName(blipID); SetBlipColour(blipID, bl.color); SetBlipAsShortRange(blipID, true); Blip b = new Blip(bl.coordinates, bl.spriteID, bl.name, bl.color, blipID); blips.Add(b); } } catch (JsonReaderException ex) { Debug.Write($"\n\n[vMenu] An error occurred while loading the locations.json file. Please contact the server owner to resolve this.\nWhen contacting the owner, provide the following error details:\n{ex.Message}.\n\n\n"); } } else { if (blips.Count > 0) { foreach (Blip blip in blips) { int id = blip.blipID; if (DoesBlipExist(id)) { RemoveBlip(ref id); } } } blips.Clear(); } }
public void CreateBlip() { CallBlip = new Blip(CalloutPosition); CallBlip.Color = System.Drawing.Color.LimeGreen; CallBlip.EnableRoute(System.Drawing.Color.LimeGreen); }
public override async Task Initialize() { Debug.WriteLine("Trying to get that ped!"); var ped = await Entities.GetOrCreate<Ped>("test", "ig_dwayne", new Vector3(21.001f, -40.001f, 15.001f), 0.0f); Entities.SetControlTask(ped, async ped_ => { if (!ped_.IsAlive) { Debug.WriteLine("ped dead, die objective"); CompleteObjective(); await TryDefuse(); } }); m_blip = Blip.AddBlip(ped); m_blip.Friendly = true; ped.Health = 400; Entities.SetPedTask(ped, 117, Natives.TASK_GUARD_CURRENT_POSITION, 15.0f, 10.0f, 99999999); }
void OnTick(object sender, EventArgs e) { var res = UIMenu.GetScreenResolutionMantainRatio(); var safe = UIMenu.GetSafezoneBounds(); //const int interval = 45; //new UIResText(race_phase.ToString(), new Point((Convert.ToInt32(res.Width) - safe.X)/2, (Convert.ToInt32(res.Height) - safe.Y)/6), 0.5f, Color.White, GTA.Font.ChaletLondon, UIResText.Alignment.Centered).Draw(); if (race_phase == "Race In Progress" || race_phase == "Race CountDown") { Function.Call(GTA.Native.Hash.SET_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME, 0.2f); World.DrawMarker(MarkerType.CheckeredFlagRect, FinishLine + new Vector3(0, 0, 15), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(5f, 5f, 5f), Color.White, true, false, 0, true, "", "", false); World.DrawMarker(MarkerType.UpsideDownCone, FinishLine + new Vector3(0, 0, 10), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(5f, 5f, 5f), Color.Yellow, false, false, 0, false, "", "", false); } //World.DrawMarker(MarkerType.UpsideDownCone, Game.Player.Character.Position + new Vector3(0, 0, 2), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(5f, 5f, 5f), Color.Yellow, false, false, 0, false, "", "", false); if (race_phase == "Race Setup" || race_phase == "Race In Progress") { if (money_bet != 0) { //new UIResText("LAP", new Point(Convert.ToInt32(res.Width) - safe.X - 180, Convert.ToInt32(res.Height) - safe.Y - (90 + (3 * interval))), 0.3f, Color.White).Draw(); new UIResText("Money Bet: ~g~" + money_bet + "$", new Point(Convert.ToInt32(res.Width) - safe.X - 10, Convert.ToInt32(res.Height) - safe.Y - 165), 0.3f, Color.White, GTA.Font.ChaletLondon, UIResText.Alignment.Right).Draw(); new Sprite("timerbars", "all_black_bg", new Point(Convert.ToInt32(res.Width) - safe.X - 248, Convert.ToInt32(res.Height) - safe.Y - 165), new Size(250, 27), 0f, Color.FromArgb(200, 255, 255, 255)).Draw(); } if (CanWeUse(Game.Player.Character.CurrentVehicle) && CanWeUse(CarChallenged)) { new UIResText(Game.Player.Character.CurrentVehicle.FriendlyName + " Vs ~b~" + CarChallenged.FriendlyName + "", new Point(Convert.ToInt32(res.Width) - safe.X - 10, Convert.ToInt32(res.Height) - safe.Y - 135), 0.4f, Color.White, GTA.Font.ChaletLondon, UIResText.Alignment.Right).Draw(); new Sprite("timerbars", "all_black_bg", new Point(Convert.ToInt32(res.Width) - safe.X - 248, Convert.ToInt32(res.Height) - safe.Y - 135), new Size(250, 37), 0f, Color.FromArgb(200, 255, 255, 255)).Draw(); } } if (race_phase != "Not Racing" && (!Game.Player.Character.IsInVehicle() || PedChallenged.IsDead)) { race_phase = "Not Racing"; if (PedChallenged.IsDead) { UI.ShowSubtitle("~r~Race canceled: Challenged driver is dead."); } if (!Game.Player.Character.IsInVehicle()) { UI.ShowSubtitle("~r~Race canceled."); } if (Game.Player.Money >= money_bet) { Game.Player.Money = Game.Player.Money - money_bet; } else { Game.Player.Money = 0; } PedChallenged.Money = PedChallenged.Money + money_bet; if (PedChallenged.Money > 500) { PedChallenged.Task.CruiseWithVehicle(CarChallenged, 40f, (int)DrivingStyle.AvoidTrafficExtremely); } else { PedChallenged.Task.CruiseWithVehicle(CarChallenged, 20f, (int)DrivingStyle.Normal); } ClearCarAndPed(); } if (race_phase == "Not Racing") { if (Game.Player.Character.IsInVehicle() && (Game.Player.Character.CurrentVehicle.IsInBurnout() || GTA.Native.Function.Call<bool>(GTA.Native.Hash.IS_PLAYER_PRESSING_HORN, Game.Player)) && !Game.Player.Character.CurrentVehicle.SirenActive ) { racetrigger++; } else { racetrigger = 0; } if (racetrigger > 25) { PedChallenged = null; CarChallenged = null; var IsAllOk = false; var nearbyCars = World.GetNearbyVehicles(Game.Player.Character.Position, 8); for (int i = 0; i < nearbyCars.Length; i++) { if (nearbyCars[i].GetPedOnSeat(VehicleSeat.Driver) != Game.Player.Character && i < 2) { CarChallenged = nearbyCars[i]; } } if (CanWeUse(CarChallenged)) { if (!CarChallenged.IsSeatFree(VehicleSeat.Driver)) { if (CarChallenged.GetPedOnSeat(VehicleSeat.Driver) != Game.Player.Character) { UI.Notify("Impromptu race started"); PedChallenged = CarChallenged.GetPedOnSeat(VehicleSeat.Driver); GTA.Native.Function.Call(GTA.Native.Hash.SET_VEHICLE_BURNOUT, CarChallenged, false); GTA.Native.Function.Call(GTA.Native.Hash.SET_VEHICLE_HANDBRAKE, CarChallenged, false); IsAllOk = true; } } else { UI.Notify("The owner heard you."); PedChallenged = GTA.World.CreatePed("a_m_y_motox_02", World.GetNextPositionOnStreet(Game.Player.Character.Position.Around(50))); IsAllOk = true; } if (IsAllOk == true) { //UI.Notify(PedChallenged.Money.ToString()); if (PedChallenged.Money < 50) { PedChallenged.Money = PedChallenged.Money + GetRandomInt(100, 200); } PedChallenged.AlwaysKeepTask = true; money_bet = 0; GTA.Native.Function.Call(GTA.Native.Hash.SET_VEHICLE_HANDBRAKE, CarChallenged, false); CarChallenged.RollDownWindow(VehicleWindow.FrontLeftWindow); CarChallenged.IsPersistent = true; CarChallenged.NeedsToBeHotwired = false; PedChallenged.AddBlip(); PedChallenged.CurrentBlip.Color = BlipColor.Blue; PedChallenged.CanBeKnockedOffBike = false; Function.Call(GTA.Native.Hash.SET_PED_STEERS_AROUND_OBJECTS, PedChallenged, true); Function.Call(GTA.Native.Hash.SET_PED_STEERS_AROUND_VEHICLES, PedChallenged, true); Function.Call(GTA.Native.Hash.SET_PED_STEERS_AROUND_PEDS, PedChallenged, true); Function.Call(GTA.Native.Hash.SET_DRIVER_ABILITY, PedChallenged, 1.0); Function.Call(GTA.Native.Hash.SET_DRIVER_AGGRESSIVENESS, PedChallenged, 1.0); Function.Call(GTA.Native.Hash.SET_PED_FLEE_ATTRIBUTES, PedChallenged, 0, 0); Function.Call(GTA.Native.Hash.TASK_SET_BLOCKING_OF_NON_TEMPORARY_EVENTS, PedChallenged, true); var ParkingPos = Game.Player.Character.Position; race_phase = "Race Setup"; UI.Notify("Place your bets with + and -."); } } } } if (race_phase == "Race Setup") { //UI.Notify(race_phase); if (parking_side == "right") { ParkingPos = Game.Player.Character.Position + ((Game.Player.Character.RightVector * parking_side_distance) + (Game.Player.Character.ForwardVector)); } else { ParkingPos = Game.Player.Character.Position + ((Game.Player.Character.RightVector * -parking_side_distance) + (Game.Player.Character.ForwardVector)); } if (!PedChallenged.IsInVehicle()) { UI.ShowSubtitle("Wait for the owner to get in the ~b~" + CarChallenged.FriendlyName + ".", 5000); if (fast_start == true) { PedChallenged.SetIntoVehicle(CarChallenged, VehicleSeat.Driver); } else if (PedChallenged.IsStopped && DateTime.Now.Subtract(GetIntoVehicleTimeout).TotalSeconds > 1f) { PedChallenged.Task.DriveTo(CarChallenged, ParkingPos, 5, 20, (int)DrivingStyle.Normal); GetIntoVehicleTimeout = DateTime.Now; } } if (PedChallenged.IsInVehicle() && DateTime.Now.Subtract(FollowToStartLineTimeout).TotalSeconds > 0.2f) { if (CarChallenged.IsInRangeOf(ParkingPos, 1.5f)) { //CarChallenged.FreezePosition = true; CarChallenged.FreezePosition = true; UI.ShowSubtitle("The ~b~" + PedChallenged.CurrentVehicle.FriendlyName + "~w~ is in position. Press your horn when you're ready.", 1000); //PedChallenged.Task.ClearAll(); if (Game.Player.Character.CurrentVehicle.IsInBurnout() || GTA.Native.Function.Call<bool>(GTA.Native.Hash.IS_PLAYER_PRESSING_HORN, Game.Player)) { race_phase = "Race CountDown"; } } if (!CarChallenged.IsInRangeOf(ParkingPos, 1.5f)) { UI.ShowSubtitle("Wait for he ~b~" + PedChallenged.CurrentVehicle.FriendlyName + "~w~ in a starting position of your choice", 1000); CarChallenged.FreezePosition = false; if (Game.Player.Character.CurrentVehicle.IsStopped) { if (CarChallenged.IsStopped) { PedChallenged.Task.ParkVehicle(CarChallenged, ParkingPos, Game.Player.Character.Heading); } } else { GTA.Native.Function.Call(GTA.Native.Hash.TASK_VEHICLE_ESCORT, PedChallenged, CarChallenged, Game.Player.Character.CurrentVehicle, -1, 130.0, (int)DrivingStyle.Rushed, 2f, 2f, 10f); } } FollowToStartLineTimeout = DateTime.Now; } if (race_phase == "Race CountDown") { if (Function.Call<bool>(Hash.IS_WAYPOINT_ACTIVE)) { FinishLine = World.GetNextPositionOnStreet(Function.Call<Vector3>(Hash.GET_BLIP_COORDS, Function.Call<Blip>(Hash.GET_FIRST_BLIP_INFO_ID, 8))); if (FinishLine == new Vector3(0, 0, 0) || FinishLine.Z == 1) { UI.Notify("~r~ERROR\n~w~Waypoint vector invalid\nRandom finish selected"); FinishLine = World.GetNextPositionOnStreet(Game.Player.Character.Position + Game.Player.Character.ForwardVector * random_finish_distance); } FinishLineBlip = World.CreateBlip(FinishLine); FinishLineBlip.Sprite = BlipSprite.Race; FinishLineBlip.IsFlashing = true; } else { FinishLine = World.GetNextPositionOnStreet(Game.Player.Character.Position + Game.Player.Character.ForwardVector * random_finish_distance); FinishLineBlip = World.CreateBlip(FinishLine); FinishLineBlip.Sprite = BlipSprite.Race; FinishLineBlip.IsFlashing = true; } if (show_path_to_finish == true) { FinishLineBlip.ShowRoute = true; } CarChallenged.FreezePosition = true; Game.Player.Character.CurrentVehicle.FreezePosition = true; Script.Wait(1000); UI.ShowSubtitle("Race the ~b~" + PedChallenged.CurrentVehicle.FriendlyName + "~w~ to the ~y~finish line.", 5000); PedChallenged.CurrentVehicle.SoundHorn(500); Script.Wait(1000); PedChallenged.CurrentVehicle.SoundHorn(500); Script.Wait(1000); PedChallenged.CurrentVehicle.SoundHorn(500); Script.Wait(500); //PedChallenged.Task.DriveTo(CarChallenged, FinishLine, 5, 300, 416|32); if (reckless_racing == true) { // mode 1 drives near coord, 2 no arranca, 3 no existe, 4 no idea,5 no idea,6 no idea,7 no arranca, 8 no arranca, 9 no existe,10 no arranca,11 no arranca, 12 no arranca,13 no arranca,14 se desliza mas?,15 no idea,16 va mas cuidadoso,17 no idea,18 brakes on police?,19 crashes the game,20 weird "freeze" driver thing //Function.Call(Hash.TASK_VEHICLE_MISSION_COORS_TARGET, PedChallenged.Handle, CarChallenged.Handle, FinishLine.X, FinishLine.Y, FinishLine.Z, 20, 200f, (int)DrivingStyle.AvoidTraffic, 1.0,-1.0, 1); //Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD, PedChallenged.Handle, CarChallenged.Handle, FinishLine.X, FinishLine.Y, FinishLine.Z, 500.0, 0, CarChallenged.Model, 6, 0.5, 15.0); Function.Call(Hash.TASK_VEHICLE_MISSION_COORS_TARGET, PedChallenged.Handle, CarChallenged.Handle, FinishLine.X, FinishLine.Y, FinishLine.Z, 4, 120f, 4 | 16 | 32, 5f, 10f, 0); //Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD_LONGRANGE, PedChallenged.Handle, CarChallenged.Handle, FinishLine.X, FinishLine.Y, FinishLine.Z, 70.0f, 786469, 10.0); } else { PedChallenged.Task.DriveTo(CarChallenged, FinishLine, 5, 100f, (int)DrivingStyle.AvoidTrafficExtremely); } Script.Wait(500); CarChallenged.FreezePosition = false; Game.Player.Character.CurrentVehicle.FreezePosition = false; PedChallenged.CurrentVehicle.SoundHorn(1000); race_phase = "Race In Progress"; if (GetRandomInt(0, 2)==1 && cops_enabled==true) { CopChase = 1; CopsMoveIn(); CopsMoveIn(); } } } if (race_phase == "Race In Progress") { if (Game.Player.Character.Velocity.Y > 40f && Game.Player.WantedLevel<1 && CopChase==1) { Game.Player.WantedLevel = 1; } if (PedChallenged.Position.DistanceTo(FinishLine) < 20 || Game.Player.Character.Position.DistanceTo(FinishLine) < 20) { if (PedChallenged.Position.DistanceTo(FinishLine) < Game.Player.Character.Position.DistanceTo(FinishLine)) { UI.Notify("The ~b~" + PedChallenged.CurrentVehicle.FriendlyName + "~w~ won!"); if (Game.Player.Money >= money_bet) { Game.Player.Money = Game.Player.Money - money_bet; } else { Game.Player.Money = 0; } PedChallenged.Money = PedChallenged.Money + money_bet; if (PedChallenged.Money > 500) { PedChallenged.Task.CruiseWithVehicle(CarChallenged, 40f, (int)DrivingStyle.AvoidTrafficExtremely); } else { PedChallenged.Task.CruiseWithVehicle(CarChallenged, 20f, (int)DrivingStyle.Normal); } } else { if (PedChallenged.Money >= money_bet) { PedChallenged.Money = PedChallenged.Money - money_bet; } else { PedChallenged.Money = 0; } Game.Player.Money = Game.Player.Money + money_bet; UI.Notify("You won!"); PedChallenged.Task.CruiseWithVehicle(CarChallenged, 20f, (int)DrivingStyle.Normal); } ClearCarAndPed(); } } }
void Ontick(object sender, EventArgs e) { // prisoner groupe 2124571506 // garde groupe -183807561 // police groupe -1533126372 // SOLARITe 1651,726 : 2568,254 : 51,51672 :=> 348,7881 // 1 1858,746 : 2609,113 : 45,29342 // 2 1831,064 : 2607,884 : 45,20006 // 3 1754,864 : 2605,129 : 45,18484 if (Function.Call<bool>(Hash.IS_PLAYER_BEING_ARRESTED, Game.Player, true)) { hours = 20; intial1(); } #region escape if (escape) { roit.Remove(); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); if (Game.Player.Character.IsInVehicle()) { if (Game.Player.Character.CurrentVehicle == help_veh) { bail.Remove(); if (Game.Player.WantedLevel == 0) { GTA.UI.ShowSubtitle("you have escape", 1000); escape = false; escape_Ped.MarkAsNoLongerNeeded(); help_veh.MarkAsNoLongerNeeded(); arrested = false; } else GTA.UI.ShowSubtitle("escape the police", 10); } else { GTA.UI.ShowSubtitle("get to the ~b~ MAVERICK", 10); bail.Remove(); bail = World.CreateBlip(help_veh.Position); bail.Color = BlipColor.Blue; bail.ShowRoute = true; } } else { GTA.UI.ShowSubtitle("get to the ~b~ MAVERICK", 10); bail.Remove(); bail = World.CreateBlip(help_veh.Position); bail.Color = BlipColor.Blue; bail.ShowRoute = true; } if (Game.Player.IsDead) { escape = false; arrested = false; bail.Remove(); help_veh.MarkAsNoLongerNeeded(); } } #endregion //================================================================================================================================================= if (arrested) { Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); } if (inprison) { Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); if (Game.Player.Character.Position.DistanceTo(new Vector3(1752.894f, 2592.242f, 45.56502f)) < 1f) { arrested = true; escape = false; Function.Call(Hash.ENABLE_ALL_CONTROL_ACTIONS, 1); Game.FadeScreenOut(2500); Game.Player.Character.Position = new Vector3(1617.643f, 2523.981f, 45.56489f); clothes_changer(); Game.Player.CanControlCharacter = true; Function.Call(Hash.SET_ENABLE_HANDCUFFS, Game.Player.Character, false); Function.Call(Hash.SET_ENABLE_BOUND_ANKLES, Game.Player.Character, false); Game.FadeScreenIn(2500); int group = 2124571506; int player_group = Function.Call<int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, Game.Player.Character); Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Pedestrians, group, player_group); Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Pedestrians, player_group, group); Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, 1, group, player_group); bail = World.CreateBlip(new Vector3(1691.709f, 2565.036f, 45.56487f)); bail.Color = BlipColor.White; Function.Call(Hash.SET_CLOCK_TIME, 13, 00, 0); roit = World.CreateBlip(escape_Ped.Position); roit.Sprite = BlipSprite.DollarSign; _headsup = new UIText("Time: ~b~" + hours + ":" + minit, new Point(2, 520), 0.7f, Color.WhiteSmoke, GTA.Font.HouseScript, false); _headsupRectangle = new UIRectangle(new Point(0, 520), new Size(215, 65), Color.FromArgb(100, 0, 0, 0)); inprison = false; } if (Game.Player.Character.Position.DistanceTo(new Vector3(1754.864f, 2605.129f, 45.18484f)) < 5f) { Game.Player.Character.Task.GoTo(new Vector3(1752.894f, 2592.242f, 45.56502f)); } } if (testt) { Function.Call(Hash.DISABLE_ALL_CONTROL_ACTIONS, 1); if (open1) { int t = Function.Call<int>(Hash.GET_HASH_KEY, "prop_gate_prison_01"); Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1845.0f, 2605.0f, 45.0f, 0, 0.0f, 50.0f, 0f); } else { int t = Function.Call<int>(Hash.GET_HASH_KEY, "prop_gate_prison_01"); Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1845.0f, 2605.0f, 45.0f, 1, 0.0f, 50.0f, 0f); } if (open2) { int t = Function.Call<int>(Hash.GET_HASH_KEY, "prop_gate_prison_01"); Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1819.27f, 2608.53f, 44.61f, 0, 0.0f, 50.0f, 0f); } else { int t = Function.Call<int>(Hash.GET_HASH_KEY, "prop_gate_prison_01"); Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1819.27f, 2608.53f, 44.61f, 1, 0.0f, 50.0f, 0f); } if (Game.Player.Character.Position.DistanceTo(new Vector3(1855.855f, 2606.756f, 45.9304f)) < 4f) { open1 = true; open2 = false; } if (Game.Player.Character.Position.DistanceTo(new Vector3(1831.152f, 2606.738f, 45.83254f)) < 3f && open1) { open1 = false; open2 = true; Game.Player.WantedLevel = 0; Function.Call(Hash.SET_MAX_WANTED_LEVEL, 0); } if (Game.Player.Character.Position.DistanceTo(new Vector3(1754.018f, 2604.271f, 45.82404f)) < 4f && open2) { open1 = false; open2 = false; testt = false; Game.Player.WantedLevel = 0; Function.Call(Hash.SET_MAX_WANTED_LEVEL, 0); inprison = true; } Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); } if (arrested) { if (Game.Player.Character.IsDead) Function.Call(Hash.SET_MAX_WANTED_LEVEL, 5); Function.Call(Hash.SET_MAX_WANTED_LEVEL, 0); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); Function.Call(Hash.STOP_ALARM, "PRISON_ALARMS", 0); Function.Call(Hash.CLEAR_AMBIENT_ZONE_STATE, "AZ_COUNTRYSIDE_PRISON_01_ANNOUNCER_GENERAL", 0); Function.Call(Hash.CLEAR_AMBIENT_ZONE_STATE, "AZ_COUNTRYSIDE_PRISON_01_ANNOUNCER_WARNING", 0); int hh = Function.Call<int>(Hash.GET_CLOCK_HOURS); int mm = Function.Call<int>(Hash.GET_CLOCK_MINUTES); if (hh == 14 && mm == 0) { Function.Call(Hash.SET_CLOCK_TIME, 13, 00, 0); } if (mm == 0 && !hhh ) { minit = 00; hours -= 1; hhh = true; } else if (mm>0) { minit = 60 - mm; hhh = false; } test = World.GetNearbyPeds(Game.Player.Character,150f); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); for (int i = 0; i < test.Length; i++) { Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); if (Function.Call<int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, test[i]) == 2124571506 || Function.Call<int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, test[i]) == -86095805) { bool trouve = false; for (int m = 0; m < prisoner.Count; m++) if (prisoner[m] == test[i]) { trouve = true; break; } if (!trouve) prisoner.Add(test[i]); } else if (Function.Call<int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, test[i]) == -183807561) { bool trouve = false; for (int m = 0; m < garde.Count; m++) if (garde[m] == test[i]) { trouve = true; break; } if (!trouve) garde.Add(test[i]); } Ped[] test2 = World.GetNearbyPeds(test[i], 150f); for (int j = 0 ;j<test2.Length;j++) { Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); if (Function.Call<int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, test2[j]) == 2124571506 || Function.Call<int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, test2[j]) == -86095805) { bool trouve = false; for (int m = 0; m < prisoner.Count; m++) if (prisoner[m] == test2[j]) { trouve = true; break; } if (!trouve) prisoner.Add(test2[j]); } else if (Function.Call<int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, test2[j]) == -183807561) { bool trouve = false; for (int m = 0; m < garde.Count; m++) if (garde[m] == test2[j]) { trouve = true; break; } if (!trouve) garde.Add(test2[j]); } } } //=================================================================================================== Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); _headsup = new UIText("Time: ~b~" + hours + ":" + minit, new Point(2, 520), 0.7f, Color.WhiteSmoke, GTA.Font.ChaletComprimeCologne, false); _headsupRectangle = new UIRectangle(new Point(0, 520), new Size(215, 65), Color.FromArgb(100, 0, 0, 0)); _headsup.Draw(); _headsupRectangle.Draw(); if (Game.Player.Character.Position.DistanceTo(new Vector3(1691.709f, 2565.036f, 45.56487f)) < 2f) { GTA.UI.Notify("press [E] to bail : ~g~ " + 5000000 + "~w~$"); } else if (Game.Player.Character.Position.DistanceTo(new Vector3(1625.474f, 2491.485f, 45.62026f)) < 4f) { GTA.UI.Notify("press [E] to escape for : ~g~ " + 5000000 + "~w~$"); GTA.UI.Notify("press [Y] to make roit for : ~g~ " + 5000000 + "~w~$"); } if( hours == 0 && minit == 0) { bail.Remove(); Game.Player.Character.Position = new Vector3(1849.555f, 2586.085f, 45.67202f); Game.Player.Character.Heading = 258.4564f; Function.Call(Hash.SET_MAX_WANTED_LEVEL, 5); Function.Call(Hash.PAUSE_CLOCK, false); arrested = false; _headsup = null; _headsupRectangle = null; } } }
void intial() { Game.Player.WantedLevel = 0; Game.Player.Character.Weapons.RemoveAll(); Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Hate, 2124571506, -183807561); Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Hate, -183807561, 2124571506); Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Pedestrians, 2124571506, -183807561); Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Pedestrians, -183807561, 2124571506); escape_Ped = World.CreatePed(PedHash.Prisoner01, new Vector3(1625.474f, 2491.485f, 45.62026f)); escape_Ped.Task.StandStill(-1); escape_Ped.Heading = 320.5151f; Function.Call(Hash.SET_ENTITY_AS_MISSION_ENTITY, escape_Ped, true, true); Game.Player.WantedLevel = 0; Function.Call(Hash.SET_MAX_WANTED_LEVEL, 0); Game.Player.Character.Task.PlayAnimation("RANDOM@ARRESTS", "idle_2_hands_up", 2f, -1, false, 0); Script.Wait(500); Game.FadeScreenIn(2500); // while (Function.Call<bool>(Hash.IS_ENTITY_PLAYING_ANIM, Game.Player.Character, "RANDOM@ARRESTS", "idle_2_hands_up", 3)) Script.Wait(0); while (!Function.Call<bool>(Hash.IS_SCREEN_FADED_OUT)) Script.Wait(0); Game.FadeScreenIn(0); int group = 2124571506; int player_group = Function.Call<int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, Game.Player.Character); Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Pedestrians, group, player_group); Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Pedestrians, player_group, group); Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, 1, group, player_group); // Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, 1, player_group, group); // Function.Call(Hash.CLEAR_AREA_OF_PEDS, 1637.856f, 2608.986f, 45.56487f, 1000f, true); clothes_changer(); bail = World.CreateBlip(new Vector3(1691.709f, 2565.036f, 45.56487f)); bail.Color = BlipColor.White; Function.Call(Hash.SET_CLOCK_TIME, 13, 00, 0); roit = World.CreateBlip(escape_Ped.Position); roit.Sprite = BlipSprite.DollarSign; _headsup = new UIText("Time: ~b~" + hours + ":" + minit, new Point(2, 520), 0.7f, Color.WhiteSmoke, GTA.Font.HouseScript, false); _headsupRectangle = new UIRectangle(new Point(0, 520), new Size(215, 65), Color.FromArgb(100, 0, 0, 0)); _headsup.Draw(); _headsupRectangle.Draw(); arrested = true; escape = false; Game.Player.Character.Position = new Vector3(1617.643f, 2523.981f, 45.56489f); Game.FadeScreenOut(1); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); Game.Player.Character.Heading = 264.718f; Game.FadeScreenOut(0); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); Game.FadeScreenIn(3000); }
void Onkeyup(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F12 && Game.Player.WantedLevel > 1) { hours = 10 + Game.Player.WantedLevel *10; Game.Player.WantedLevel = 0; intial1(); } /* if (e.KeyCode == Keys.F11) { Ped[] test = World.GetNearbyPeds(Game.Player.Character, 100f); int player_group = Function.Call<int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, test[0]); GTA.UI.ShowSubtitle(player_group + " "); } */ if (e.KeyCode == Keys.E && arrested) { if (Game.Player.Character.Position.DistanceTo(new Vector3(1691.709f, 2565.036f, 45.56487f))<2f) { // bail if (Game.Player.Money > 5000000) { bail.Remove(); roit.Remove(); Game.Player.Character.Position = new Vector3(1849.555f, 2586.085f, 45.67202f); Game.Player.Character.Heading = 258.4564f; Game.Player.Money -= 5000000; Function.Call(Hash.SET_MAX_WANTED_LEVEL, 5); Function.Call(Hash.SET_PED_DEFAULT_COMPONENT_VARIATION, Game.Player.Character); arrested = false; _headsup = null; _headsupRectangle = null; } else { } } if (Game.Player.Character.Position.DistanceTo(new Vector3(1625.474f, 2491.485f, 45.62026f)) < 4f && !escape) { Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); bail.Remove(); roit.Remove(); Game.Player.Money -= 5000000; Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); // 182.3307f , -885.7198f , 31.11671f :=> 51.15437f Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); // -1083,942 : -2915,736 : 13,23366 :=> 285,5021 if (help_veh == null) help_veh = World.CreateVehicle(VehicleHash.Maverick, new Vector3(1649.463f, 2619.634f, 45.56486f)); else { help_veh.Delete(); help_veh = World.CreateVehicle(VehicleHash.Maverick, new Vector3(1649.463f, 2619.634f, 45.56486f)); } Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); Function.Call(Hash.SET_ENTITY_AS_MISSION_ENTITY, help_veh, true, true); help_veh.Heading = 10.83339f; Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); bail = World.CreateBlip(help_veh.Position); bail.Color = BlipColor.Blue; Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); GiveAllWeapons(Game.Player.Character); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); Function.Call(Hash.PAUSE_CLOCK, false); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); arrested = false; _headsup = null; _headsupRectangle = null; Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); Function.Call(Hash.SET_CLOCK_TIME, 13, 00, 0); Function.Call(Hash.SET_MAX_WANTED_LEVEL, 5); Game.Player.WantedLevel = 4; escape = true; } } if (e.KeyCode == Keys.Y && arrested) { // prisoner groupe 2124571506 // garde groupe -183807561 if (Game.Player.Character.Position.DistanceTo(escape_Ped.Position) < 4f ) { for (int i = 0; i < prisoner.Count; i++) { GiveAllWeapons1(prisoner[i]); prisoner[i].CanSwitchWeapons = true; } for (int i = 0; i < garde.Count; i++) { GiveAllWeapons2(garde[i]); garde[i].CanSwitchWeapons = true; } GiveAllWeapons1(Game.Player.Character); Game.Player.Money -= 5000000; Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Hate, 2124571506, -183807561); Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Hate, -183807561, 2124571506); } } if (e.KeyCode == Keys.U) { Function.Call(Hash.ENABLE_ALL_CONTROL_ACTIONS, 1); Game.Player.CanControlCharacter = true; Function.Call(Hash.SET_ENABLE_HANDCUFFS, Game.Player.Character, false); Function.Call(Hash.SET_ENABLE_BOUND_ANKLES, Game.Player.Character, false); } if(e.KeyCode == Keys.Y) Function.Call(Hash.SET_MAX_WANTED_LEVEL, 5); if (e.KeyCode == Keys.F6) { // PBUS // VehicleHash.PBus // 1971.267f , 2635.439f , 46.17389f :=> 120.792f // 1608.376f , 2685.54f , 45.32081f :=> 143.341f testt = true; if (test_veh == null) { test_veh = World.CreateVehicle(VehicleHash.PBus, new Vector3(1971.267f, 2635.439f, 46.17389f)); test_veh.Heading = 120.792f; } else { test_veh.Delete(); test_veh = World.CreateVehicle(VehicleHash.PBus, new Vector3(1971.267f, 2635.439f, 46.17389f)); test_veh.Heading = 120.792f; } if (driver == null) { driver = World.CreatePed(PedHash.Prisguard01SMM, new Vector3(1971.267f, 2635.439f, 46.17389f)); driver.Heading = 120.792f; } else { driver.Delete(); driver = World.CreatePed(PedHash.Prisguard01SMM, new Vector3(1971.267f, 2635.439f, 46.17389f).Around(5f)); driver.Heading = 120.792f; } driver.Task.WarpIntoVehicle(test_veh, VehicleSeat.Driver); // Game.Player.CanControlCharacter = false; Game.Player.Character.Position = new Vector3(1971.267f, 2635.439f, 46.17389f).Around(10f); // Function.Call(Hash.DISABLE_ALL_CONTROL_ACTIONS, 1); Game.Player.Character.Task.WarpIntoVehicle(test_veh, VehicleSeat.Passenger); Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, driver, -1533126372); Function.Call(Hash.SET_PED_AS_COP, driver, true); // 1 1858,746 : 2609,113 : 45,29342 // 2 1831,064 : 2607,884 : 45,20006 // 3 1754,864 : 2605,129 : 45,18484 while (!Game.Player.Character.IsInVehicle(test_veh)) Script.Wait(0); TaskSequence task = new TaskSequence(); // task.AddTask.DriveTo(test_veh, new Vector3(1900.457f, 2609.054f, 46.00166f), 3f, 10f, (int)DrivingStyle.Normal); // task.AddTask.StandStill(5000); task.AddTask.DriveTo(test_veh, new Vector3(1855.855f, 2606.756f, 45.9304f), 3f, 10f, (int)DrivingStyle.Normal); task.AddTask.StandStill(5000); task.AddTask.DriveTo(test_veh, new Vector3(1831.152f, 2606.738f, 45.83254f), 3f, 10f, (int)DrivingStyle.Normal); task.AddTask.StandStill(5000); task.AddTask.DriveTo(test_veh, new Vector3(1754.018f, 2604.271f, 45.82404f), 3f, 10f, (int)DrivingStyle.Normal); task.AddTask.StandStill(50000); driver.Task.PerformSequence(task); task.Close(); // new Vector3(1858.746f, 2609.113f, 45.29342f) // new Vector3(1831.064f, 2607.884f, 45.20006f) // new Vector3(1754.864f, 2605.129f, 45.18484f) // int t = Function.Call<int>(Hash.GET_HASH_KEY,"prop_gate_prison_01"); // Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1845.0f, 2605.0f, 45.0f, 0, 0.0f, 50.0f, 0f); // Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1819.27f, 2608.53f, 44.61f, 0, 0.0f, 50.0f, 0f); } if (e.KeyCode == Keys.O) { Function.Call(Hash.IGNORE_NEXT_RESTART, true); } /* if (e.KeyCode == Keys.O) { int t = Function.Call<int>(Hash.GET_HASH_KEY, "prop_gate_prison_01"); Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1845.0f, 2605.0f, 45.0f, 0, 0.0f, 50.0f, 0f); Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1819.27f, 2608.53f, 44.61f, 0, 0.0f, 50.0f, 0f); } if (e.KeyCode == Keys.P) { int t = Function.Call<int>(Hash.GET_HASH_KEY, "prop_gate_prison_01"); Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1845.0f, 2605.0f, 45.0f, 1, 0.0f, 50.0f, 0f); Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1819.27f, 2608.53f, 44.61f, 1, 0.0f, 50.0f, 0f); } */ }
void ScanForObject() { foreach(Trackable trackable in trackables){ LayerMask mask=1<<trackable.layer; Collider[] objects=Physics.OverlapSphere(Vector3.zero, Mathf.Infinity, mask); List<Blip> tempList=new List<Blip>(); foreach(Blip blip in trackable.objList){ tempList.Add(blip); } foreach(Collider col in objects){ Transform colT=col.transform; bool match=false; foreach(Blip blip in trackable.objList){ if(colT==blip.sourceT){ match=true; break; } } if(!match){ //add to list Transform blipObj=ObjectPoolManager.Spawn(trackable.blipPrefab).transform; blipObj.parent=thisT; Blip blip=new Blip(colT.gameObject, colT, blipObj); tempList.Add(blip); } } //now add everything in the tempList to the actual list trackable.objList=tempList.ToArray(); } }
private void AdvanceStage() { TimerBars = new TimerBars(); CurrentStage++; CurrentObjectives.Clear(); foreach (var veh in CurrentMission.Vehicles.Where(v => v.SpawnAfter == CurrentStage)) { var newv = new Vehicle(Util.RequestModel(veh.ModelHash), veh.Position) { PrimaryColor = Color.FromArgb((int)veh.PrimaryColor.X, (int)veh.PrimaryColor.Y, (int)veh.PrimaryColor.Z), SecondaryColor = Color.FromArgb((int)veh.SecondaryColor.X, (int)veh.SecondaryColor.Y, (int)veh.SecondaryColor.Z), }; newv.Health = veh.Health; newv.Rotation = veh.Rotation; GameFiber.StartNew(delegate { while (IsMissionPlaying && (veh.RemoveAfter == 0 || veh.RemoveAfter > CurrentStage)) { if (veh.FailMissionOnDeath && newv.IsDead) { FailMission(reason: "The vehicle has been destroyed."); } GameFiber.Yield(); } if(newv.IsValid()) newv.Delete(); }); } foreach (var veh in CurrentMission.Objectives.OfType<SerializableVehicleObjective>().Where(v => v.SpawnAfter == CurrentStage)) { var newv = new Vehicle(Util.RequestModel(veh.ModelHash), veh.Position) { PrimaryColor = Color.FromArgb((int)veh.PrimaryColor.X, (int)veh.PrimaryColor.Y, (int)veh.PrimaryColor.Z), SecondaryColor = Color.FromArgb((int)veh.SecondaryColor.X, (int)veh.SecondaryColor.Y, (int)veh.SecondaryColor.Z), }; newv.Health = veh.Health; newv.Rotation = veh.Rotation; var hasActivated = false; if (veh.ActivateAfter == CurrentStage) { CurrentObjectives.Add(veh); hasActivated = true; } GameFiber.StartNew(delegate { if(!hasActivated) { while (CurrentStage != veh.ActivateAfter && IsMissionPlaying) { GameFiber.Yield(); } CurrentObjectives.Add(veh); } var blip = newv.AttachBlip(); if(veh.ObjectiveType == 0) { blip.Color = Color.DarkRed; while (!newv.IsDead && IsMissionPlaying) { if (veh.ShowHealthBar) { TimerBars.UpdateValue(newv.Handle.Value.ToString(), veh.Name, true, (100f*newv.Health / veh.Health).ToString("###") + "%"); } GameFiber.Yield(); } TimerBars.UpdateValue(newv.Handle.Value.ToString(), veh.Name, true, "0%"); } if (veh.ObjectiveType == 1) { blip.Color = Color.CornflowerBlue; while (!Game.LocalPlayer.Character.IsInVehicle(newv, false) && IsMissionPlaying) { GameFiber.Yield(); } } CurrentObjectives.Remove(veh); if(blip.IsValid()) blip.Delete(); while (IsMissionPlaying) GameFiber.Yield(); if (newv.IsValid()) newv.Delete(); }); } if (CurrentMission.Spawnpoints.Any(s => s.SpawnAfter == CurrentStage)) { var sp = CurrentMission.Spawnpoints.First(s => s.SpawnAfter == CurrentStage); Game.FadeScreenOut(100, true); Game.LocalPlayer.Character.Position = sp.Position - new Vector3(0,0,1); Game.LocalPlayer.Character.Rotation = sp.Rotation; Game.LocalPlayer.Model = Util.RequestModel(sp.ModelHash); if (sp.WeaponHash != 0) Game.LocalPlayer.Character.GiveNewWeapon(sp.WeaponHash, sp.WeaponAmmo, true); Game.LocalPlayer.Character.Health = sp.Health; Game.LocalPlayer.Character.Armor = sp.Armor; if (sp.SpawnInVehicle) { var vehList = Game.LocalPlayer.Character.GetNearbyVehicles(15).OrderBy(v => (Game.LocalPlayer.Character.Position - v.Position).Length()); Game.LocalPlayer.Character.WarpIntoVehicle(vehList.ToList()[0], sp.VehicleSeat); } Game.FadeScreenIn(500, false); } foreach (var actor in CurrentMission.Actors.Where(v => v.SpawnAfter == CurrentStage)) { GameFiber.StartNew(delegate { var ped = new Ped(Util.RequestModel(actor.ModelHash), actor.Position - new Vector3(0,0,1f), actor.Rotation.Yaw); ped.Rotation = actor.Rotation; ped.Accuracy = actor.Accuracy; var blip = ped.AttachBlip(); blip.Scale = 0.6f; if (actor.WeaponHash != 0) ped.GiveNewWeapon(actor.WeaponHash, actor.WeaponAmmo, true); ped.Health = actor.Health; ped.Armor = actor.Armor; if (actor.RelationshipGroup == 0) { ped.RelationshipGroup = StaticData.RelationshipGroups.Groups[1]; blip.Color = Color.DodgerBlue; NativeFunction.CallByName<uint>("REMOVE_PED_FROM_GROUP", ped.Handle.Value); NativeFunction.CallByName<uint>("SET_PED_AS_GROUP_MEMBER", ped.Handle.Value, NativeFunction.CallByName<int>("GET_PED_GROUP_INDEX", Game.LocalPlayer.Character.Handle.Value)); } else { ped.RelationshipGroup = StaticData.RelationshipGroups.Groups[actor.RelationshipGroup]; if(actor.RelationshipGroup == 4 || actor.RelationshipGroup == 5) blip.Color = Color.DarkRed; } if (actor.SpawnInVehicle) { var vehList = ped.GetNearbyVehicles(15).OrderBy(v => (ped.Position - v.Position).Length()); ped.WarpIntoVehicle(vehList.ToList()[0], actor.VehicleSeat); } ped.BlockPermanentEvents = false; NativeFunction.CallByName<uint>("SET_PED_FIRING_PATTERN", ped.Handle.Value, 0xC6EE6B4C); if (actor.Behaviour == 3) ped.Tasks.FightAgainstClosestHatedTarget(100f); else if (actor.Behaviour == 2) NativeFunction.CallByName<uint>("TASK_GUARD_CURRENT_POSITION", ped.Handle.Value, 15f, 10f, true); else if (actor.Behaviour == 0) ped.Tasks.Clear(); else if (actor.Behaviour == 4) { GameFiber.StartNew(delegate { var wpyList = new List<SerializableWaypoint>(actor.Waypoints); SerializableWaypoint currentWaypoint; if (wpyList.Count > 0) currentWaypoint = wpyList[0]; while (ped.IsValid() && ped.Exists() && ped.IsAlive && IsMissionPlaying && wpyList.Count > 0) { if (wpyList.Count == 0) break; currentWaypoint = wpyList[0]; Task pedTask = null; switch (currentWaypoint.Type) { case WaypointTypes.Drive: if (ped.IsInAnyVehicle(true)) { pedTask = ped.Tasks.DriveToPosition(currentWaypoint.Position, currentWaypoint.VehicleSpeed, (DriveToPositionFlags)currentWaypoint.DrivingStyle); } break; case WaypointTypes.Run: { var heading = 0f; if (wpyList.Count >= 2) { heading = Util.DirectionToRotation(wpyList[1].Position - currentWaypoint.Position) .Z; } pedTask = ped.Tasks.FollowNavigationMeshToPosition(currentWaypoint.Position, heading, 2f, 0.3f, currentWaypoint.Duration == 0 ? -1 : (int)currentWaypoint.Duration); } break; case WaypointTypes.Walk: { var heading = 0f; if (wpyList.Count >= 2) { heading = Util.DirectionToRotation(wpyList[1].Position - currentWaypoint.Position) .Z; } pedTask = ped.Tasks.FollowNavigationMeshToPosition(currentWaypoint.Position, heading, 1f, 0.3f, currentWaypoint.Duration == 0 ? -1 : (int)currentWaypoint.Duration); } break; case WaypointTypes.ExitVehicle: if (ped.IsInAnyVehicle(true)) pedTask = ped.Tasks.LeaveVehicle(LeaveVehicleFlags.None); break; case WaypointTypes.EnterVehicle: Vehicle[] vehs = World.GetAllVehicles().Where(v => { if (v != null && v.IsValid()) return v.Model.Hash == currentWaypoint.VehicleTargetModel; return false; }).OrderBy(v => (v.Position - ped.Position).Length()).ToArray(); if (vehs.Any()) { if ((vehs[0].Position - ped.Position).Length() > 10f) { pedTask = ped.Tasks.FollowNavigationMeshToPosition(vehs[0].Position, 0f, 3f, 5f); pedTask.WaitForCompletion(10000); } var seat = vehs[0].GetFreeSeatIndex(); if (seat.HasValue) pedTask = ped.Tasks.EnterVehicle(vehs[0], seat.Value); } break; case WaypointTypes.Wait: pedTask = ped.Tasks.StandStill(currentWaypoint.Duration); break; case WaypointTypes.Wander: pedTask = ped.Tasks.Wander(); break; case WaypointTypes.Shoot: pedTask = null; NativeFunction.CallByName<uint>("TASK_SHOOT_AT_COORD", ped.Handle.Value, currentWaypoint.Position.X, currentWaypoint.Position.Y, currentWaypoint.Position.Z, currentWaypoint.Duration, 0xC6EE6B4C); GameFiber.Sleep(currentWaypoint.Duration); break; case WaypointTypes.Animation: pedTask = ped.Tasks.PlayAnimation(currentWaypoint.AnimDict, currentWaypoint.AnimName, 8f, AnimationFlags.None); break; } pedTask?.WaitForCompletion(currentWaypoint.Duration == 0 ? -1 : currentWaypoint.Duration); if (wpyList.Count > 0) wpyList.RemoveAt(0); GameFiber.Yield(); } }); } while (IsMissionPlaying && (actor.RemoveAfter == 0 || actor.RemoveAfter > CurrentStage) && !ped.IsDead) { GameFiber.Yield(); } if (actor.FailMissionOnDeath && ped.IsDead) { FailMission(reason: "An ally has died."); } if (blip.IsValid()) blip.Delete(); while(IsMissionPlaying && (actor.RemoveAfter == 0 || actor.RemoveAfter > CurrentStage)) GameFiber.Yield(); if(ped.IsValid()) ped.Delete(); }); } foreach (var o in CurrentMission.Objects.Where(v => v.SpawnAfter == CurrentStage)) { GameFiber.StartNew(delegate { var prop = new Rage.Object(Util.RequestModel(o.ModelHash), o.Position); prop.Position = o.Position; prop.Rotation = o.Rotation; while (IsMissionPlaying && (o.RemoveAfter == 0 || o.RemoveAfter > CurrentStage)) { GameFiber.Yield(); } if(prop.IsValid()) prop.Delete(); }); } foreach (var pickup in CurrentMission.Pickups.Where(v => v.SpawnAfter == CurrentStage)) { GameFiber.StartNew(delegate { var obj = NativeFunction.CallByName<uint>("CREATE_PICKUP_ROTATE", pickup.PickupHash, pickup.Position.X, pickup.Position.Y, pickup.Position.Z, pickup.Rotation.Pitch, pickup.Rotation.Roll, pickup.Rotation.Yaw, 1, pickup.Ammo, 2, 1, 0); int counter = 0; while (IsMissionPlaying && (pickup.RemoveAfter == 0 || pickup.RemoveAfter > CurrentStage)) { var alpha = 40 * (Math.Sin(Util.DegToRad(counter % 180))); Util.DrawMarker(28, pickup.Position, new Vector3(), new Vector3(0.75f, 0.75f, 0.75f), Color.FromArgb((int)alpha, 10, 10, 230)); counter += 5; if (counter >= 360) counter = 0; if ((pickup.Position - Game.LocalPlayer.Character.Position).Length() < 1f && pickup.Respawn) { NativeFunction.CallByName<uint>("REMOVE_PICKUP", obj); while((pickup.Position - Game.LocalPlayer.Character.Position).Length() < 3f) { GameFiber.Yield();} obj = NativeFunction.CallByName<uint>("CREATE_PICKUP_ROTATE", pickup.PickupHash, pickup.Position.X, pickup.Position.Y, pickup.Position.Z, pickup.Rotation.Pitch, pickup.Rotation.Roll, pickup.Rotation.Yaw, 1, pickup.Ammo, 2, 1, 0); } else if ((pickup.Position - Game.LocalPlayer.Character.Position).Length() < 1f && !pickup.Respawn) break; GameFiber.Yield(); } NativeFunction.CallByName<uint>("REMOVE_PICKUP", obj); }); } foreach (var actor in CurrentMission.Objectives.OfType<SerializableActorObjective>().Where(v => v.SpawnAfter == CurrentStage)) { var ped = new Ped(Util.RequestModel(actor.ModelHash), actor.Position - new Vector3(0, 0, 1f), actor.Rotation.Yaw); ped.Rotation = actor.Rotation; ped.Accuracy = actor.Accuracy; if (actor.WeaponHash != 0) ped.GiveNewWeapon(actor.WeaponHash, actor.WeaponAmmo, true); NativeFunction.CallByName<uint>("SET_PED_FIRING_PATTERN", ped.Handle.Value, 0xC6EE6B4C); ped.Health = actor.Health; ped.MaxHealth = actor.Health; ped.Armor = actor.Armor; if (actor.RelationshipGroup == 0) { NativeFunction.CallByName<uint>("REMOVE_PED_FROM_GROUP", ped.Handle.Value); NativeFunction.CallByName<uint>("SET_PED_AS_GROUP_MEMBER", ped.Handle.Value, NativeFunction.CallByName<int>("GET_PED_GROUP_INDEX", Game.LocalPlayer.Character.Handle.Value)); ped.RelationshipGroup = StaticData.RelationshipGroups.Groups[1]; } else { ped.RelationshipGroup = StaticData.RelationshipGroups.Groups[actor.RelationshipGroup]; } if (actor.SpawnInVehicle) { var vehList = ped.GetNearbyVehicles(15).OrderBy(v => (ped.Position - v.Position).Length()); ped.WarpIntoVehicle(vehList.ToList()[0], actor.VehicleSeat); } var hasActivated = false; if (actor.ActivateAfter == CurrentStage) { CurrentObjectives.Add(actor); hasActivated = true; } GameFiber.StartNew(delegate { if(!hasActivated) { while (CurrentStage != actor.ActivateAfter && IsMissionPlaying) { GameFiber.Yield(); } CurrentObjectives.Add(actor); } var blip = ped.AttachBlip(); blip.Scale = 0.6f; blip.Color = Color.DarkRed; ped.BlockPermanentEvents = false; if (actor.Behaviour == 3) ped.Tasks.FightAgainstClosestHatedTarget(100f); else if (actor.Behaviour == 2) NativeFunction.CallByName<uint>("TASK_GUARD_CURRENT_POSITION", ped.Handle.Value, 15f, 10f, true); else if(actor.Behaviour == 0) ped.Tasks.Clear(); else if (actor.Behaviour == 4) { GameFiber.StartNew(delegate { var wpyList = new List<SerializableWaypoint>(actor.Waypoints); SerializableWaypoint currentWaypoint; if(wpyList.Count > 0) currentWaypoint = wpyList[0]; while (ped.IsValid() && ped.Exists() && ped.IsAlive && IsMissionPlaying && wpyList.Count > 0) { if (wpyList.Count == 0) break; currentWaypoint = wpyList[0]; Task pedTask = null; switch (currentWaypoint.Type) { case WaypointTypes.Drive: if (ped.IsInAnyVehicle(true)) { pedTask = ped.Tasks.DriveToPosition(currentWaypoint.Position, currentWaypoint.VehicleSpeed, (DriveToPositionFlags)currentWaypoint.DrivingStyle); } break; case WaypointTypes.Run: { var heading = 0f; if (wpyList.Count >= 2) { heading = Util.DirectionToRotation(wpyList[1].Position - currentWaypoint.Position) .Z; } pedTask = ped.Tasks.FollowNavigationMeshToPosition(currentWaypoint.Position, heading, 2f, 0.3f, currentWaypoint.Duration == 0 ? -1 : (int)currentWaypoint.Duration); } break; case WaypointTypes.Walk: { var heading = 0f; if (wpyList.Count >= 2) { heading = Util.DirectionToRotation(wpyList[1].Position - currentWaypoint.Position) .Z; } pedTask = ped.Tasks.FollowNavigationMeshToPosition(currentWaypoint.Position, heading, 1f, 0.3f, currentWaypoint.Duration == 0 ? -1 : (int)currentWaypoint.Duration); } break; case WaypointTypes.ExitVehicle: if (ped.IsInAnyVehicle(true)) pedTask = ped.Tasks.LeaveVehicle(LeaveVehicleFlags.None); break; case WaypointTypes.EnterVehicle: Vehicle[] vehs = World.GetAllVehicles().Where(v => { if (v != null && v.IsValid()) return v.Model.Hash == currentWaypoint.VehicleTargetModel; return false; }).OrderBy(v => (v.Position - ped.Position).Length()).ToArray(); if (vehs.Any()) { if ((vehs[0].Position - ped.Position).Length() > 10f) { pedTask = ped.Tasks.FollowNavigationMeshToPosition(vehs[0].Position, 0f, 3f, 5f); pedTask.WaitForCompletion(10000); } var seat = vehs[0].GetFreeSeatIndex(); if (seat.HasValue) pedTask = ped.Tasks.EnterVehicle(vehs[0], seat.Value); } break; case WaypointTypes.Wait: pedTask = ped.Tasks.StandStill(currentWaypoint.Duration); break; case WaypointTypes.Wander: pedTask = ped.Tasks.Wander(); break; case WaypointTypes.Shoot: pedTask = null; NativeFunction.CallByName<uint>("TASK_SHOOT_AT_COORD", ped.Handle.Value, currentWaypoint.Position.X, currentWaypoint.Position.Y, currentWaypoint.Position.Z, currentWaypoint.Duration, 0xC6EE6B4C); GameFiber.Sleep(currentWaypoint.Duration); break; case WaypointTypes.Animation: pedTask = ped.Tasks.PlayAnimation(currentWaypoint.AnimDict, currentWaypoint.AnimName, 8f, AnimationFlags.None); break; } pedTask?.WaitForCompletion(currentWaypoint.Duration == 0 ? -1 : currentWaypoint.Duration); if(wpyList.Count > 0) wpyList.RemoveAt(0); GameFiber.Yield(); } }); } while (!ped.IsDead && IsMissionPlaying) { if (actor.ShowHealthBar) { TimerBars.UpdateValue(ped.Handle.Value.ToString(), actor.Name, true, (100f*ped.Health/actor.Health).ToString("###") + "%"); } GameFiber.Yield(); } if (actor.ShowHealthBar) { TimerBars.UpdateValue(ped.Handle.Value.ToString(), actor.Name, true, "0%"); } CurrentObjectives.Remove(actor); if(blip.IsValid()) blip.Delete(); while(IsMissionPlaying) GameFiber.Yield(); if (ped.IsValid()) ped.Delete(); }); } foreach (var pickup in CurrentMission.Objectives.OfType<SerializablePickupObjective>().Where(v => v.ActivateAfter == CurrentStage)) { CurrentObjectives.Add(pickup); GameFiber.StartNew(delegate { var obj = NativeFunction.CallByName<uint>("CREATE_PICKUP_ROTATE", pickup.PickupHash, pickup.Position.X, pickup.Position.Y, pickup.Position.Z, pickup.Rotation.Pitch, pickup.Rotation.Roll, pickup.Rotation.Yaw, 1, pickup.Ammo, 2, 1, 0); var blip = new Blip(pickup.Position); blip.Scale = 0.7f; blip.Color = Color.DodgerBlue; var counter = 0; while ((pickup.Position - Game.LocalPlayer.Character.Position).Length() > 1f && IsMissionPlaying) { var alpha = 40 * (Math.Sin(Util.DegToRad(counter % 180))); Util.DrawMarker(28, pickup.Position, new Vector3(), new Vector3(0.75f, 0.75f, 0.75f), Color.FromArgb((int)alpha, 230, 10, 10)); counter += 5; if (counter >= 360) counter = 0; GameFiber.Yield(); } if(blip != null && blip.IsValid()) blip.Delete(); NativeFunction.CallByName<uint>("REMOVE_PICKUP", obj); CurrentObjectives.Remove(pickup); }); } foreach (var mark in CurrentMission.Objectives.OfType<SerializableMarker>().Where(v => v.ActivateAfter == CurrentStage)) { CurrentObjectives.Add(mark); GameFiber.StartNew(delegate { var bColor = Color.FromArgb(mark.Alpha, (int) mark.Color.X, (int) mark.Color.Y, (int) mark.Color.Z); var blip = new Blip(mark.Position); blip.Color = bColor; blip.EnableRoute(bColor); while ((mark.Position - Game.LocalPlayer.Character.Position).Length() > 1.5f && IsMissionPlaying) { Util.DrawMarker(mark.Type, mark.Position, new Vector3(mark.Rotation.Pitch, mark.Rotation.Roll, mark.Rotation.Yaw), mark.Scale, bColor); GameFiber.Yield(); } if(blip.IsValid()) blip.Delete(); CurrentObjectives.Remove(mark); }); } if (CurrentMission.Cutscenes.Any(c => c.PlayAt == CurrentStage)) { var origPos = Game.LocalPlayer.Character.Position; var origRot = Game.LocalPlayer.Character.Rotation; Game.FadeScreenIn(100, true); Game.LocalPlayer.Character.Opacity = 0f; Game.LocalPlayer.Character.IsPositionFrozen = true; var cutscene = CurrentMission.Cutscenes.First(c => c.PlayAt == CurrentStage); var camLeft = new List<SerializableCamera>(cutscene.Cameras); var subLeft = new List<SerializableSubtitle>(cutscene.Subtitles); var startTime = Game.GameTime; Camera mainCam = null; SerializableCamera currentCam = null; uint lerpStart = 0; while ((Game.GameTime - startTime) < cutscene.Length) { var ct = (Game.GameTime - startTime); if (camLeft.Any()) { if (camLeft[0].PositionInTime <= ct) { if (mainCam == null || !mainCam.IsValid()) { Camera.DeleteAllCameras(); mainCam = new Camera(true); } Game.LocalPlayer.HasControl = false; mainCam.Position = cutscene.Cameras[0].Position; mainCam.Rotation = cutscene.Cameras[0].Rotation; currentCam = camLeft[0]; camLeft.RemoveAt(0); lerpStart = Game.GameTime; Game.LocalPlayer.Character.Position = mainCam.Position; } else if (currentCam != null) { // Advance cam pos if (currentCam.InterpolationStyle == InterpolationStyle.Linear) { mainCam.Position = Util.LerpVector(currentCam.Position, camLeft[0].Position, Util.LinearLerp, Game.GameTime - lerpStart, camLeft[0].PositionInTime - currentCam.PositionInTime); mainCam.Rotation = Util.LerpVector(currentCam.Rotation.ToVector(), camLeft[0].Rotation.ToVector(), Util.LinearLerp, Game.GameTime - lerpStart, camLeft[0].PositionInTime - currentCam.PositionInTime).ToRotator(); Game.LocalPlayer.Character.Position = mainCam.Position; } else if (currentCam.InterpolationStyle == InterpolationStyle.Smooth) { mainCam.Position = Util.LerpVector(currentCam.Position, camLeft[0].Position, Util.QuadraticLerp, Game.GameTime - lerpStart, camLeft[0].PositionInTime - currentCam.PositionInTime); mainCam.Rotation = Util.LerpVector(currentCam.Rotation.ToVector(), camLeft[0].Rotation.ToVector(), Util.QuadraticLerp, Game.GameTime - lerpStart, camLeft[0].PositionInTime - currentCam.PositionInTime).ToRotator(); Game.LocalPlayer.Character.Position = mainCam.Position; } } } else if(currentCam != null && mainCam != null) { mainCam.Position = currentCam.Position; mainCam.Rotation = currentCam.Rotation; Game.LocalPlayer.Character.Position = mainCam.Position; } if (subLeft.Any()) { if (subLeft[0].PositionInTime <= ct) { Game.DisplaySubtitle(subLeft[0].Content, subLeft[0].DurationInMs); subLeft.RemoveAt(0); } } GameFiber.Yield(); } mainCam.Active = false; Game.LocalPlayer.HasControl = true; Game.LocalPlayer.Character.IsPositionFrozen = false; Game.LocalPlayer.Character.Position = origPos; Game.LocalPlayer.Character.Rotation = origRot; Game.LocalPlayer.Character.Opacity = 1f; Game.FadeScreenOut(100); } if (!string.IsNullOrEmpty(CurrentMission.ObjectiveNames[CurrentStage])) { Game.DisplaySubtitle(CurrentMission.ObjectiveNames[CurrentStage], 10000); } Game.FadeScreenIn(1); }