public override void Run() { Ped myPed = null; Blip myBlip = null; while (true) { Wait(0); 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; } } }
void Load_Mod() { try { Vector3 vector = new Vector3(79.2884f, -713.946f, 4.95886f); logger.Log("Initilazing Checkpoint", "Main"); CheckArrow = new NArrowCheckpoint(vector, new RGBColor(255, 215, 0)); World.UnlockAllIslands(); stationBlip = Blip.AddBlip(vector); stationBlip.Icon = BlipIcon.Building_PoliceStation; logger.Log("Initilazing Mod Functions", "Main"); CheckArrow.CheckpointTriggered += new NArrowCheckpoint.CheckpointTriggeredHandler(Main_Tick); this.BindKey(System.Windows.Forms.Keys.End, SirenSwitchDriver); this.GUID = new Guid("2AA8D642-C91F-4688-A32C-7D27F588014A"); InfoDraw = NLanguage.GetLangStr("OnDuty"); Wait(3000); InfoDraw = NLanguage.GetLangStr("NameDraw"); Controller.LoadAllPlugins(); if (Controller.plugins.Count != 0) { Controller.ExecuteAllPluginMethod("OnInitialized"); } } catch (Exception ex) { logger.Log("Fatal Error During Initilazing Mod, Caused by: " + ex.Message + Environment.NewLine + ex.ToString(), Engine.API.Logger.LogLevel.Fatal); Game.DisplayText("Fatal Error of Landtory! Check Landtory.log for more info."); } }
public override void StreamIn() { gameReference = World.CreatePed(model, position, RelationshipGroup.NetworkPlayer_01); blip = Blip.AddBlip(gameReference); blip.Color = color; blip.Display = BlipDisplay.MapOnly; blip.ShowOnlyWhenNear = false; blip.Icon = BlipIcon.Misc_Destination; blip.Name = networkname; gameReference.Heading = heading; var projected = (Vector2)World.WorldToScreenProject(position); var rand = new System.Random(); Weapon weapon = Weapon.Rifle_M4; gameReference.Weapons.AssaultRifle_M4.Ammo = 999; gameReference.Weapons.AssaultRifle_M4.AmmoInClip = 999; gameReference.Weapons.Select(weapon); gameReference.SenseRange = 0; gameReference.Task.GuardCurrentPosition(); gameReference.BlockGestures = true; gameReference.BlockPermanentEvents = true; gameReference.Task.AlwaysKeepTask = true; gameReference.CowerInsteadOfFleeing = true; }
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); }
/// <summary> /// Runs the mission depending on the last saved game. /// </summary> /// <param name="missionNumber">Mission number</param> /// <returns>Mission Information</returns> internal Mission PlayMission(int missionNumber) { Mission mission = loadedMissions[missionNumber]; Blip spawnLocation = Blip.AddBlip(mission.Location); spawnLocation.Name = mission.Name; spawnLocation.RouteActive = true; spawnLocation.Color = BlipColor.Orange; entryLoc = spawnLocation; Functions.PrintText("Mission " + mission.Name + " started.", 3500); return(mission); }
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; } }