public override void Action() { GameFiber.StartNew(delegate { try { base.Action(); if (this.Animal.Exists()) { this.Animal.ReactAndFlee(this.Hunter); } if (this.Animal.Exists()) { this.Animal.KeepTasks = true; } if (this.Hunter.Exists()) { this.Hunter.AttackPed(this.Animal); } if (this.Hunter.Exists()) { this.Hunter.KeepTasks = true; } while (this.Hunter.Exists() && this.Hunter.IsAlive && this.Animal.Exists() && this.Animal.IsAlive) { GameFiber.Yield(); } if (this.Hunter.Exists() && this.Animal.Exists()) { NativeFunction.CallByName <uint>("TASK_SHOOT_AT_ENTITY", this.Hunter, this.Animal, 6000, (uint)Rage.FiringPattern.BurstFire); } GameFiber.Sleep(5000); if (this.Hunter.Exists() && this.Animal.Exists()) { this.Hunter.Tasks.FollowNavigationMeshToPosition(this.Animal.Position.AroundPosition(0.75f), this.Hunter.Heading, 20.0f).WaitForCompletion(); } if (this.Hunter.Exists() && this.Animal.Exists()) { this.Hunter.Tasks.AchieveHeading(this.Hunter.GetHeadingTowards(this.Animal)).WaitForCompletion(2250); } if (this.Hunter.Exists()) { this.Hunter.Tasks.PlayAnimation("amb@medic@standing@tendtodead@idle_a", tendToDeadIdles.GetRandomElement(), 2.0f, AnimationFlags.Loop); } GameFiber.Sleep(60000); this.CleanUp(); } catch (System.Exception e) { Logger.LogException(this.GetType().Name, e); } }); }
public AirParamedic(Ped toRescue, string phraseToSayToThePlayerMaleVersion, string phraseToSayToThePlayerFemaleVersion) { _rescuedPeds.Add(toRescue); PedToRescue = toRescue; Vector3 position = GetSpawnPoint(); Helicopter = new Vehicle(Settings.AirAmbulance.HeliModel, position, MathHelper.GetRandomSingle(0.0f, 360.0f)); Helicopter.SetLivery(Settings.AirAmbulance.HeliLiveryIndex); NativeFunction.CallByName <uint>("SET_HELI_BLADES_FULL_SPEED", Helicopter); Pilot = new Ped(Settings.AirAmbulance.PilotModels.GetRandomElement(), Vector3.Zero, 0.0f); Pilot.BlockPermanentEvents = true; NativeFunction.CallByName <uint>("SET_PED_FLEE_ATTRIBUTES", Pilot, 0, 0); NativeFunction.CallByName <uint>("SET_PED_COMBAT_ATTRIBUTES", Pilot, 17, 1); Pilot.WarpIntoVehicle(Helicopter, -1); Paramedic1 = new Ped(Settings.AirAmbulance.ParamedicModels.GetRandomElement(), Vector3.Zero, 0.0f); Paramedic1.BlockPermanentEvents = true; Paramedic1.WarpIntoVehicle(Helicopter, 1); Paramedic2 = new Ped(Settings.AirAmbulance.ParamedicModels.GetRandomElement(), Vector3.Zero, 0.0f); Paramedic2.BlockPermanentEvents = true; Paramedic2.WarpIntoVehicle(Helicopter, 2); _heliBlip = new Blip(Helicopter); _heliBlip.Sprite = BlipSprite.Heli; _heliBlip.Color = Color.FromArgb(255, Color.Red); this.phraseToSayToThePlayerMaleVersion = phraseToSayToThePlayerMaleVersion; this.phraseToSayToThePlayerFemaleVersion = phraseToSayToThePlayerFemaleVersion; }
public void Procedures() { bool emt = false, emtd = false; GameFiber.StartNew(delegate { GameFiber.Sleep(3000); PedWorker.Position = patient.LeftPosition; NativeFunction.CallByName <uint>("TASK_TURN_PED_TO_FACE_ENTITY", PedDriver, patient, 1000); GameFiber.Sleep(1100); PedDriver.Tasks.PlayAnimation("amb@medic@standing@timeofdeath@enter", "enter", 4, AnimationFlags.StayInEndFrame); GameFiber.Sleep(9000); PedDriver.Tasks.PlayAnimation("amb@medic@standing@timeofdeath@idle_a", "idle_b", 4, AnimationFlags.StayInEndFrame); GameFiber.Sleep(6000); PedDriver.Tasks.PlayAnimation("amb@medic@standing@timeofdeath@exit", "exit", 4, AnimationFlags.StayInEndFrame); GameFiber.Sleep(7000); emtd = true; }); //==================== GameFiber.StartNew(delegate { NativeFunction.CallByName <uint>("TASK_TURN_PED_TO_FACE_ENTITY", PedWorker, patient, 1000); GameFiber.Sleep(1100); PedWorker.Tasks.PlayAnimation("amb@medic@standing@tendtodead@enter", "enter", 4, AnimationFlags.StayInEndFrame); GameFiber.Sleep(2000); PedWorker.Tasks.PlayAnimation("amb@medic@standing@tendtodead@idle_a", "idle_b", 4, AnimationFlags.StayInEndFrame); GameFiber.Sleep(4000); PedWorker.Tasks.PlayAnimation("amb@medic@standing@tendtodead@exit", "exit", 4, AnimationFlags.StayInEndFrame); GameFiber.Sleep(2000); PedWorker.Tasks.PlayAnimation("amb@code_human_police_investigate@idle_intro", "idle_intro", 4, AnimationFlags.StayInEndFrame); GameFiber.Sleep(1500); PedWorker.Tasks.PlayAnimation("amb@code_human_police_investigate@idle_b", "idle_d", 3, AnimationFlags.None); GameFiber.Sleep(9000); emt = true; }); while (!emt && !emtd) { GameFiber.Yield(); } }
public override void Process() { base.Process(); foreach (Ped pedsInGame in pedsList) { if (!pedsInGame.IsInAnyVehicle(false) && pedsInGame.Exists() && !Functions.IsPedGettingArrested(pedsInGame) && !Functions.IsPedArrested(pedsInGame)) { NativeFunction.CallByName <uint>("TASK_COMBAT_PED", pedsInGame, player, 0, 1); } } if (!Functions.IsPursuitStillRunning(pursuit)) { foreach (Ped pedsAlive in pedsList) { if (pedsAlive.Exists() || pedsAlive.IsAlive) { this.End(); } } } if (Game.IsKeyDown(Keys.End)) { this.End(); } }
public override void Draw(Size offset) { if (!this.Enabled) { return; } int screenw = Game.Resolution.Width; int screenh = Game.Resolution.Height; const float height = 1080f; float ratio = (float)screenw / screenh; var width = height * ratio; float w = Size.Width / width; float h = Size.Height / height; float x = ((Position.X + offset.Width) / width) + w * 0.5f; float y = ((Position.Y + offset.Height) / height) + h * 0.5f; NativeFunction.CallByName <uint>("DRAW_RECT", x, y, w, h, (int)Color.R, (int)Color.G, (int)Color.B, (int)Color.A); foreach (IElement item in this.Items) { item.Draw((Size)(this.Position + offset)); } }
private void HandleAnimations() { switch (AnimState) { case StingerAnimState.Undeployed: if (!Common.IsEntityPlayingAnim(Prop, P_ld_stinger_s, P_Stinger_S_idle_undeployed)) { Common.PlayEntityAnim(Prop, P_ld_stinger_s, P_Stinger_S_idle_undeployed, false); } if (Prop.Speed <= 0.1f && (NativeFunction.CallByName <float>("GET_ENTITY_HEIGHT_ABOVE_GROUND", Prop) < 0.2225f)) // start anim after falling { AnimState = StingerAnimState.Deploy; } break; case StingerAnimState.Deploy: if (!Common.IsEntityPlayingAnim(Prop, P_ld_stinger_s, P_Stinger_S_deploy)) { Common.PlayEntityAnim(Prop, P_ld_stinger_s, P_Stinger_S_deploy, false); Common.SetEntityAnimSpeed(Prop, P_ld_stinger_s, P_Stinger_S_deploy, 1.75f); NativeFunction.CallByName <uint>("REQUEST_SCRIPT_AUDIO_BANK", "BIG_SCORE_HIJACK_01", false); NativeFunction.CallByName <uint>("PLAY_SOUND_FROM_ENTITY", -1, "DROP_STINGER", Prop, "BIG_SCORE_3A_SOUNDS", 0, 0); } if (Common.GetEntityAnimCurrentTime(Prop, P_ld_stinger_s, P_Stinger_S_deploy) > 0.99f) { AnimState = StingerAnimState.Deployed; } break; case StingerAnimState.Deployed: break; } }
/// <summary> /// Gets the returned string from a native. /// </summary> /// <param name="native_name">Name of the native</param> /// <param name="args">Arguments</param> /// <returns>A string of the native's return</returns> internal static string GetStringFromNative(String native_name, params NativeArgument[] args) { IntPtr ptr = NativeFunction.CallByName <IntPtr>(native_name, args); String str = Marshal.PtrToStringAnsi(ptr); return(str); }
public static void OnFrameRenderLayout1(object sender, GraphicsEventArgs e) { // realistic dashcam layout String hours = NativeFunction.CallByName <int>("GET_CLOCK_HOURS").ToString(); String mins = NativeFunction.CallByName <int>("GET_CLOCK_MINUTES").ToString(); if (hours.Length == 1) { hours = "0" + hours; } if (mins.Length == 1) { mins = "0" + mins; } DrawText(veh.randomNum1 + " " + veh.randomNum2, 0.08f, 0.05f, 0.9f, false, false, 0f, true, Color.FromArgb(255, 255, 255, 255)); DrawText(date.Substring(0, 5) + " " + veh.GetStats(), 0.08f, 0.1f, 0.9f, false, false, 0f, true, Color.FromArgb(255, 255, 255, 255)); DrawText(unit, 0.743f, 0.05f, 0.9f, false, false, 0f, true, Color.FromArgb(255, 255, 255, 255)); DrawText(hours + ":" + mins + ":00", 0.805f, 0.1f, 0.9f, false, true, 0.916f, true, Color.FromArgb(255, 255, 255, 255)); DrawText("M1 M2", 0.8348f, 0.15f, 0.9f, false, false, 0f, true, Color.FromArgb(255, 255, 255, 255)); DrawText("This vehicle camera is licensed to the", 0.5f, 0.786f, 0.25f, true, false, 0f, true, Color.FromArgb(255, 255, 255, 255)); if (filter) { float gsCol = (0.21f * colR) + (0.72f * colG) + (0.07f * colB); DrawText(department, 0.5f, 0.80f, 0.7f, true, false, 0f, true, Color.FromArgb(255, (int)gsCol, (int)gsCol, (int)gsCol)); } else { DrawText(department, 0.5f, 0.80f, 0.7f, true, false, 0f, true, Color.FromArgb(255, colR, colG, colB)); } DrawText("Any unauthorized use is subject to heavy penalty under 13 S.A. Pen. Code 502(a).", 0.5f, 0.846f, 0.25f, true, false, 0f, true, Color.FromArgb(255, 255, 255, 255)); }
private static void DrawText(String text, float x, float y, float scale, bool centre, bool rightJust, float wrapEnd, bool shadow, Color fcolor) { NativeFunction.CallByName <uint>("SET_TEXT_FONT", 0); NativeFunction.CallByName <uint>("SET_TEXT_SCALE", scale, scale); NativeFunction.CallByName <uint>("SET_TEXT_COLOUR", (int)fcolor.R, (int)fcolor.G, (int)fcolor.B, (int)fcolor.A); NativeFunction.CallByHash <uint>(0x038C1F517D7FDCF8, false); NativeFunction.CallByHash <uint>(0xC02F4DBFB51D988B, centre); NativeFunction.CallByHash <uint>(0x6B3C4650BC8BEE47, rightJust); if (!rightJust) { NativeFunction.CallByName <uint>("SET_TEXT_WRAP", 0.0f, 1.0f); } else { NativeFunction.CallByName <uint>("SET_TEXT_WRAP", 0.0f, wrapEnd); } if (!shadow) { NativeFunction.CallByName <uint>("SET_TEXT_DROPSHADOW", 0, 0, 0, 0, 0); } else { NativeFunction.CallByName <uint>("SET_TEXT_DROPSHADOW", 100, 0, 0, 0, 0); } NativeFunction.CallByName <uint>("SET_TEXT_EDGE", 1, 0, 0, 0, 205); NativeFunction.CallByName <uint>("_SET_TEXT_ENTRY", "STRING"); NativeFunction.CallByName <uint>("_ADD_TEXT_COMPONENT_STRING", text); NativeFunction.CallByName <uint>("_DRAW_TEXT", x, y); }
/// <summary> /// Change the default walking animation from a ped /// </summary> /// <param name="ped"></param> /// <param name="animationSet">Animation set name</param> public static void SetStrafeAnimationSet(this Ped ped, string animationSet) { AnimationSet strafeSet = new AnimationSet(animationSet); strafeSet.LoadAndWait(); NativeFunction.CallByName <uint>("SET_PED_STRAFE_CLIPSET", ped, strafeSet.Name); }
public ScriptedFire(Vector3 position, int children, bool isGasFire) { Position = position; Children = children; IsGasFire = isGasFire; Handle = NativeFunction.CallByName <int>("START_SCRIPT_FIRE", position.X, position.Y, position.Z, children, isGasFire); }
public override bool OnCalloutAccepted() { Game.LogTrivial("UnitedCallouts Log: Burglary callout accepted."); Game.DisplayNotification("web_lossantospolicedept", "web_lossantospolicedept", "~w~UnitedCallouts", "~y~Burglary into an apartment", "~b~Dispatch: ~w~Try to ~o~find the apartment~w~ and arrest the burglar. Respond with ~r~Code 3"); _Aggressor = new Ped(pedList[new Random().Next((int)pedList.Length)], _SpawnPoint, 0f); _Aggressor.IsPersistent = true; _Aggressor.BlockPermanentEvents = true; _Aggressor.Armor = 200; _Aggressor.Inventory.GiveNewWeapon(new WeaponAsset(wepList[new Random().Next((int)wepList.Length)]), 500, true); _Victim = new Ped(_Aggressor.GetOffsetPosition(new Vector3(0, 1.8f, 0))); _Victim.Tasks.PutHandsUp(-1, _Aggressor); _Victim.IsPersistent = true; _Victim.BlockPermanentEvents = true; NativeFunction.CallByName <uint>("TASK_AIM_GUN_AT_ENTITY", _Aggressor, _Victim, -1, true); _searcharea = _SpawnPoint.Around2D(1f, 2f); _Blip = new Blip(_searcharea, 30f); _Blip.Color = Color.Yellow; _Blip.EnableRoute(Color.Yellow); _Blip.Alpha = 0.5f; return(base.OnCalloutAccepted()); }
public override bool OnCalloutAccepted() { Game.LogTrivial("UnitedCallouts Log: store callout accepted."); Game.DisplayNotification("web_lossantospolicedept", "web_lossantospolicedept", "~w~UnitedCallouts", "~y~Store Robbery", "~b~Dispatch:~w~ Someone called the police, because of a store robbery. Respond with ~r~Code 3~w~."); _V.IsPersistent = true; _V.BlockPermanentEvents = true; _A1.IsPersistent = true; _A1.BlockPermanentEvents = true; _A1.Armor = 200; _A1.Inventory.GiveNewWeapon(new WeaponAsset(wepList[new Random().Next((int)wepList.Length)]), 500, true); _A1.Face(_V); _A2.IsPersistent = true; _A2.BlockPermanentEvents = true; _A2.Armor = 200; _A2.Inventory.GiveNewWeapon(new WeaponAsset(wepList[new Random().Next((int)wepList.Length)]), 500, true); _A2.Face(_V); _searcharea = _SpawnPoint.Around2D(1f, 2f); _Blip = new Blip(_searcharea, 20f); _Blip.EnableRoute(Color.Yellow); _Blip.Color = Color.Yellow; _Blip.Alpha = 2f; NativeFunction.CallByName <uint>("TASK_AIM_GUN_AT_ENTITY", _A1, _V, -1, true); NativeFunction.CallByName <uint>("TASK_AIM_GUN_AT_ENTITY", _A2, _V, -1, true); return(base.OnCalloutAccepted()); }
public override bool OnCalloutAccepted() { Game.LogTrivial("UnitedCallouts Log: JewelryRobbery callout accepted."); Game.DisplayNotification("web_lossantospolicedept", "web_lossantospolicedept", "~w~UnitedCallouts", "~y~Jewelry Robbery", "~b~Dispatch:~w~ The units on scene needs backup at the jewellery. Respond with ~r~Code 3~w~."); _A1.IsPersistent = true; _A1.BlockPermanentEvents = true; _A1.Armor = 200; _A1.Inventory.GiveNewWeapon(new WeaponAsset(wepList[new Random().Next((int)wepList.Length)]), 500, true); _A2.IsPersistent = true; _A2.BlockPermanentEvents = true; _A2.Armor = 200; _A2.Inventory.GiveNewWeapon(new WeaponAsset(wepList[new Random().Next((int)wepList.Length)]), 500, true); _A3.IsPersistent = true; _A3.BlockPermanentEvents = true; _A3.Armor = 200; _A3.Inventory.GiveNewWeapon(new WeaponAsset(wepList[new Random().Next((int)wepList.Length)]), 500, true); _Cop1.IsPersistent = true; _Cop1.BlockPermanentEvents = true; _Cop1.Armor = 200; _Cop1.Inventory.GiveNewWeapon("WEAPON_PISTOL", 500, true); Functions.IsPedACop(_Cop1); _Cop2.IsPersistent = true; _Cop2.BlockPermanentEvents = true; _Cop2.Armor = 200; _Cop2.Inventory.GiveNewWeapon("WEAPON_PISTOL", 500, true); Functions.IsPedACop(_Cop2); _searcharea = _SpawnPoint.Around2D(1f, 2f); _Blip = new Blip(_searcharea, 20f); _Blip.EnableRoute(Color.Yellow); _Blip.Color = Color.Yellow; _Blip.Alpha = 0.5f; new RelationshipGroup("A"); new RelationshipGroup("COP"); _A1.RelationshipGroup = "A"; _A2.RelationshipGroup = "A"; _A3.RelationshipGroup = "A"; _Cop1.RelationshipGroup = "COP"; _Cop2.RelationshipGroup = "COP"; Game.LocalPlayer.Character.RelationshipGroup = "COP"; Game.SetRelationshipBetweenRelationshipGroups("A", "COP", Relationship.Hate); Game.SetRelationshipBetweenRelationshipGroups("COP", "A", Relationship.Hate); NativeFunction.CallByName <uint>("TASK_AIM_GUN_AT_ENTITY", _Cop1, _A3, -1, true); NativeFunction.CallByName <uint>("TASK_AIM_GUN_AT_ENTITY", _Cop2, _A3, -1, true); if (Settings.ActivateAIBackup) { Functions.RequestBackup(_Cop_Car1_Spawnpoint, LSPD_First_Response.EBackupResponseType.Code3, LSPD_First_Response.EBackupUnitType.LocalUnit); Functions.RequestBackup(_Cop_Car1_Spawnpoint, LSPD_First_Response.EBackupResponseType.Code3, LSPD_First_Response.EBackupUnitType.LocalUnit); } return(base.OnCalloutAccepted()); }
public override void Process() { GameFiber.StartNew(delegate { if (Game.LocalPlayer.Character.DistanceTo(PoliceRiot.Position) < 10f) { SWAT1.Tasks.FollowToOffsetFromEntity(Game.LocalPlayer.Character, new Vector3(-1.5f, -1.5f, 0f)); SWAT2.Tasks.FollowToOffsetFromEntity(Game.LocalPlayer.Character, new Vector3(-1.5f, -1.5f, 0f)); SWAT3.Tasks.FollowToOffsetFromEntity(Game.LocalPlayer.Character, new Vector3(-1.5f, -1.5f, 0f)); } if (Game.LocalPlayer.Character.DistanceTo(PoliceRiot.Position) < 10f) { Game.DisplayHelp("~y~The SWAT-Team~w~ is going to support you against the robbers.", 5000); } if (Game.LocalPlayer.Character.Position.DistanceTo(spawnPoint) < 22f) { NativeFunction.CallByName <uint>("TASK_COMBAT_PED", A1, Game.LocalPlayer.Character, 0, 1); NativeFunction.CallByName <uint>("TASK_COMBAT_PED", A2, Game.LocalPlayer.Character, 0, 1); NativeFunction.CallByName <uint>("TASK_COMBAT_PED", A3, Game.LocalPlayer.Character, 0, 1); NativeFunction.CallByName <uint>("TASK_COMBAT_PED", A6, Game.LocalPlayer.Character, 0, 1); NativeFunction.CallByName <uint>("TASK_COMBAT_PED", A7, Game.LocalPlayer.Character, 0, 1); NativeFunction.CallByName <uint>("TASK_COMBAT_PED", A8, Game.LocalPlayer.Character, 0, 1); NativeFunction.CallByName <uint>("TASK_COMBAT_PED", A9, Game.LocalPlayer.Character, 0, 1); A1.Tasks.FightAgainst(Game.LocalPlayer.Character); A2.Tasks.FightAgainst(Game.LocalPlayer.Character); A3.Tasks.FightAgainst(Game.LocalPlayer.Character); A6.Tasks.FightAgainst(Game.LocalPlayer.Character); A7.Tasks.FightAgainst(Game.LocalPlayer.Character); A8.Tasks.FightAgainst(Game.LocalPlayer.Character); A9.Tasks.FightAgainst(Game.LocalPlayer.Character); if (!JoinSWAT) { SWAT1.Position = Game.LocalPlayer.Character.Position;; SWAT2.Position = Game.LocalPlayer.Character.Position;; SWAT3.Position = Game.LocalPlayer.Character.Position;; JoinSWAT = true; } } if (Game.LocalPlayer.Character.IsDead) { End(); } if (Game.IsKeyDown(Settings.EndCall)) { End(); } if (A1.IsDead && A1.IsDead && A2.IsDead && A3.IsDead && A6.IsDead && A7.IsDead && A8.IsDead && A9.IsDead) { End(); } if (Functions.IsPedArrested(A1) && Functions.IsPedArrested(A2) && Functions.IsPedArrested(A3) && Functions.IsPedArrested(A6) && Functions.IsPedArrested(A7) && Functions.IsPedArrested(A8) && Functions.IsPedArrested(A9)) { End(); } }, "RobberHL [UnitedCallouts]"); base.Process(); }
public static void GetExtraColors(this Vehicle vehicle, out EPaint pearlescentColor, out EPaint wheelColor) { int pearl, wheel; unsafe { NativeFunction.CallByName <uint>("SET_VEHICLE_EXTRA_COLOURS", vehicle, &pearl, &wheel); } pearlescentColor = (EPaint)pearl; wheelColor = (EPaint)wheel; }
public static void SetName(this Blip blip, string text) { const ulong AddTextComponentStringHash = 0x6c188be134e074aa; NativeFunction.CallByName <uint>("BEGIN_TEXT_COMMAND_SET_BLIP_NAME", "STRING"); NativeFunction.CallByHash <uint>(AddTextComponentStringHash, text); NativeFunction.CallByName <uint>("END_TEXT_COMMAND_SET_BLIP_NAME", blip); }
public unsafe static void GetModelDimensions(Model model, out Vector3 minimum, out Vector3 maximum) { Vector3 min; Vector3 max; NativeFunction.CallByName <uint>("GET_MODEL_DIMENSIONS", model.Hash, &min, &max); minimum = min; maximum = max; }
/// <summary> /// Transition from the <see paramref="from"/> camera to the <see paramref="to"/> camera. Activates the <see paramref="to"/> camera. /// </summary> /// <param name="from"></param> /// <param name="to"></param> /// <param name="time">The time that the interpolation takes</param> /// <param name="easeLocation">Accelerate/decelerate cam speed during movement</param> /// <param name="easeRotation"></param> /// <param name="waitForCompletion">If true it will wait until the interpolation finishes</param> public static void Interpolate(this Camera from, Camera to, int time, bool easeLocation, bool easeRotation, bool waitForCompletion) { //SET_CAM_ACTIVE_WITH_INTERP(Cam camTo, Cam camFrom, int duration, BOOL easeLocation, BOOL easeRotation) NativeFunction.CallByName <uint>("SET_CAM_ACTIVE_WITH_INTERP", to, from, time, easeLocation, easeRotation); if (waitForCompletion) { GameFiber.Sleep(time); } }
public static void FollowPointRoute(this Ped ped, Vector3[] points, float speed) { NativeFunction.CallByName <uint>("TASK_FLUSH_ROUTE"); foreach (Vector3 v3 in points) { NativeFunction.CallByName <uint>("TASK_EXTEND_ROUTE", v3.X, v3.Y, v3.Z); } NativeFunction.CallByName <uint>("TASK_FOLLOW_POINT_ROUTE", ped, speed, 0); }
public static Color GetTyreSmokeColor(this Vehicle vehicle) { unsafe { int r, g, b; NativeFunction.CallByName <uint>("GET_VEHICLE_TYRE_SMOKE_COLOR", vehicle, &r, &g, &b); return(Color.FromArgb(r, g, b)); } }
/// <summary> /// Returns the ground Z float from a vector3 /// </summary> /// <param name="v3"></param> /// <returns>the ground Z float from a vector3</returns> public static float GetGroundZ(this Vector3 v3) { unsafe { float z; NativeFunction.CallByName <uint>("GET_GROUND_Z_FOR_3D_COORD", v3.X, v3.Y, 1250.0f, &z); return(z); } }
public static void Draw(Point position, Size size, Color color) { float w = size.Width / 1280.0f; float h = size.Height / 720.0f; float x = (position.X / 1280.0f) + w * 0.5f; float y = (position.Y / 720.0f) + h * 0.5f; NativeFunction.CallByName <uint>("DRAW_RECT", x, y, w, h, color.R, color.G, color.B, color.A); }
public void StartMurderScenario() { GameFiber.StartNew(delegate { this.pursuit = Functions.CreatePursuit(); int r = new Random().Next(1, 5); int t = new Random().Next(1, 3); state = EMurderState.DecisionMade; if (r == 1) { NativeFunction.CallByName <uint>("TASK_COMBAT_PED", Aggressor, Victim, 0, 1); NativeFunction.CallByName <uint>("TASK_REACT_AND_FLEE_PED", Victim, Aggressor); GameFiber.Sleep(5000); NativeFunction.CallByName <uint>("TASK_REACT_AND_FLEE_PED", Victim, Aggressor); if (t == 1) { NativeFunction.CallByName <uint>("TASK_COMBAT_PED", Aggressor, Game.LocalPlayer.Character, 0, 1); GameFiber.Sleep(4500); } if (t == 2) { Victim.Kill(); if (!Victim.IsAlive) { isDead = true; } if (isDead == true) { NativeFunction.CallByName <uint>("TASK_AIM_GUN_AT_ENTITY", Aggressor, Victim, -1, true); } } } else { NativeFunction.CallByName <uint>("TASK_REACT_AND_FLEE_PED", Victim, Aggressor); } if (Aggressor.Exists()) { Aggressor.Dismiss(); } Functions.AddPedToPursuit(this.pursuit, Aggressor); Functions.RequestBackup(Game.LocalPlayer.Character.Position, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.LocalUnit); }); }
public void Dispose() { unsafe { int handle = _sc.Handle; NativeFunction.CallByName <uint>("SET_SCALEFORM_MOVIE_AS_NO_LONGER_NEEDED", &handle); } _sc = null; }
public void Render2DScreenSpace(PointF location, PointF size) { float x = location.X / 1280.0f; float y = location.Y / 720.0f; float width = size.X / 1280.0f; float height = size.Y / 720.0f; NativeFunction.CallByName <uint>("DRAW_SCALEFORM_MOVIE", this._handle, x + (width / 2.0f), y + (height / 2.0f), width, height, 255, 255, 255, 255); }
public void Remove() { if (Handle == -1) { return; } NativeFunction.CallByName <uint>("REMOVE_SCRIPT_FIRE", Handle); Handle = -1; }
public void PlayFromPosition(string soundName, string setName, Vector3 position, bool p6 = false, int p7 = 0, bool p8 = false) { if (setName != null) { NativeFunction.CallByName <uint>("PLAY_SOUND_FROM_COORD", this.Id, soundName, position.X, position.Y, position.Z, setName, p6, p7, p8); } else { NativeFunction.CallByName <uint>("PLAY_SOUND_FROM_COORD", this.Id, soundName, position.X, position.Y, position.Z, 0, p6, p7, p8); } }
public static Task VehicleEscort(this TaskInvoker taskInvoker, Vehicle vehicle, Vehicle targetVehicle, EscortMode mode, float speed, VehicleDrivingFlags style, float minimumDistance, float noRoadsDistance) { Ped ped = taskInvoker.GetInstancePed(); if (ped != null) { NativeFunction.CallByName <uint>("TASK_VEHICLE_ESCORT", ped, vehicle, targetVehicle, (int)mode, speed, (int)style, minimumDistance, 0, noRoadsDistance); return(Task.GetTask(ped, "TASK_VEHICLE_ESCORT")); } return(null); }
public static bool IsKeyDownRightNowComputerCheck(Keys keyPressed) { if (NativeFunction.CallByName <int>("UPDATE_ONSCREEN_KEYBOARD") != 0) { return(Game.IsKeyDownRightNow(keyPressed)); } else { return(false); } }