예제 #1
0
        private void RunPoliceComputer()
        {
            do
            {
                ShowBackground(Globals.ShowBackgroundWhenOpen);
                GameFiber.Yield();
                PauseGame(Globals.PauseGameWhenOpen);
                IsMainComputerOpen = true;
                if (!Configs.SkipLogin)
                {
                    OpenLogin();
                }
                else
                {
                    OpenMain();
                }


                do
                {
                    GameFiber.Yield();
                }while (!CloseComputerPlusWindow.IsPressed && Globals.Navigation.Head != null);
                ClosePoliceComputer();
                Globals.Navigation.Clear();
                IsMainComputerOpen = false;
                PauseGame(false, true);
                ShowBackground(false, true);
                GameFiber.Yield(); //Yield to allow form fibers to close out
                GameFiber.Hibernate();
            }while (Globals.IsPlayerOnDuty);
            GameFiber.Hibernate();
        }
예제 #2
0
        private void RunPoliceComputer()
        {
            do
            {
                ShowBackground(Globals.ShowBackgroundWhenOpen);
                GameFiber.Yield();
                PauseGame(Globals.PauseGameWhenOpen);
                IsMainComputerOpen = true;
                if (!Configs.SkipLogin)
                {
                    OpenLogin();
                }
                else
                {
                    OpenMain();
                }


                do
                {
                    EnsurePaused();
                    GameFiber.Yield();
                }while (Globals.Navigation.Head != null);
                EntryPoint.OnRecentTextAdded = null;
                FreePersistedEntities();
                ClosePoliceComputer();
                Globals.Navigation.Clear();
                IsMainComputerOpen = false;
                PauseGame(false, true);
                ShowBackground(false, true);
                GameFiber.Yield(); //Yield to allow form fibers to close out
                GameFiber.Hibernate();
            }while (Globals.IsPlayerOnDuty);
            GameFiber.Hibernate();
        }
예제 #3
0
        public static void Main()
        {
            MenusProcessFiber = new GameFiber(ProcessLoop);
            Logger.DebugLog("ProcessFiber created");

            menuPool = new MenuPool();
            Logger.DebugLog("MenuPool created");

            mainMenu = new UIMenu("BVF", "~b~Basic Vehicle Functions");
            mainMenu.MouseControlsEnabled = false;
            mainMenu.AllowCameraMovement  = true;
            Logger.DebugLog("Main Menu created");

            menuPool.Add(mainMenu);
            Logger.DebugLog("Main Menu added to pool");

            DoorMainMenu = new UIMenu("BVF", "~b~Basic Vehicle Functions");
            DoorMainMenu.MouseControlsEnabled = false;
            DoorMainMenu.AllowCameraMovement  = true;
            Logger.DebugLog("Door Menu created");

            menuPool.Add(DoorMainMenu);
            Logger.DebugLog("Door Menu added to pool");

            //add items here
            toggleBoot   = new UIMenuItem("Boot");
            toggleBonnet = new UIMenuItem("Bonnet");
            togglelf     = new UIMenuItem("Rear Driver");
            togglerf     = new UIMenuItem("Rear Passenger");
            togglefd     = new UIMenuItem("Front Driver");
            togglefp     = new UIMenuItem("Front Passenger");
            toggleEngine = new UIMenuItem("Toggle Engine");



            mainMenu.AddItem(StartCalloutItem = new UIMenuItem("Open/Close Doors", " Open and close specific doors"));
            mainMenu.AddItem(toggleEngine);
            mainMenu.BindMenuToItem(DoorMainMenu, StartCalloutItem);

            DoorMainMenu.AddItem(togglefd);
            DoorMainMenu.AddItem(togglefp);
            DoorMainMenu.AddItem(togglelf);
            DoorMainMenu.AddItem(togglerf);
            DoorMainMenu.AddItem(toggleBoot);
            DoorMainMenu.AddItem(toggleBonnet);
            DoorMainMenu.RefreshIndex();
            DoorMainMenu.OnItemSelect  += BootOnItemSelect;
            DoorMainMenu.OnIndexChange += OnItemChange;
            Logger.DebugLog("Configured Door Menu");

            mainMenu.RefreshIndex();
            mainMenu.OnItemSelect  += OnItemSelect;
            mainMenu.OnIndexChange += OnItemChange;
            Logger.DebugLog("Configured Main Menu");

            MenusProcessFiber.Start();
            Logger.DebugLog("ProcessFiber started");
            GameFiber.Hibernate();
        }
예제 #4
0
        /// <summary>
        /// Main code for LSPDE
        /// </summary>
        ///
        public static void Main()
        {
            Config.GetConfig();

            //Successfully loaded stuff
            Logger.Log("LSPDE loaded successfully");
            Logger.Log("LSPDE version v2.0");
            Game.DisplayNotification("~b~LSP~r~DFR~w~ Enhancer ~g~successfully~w~ loaded");
            Game.DisplayNotification("~b~LSP~r~DFR~w~ Enhancer ~y~v2.0 STABLE");

            //Initializing the menu...
            GUI.GUIHandler.InitializeMenu();

            GameFiber.Hibernate();
        }
예제 #5
0
        public static void Main()
        {
            // Create a fiber to process our menus
            menusProcessFiber = new GameFiber(ProcessLoop);

            // Create the MenuPool to easily process our menus
            menuPool = new MenuPool();

            // Create our menus
            menu1 = CreateMenu("First");
            menu2 = CreateMenu("Second");
            menu3 = CreateMenu("Third");
            menu4 = CreateMenu("Fourth");

            // Create the menu switcher
            menuSwitcher = new UIMenuSwitchMenusItem("Menu", "", new DisplayItem(menu1, "The First"),
                                                     new DisplayItem(menu2, "The Second"),
                                                     new DisplayItem(menu3, "The Third"),
                                                     new DisplayItem(menu4, "The Fourth"));

            // We use the DisplayItem class to specify the custom text that will appear in the menu switcher;
            // we can pass the menus directly too and it will use the menu title text instead:
            //
            // menuSwitcher = new UIMenuSwitchMenusItem("Menu", "", menu1, menu2, menu3, menu4);
            //

            // Add the menu switcher to the menus
            menu1.AddItem(menuSwitcher, 0);
            menu2.AddItem(menuSwitcher, 0);
            menu3.AddItem(menuSwitcher, 0);
            menu4.AddItem(menuSwitcher, 0);


            menu1.RefreshIndex();
            menu2.RefreshIndex();
            menu3.RefreshIndex();
            menu4.RefreshIndex();

            // Temporal fix to prevent some flickering that happens occasionally when switching menus
            menuSwitcher.OnListChanged += (s, i) => { menuSwitcher.CurrentMenu.Draw(); };

            // Start our process fiber
            menusProcessFiber.Start();


            // Continue with our plugin... in this example, hibernate to prevent it from being unloaded
            GameFiber.Hibernate();
        }
예제 #6
0
 private void CheckToggleComputer()
 {
     do
     {
         if (!Globals.CloseRequested && Globals.OpenRequested)
         {
             CheckForCloseTrigger();
         }
         else
         {
             CheckForOpenTrigger();
         }
         GameFiber.Yield();
     }while (Globals.IsPlayerOnDuty);
     GameFiber.Hibernate();
 }
예제 #7
0
        public static void Main()
        {
            _menuPool = new MenuPool();
            mainMenu  = new UIMenu("Main Menu", "");
            _menuPool.Add(mainMenu);

            vehicleSelect = new UIMenu("Vehicle Select Menu", "");
            _menuPool.Add(vehicleSelect);

            navigateToSelectorMenuItem = new UIMenuItem("Vehicle Menu");
            mainMenu.AddItem(navigateToSelectorMenuItem);
            mainMenu.BindMenuToItem(vehicleSelect, navigateToSelectorMenuItem);
            vehicleSelect.ParentMenu = mainMenu;

            List <dynamic> listWithModels = new List <dynamic>()
            {
                "POLICE", "POLICE 2", "POLICE3", "POLICE4", "SHERIFF", "SHERIFF2"
            };

            modelList = new UIMenuListItem("Model", listWithModels, 0);
            vehicleSelect.AddItem(modelList);

            weaponSelect = new UIMenu("Weapons", "");
            _menuPool.Add(weaponSelect);
            navigateToSelectorMenuItem = new UIMenuItem("Weapon Menu");
            weaponSelect.AddItem(navigateToSelectorMenuItem);
            weaponSelect.BindMenuToItem(weaponSelect, navigateToSelectorMenuItem);
            weaponSelect.ParentMenu = mainMenu;

            List <dynamic> weaponList = new List <dynamic>()
            {
                "WEAPON_COMBATPISTOL", "WEAPON_NIGHTSTICK", "WEAPON_STUNGUN", "WEAPON_PUMPSHOTGUN", "WEAPON_CARBINERIFLE"
            };

            weapList = new UIMenuListItem("Police Weapons", weaponList, 0);
            weaponSelect.AddItem(weapList);

            mainMenu.RefreshIndex();
            vehicleSelect.RefreshIndex();
            weaponSelect.RefreshIndex();
            mainMenu.MouseControlsEnabled      = false;
            mainMenu.AllowCameraMovement       = true;
            vehicleSelect.MouseControlsEnabled = false;
            vehicleSelect.AllowCameraMovement  = true;
            MainLogic();
            GameFiber.Hibernate();
        }
예제 #8
0
        private static void Main()
        {
            // Older versions of RPH do not support the EmergencyLighting API properly
            FileVersionInfo rphVer = FileVersionInfo.GetVersionInfo("ragepluginhook.exe");

            Game.LogTrivial("Detected RPH " + rphVer.FileVersion);
            if (rphVer.FileMinorPart < 81)
            {
                Game.LogTrivial("RPH 81+ is required to use this version of LiveLights");
                Game.DisplayNotification($"~y~Unable to load LiveLights~w~\nRagePluginHook version ~b~81~w~ or later is required, you are on version ~b~{rphVer.FileMinorPart}");
                return;
            }

            AssemblyName pluginInfo = Assembly.GetExecutingAssembly().GetName();

            CurrentFileVersion = pluginInfo.Version;
            Game.LogTrivial($"Loaded {pluginInfo.Name} {pluginInfo.Version}");
            if (Settings.MenuKey != Keys.None)
            {
                Game.LogTrivial("Press " + (Settings.MenuModifier == Keys.None ? "" : (Settings.MenuModifier.ToString() + " + ")) + Settings.MenuKey.ToString() + " to open the menu");
            }
            else
            {
                Game.LogTrivial("Use the OpenLiveLightsMenu console command to open the menu");
            }

            if (Settings.CheckForUpdates)
            {
                VersionCheck = new GithubVersionCheck("pnwparksfan", "rph-live-lights", 29759134);
                Game.LogTrivial($"Latest release on github: {VersionCheck.LatestRelease?.TagName}");
                if (VersionCheck.IsUpdateAvailable())
                {
                    Game.LogTrivial("Current version is out of date");
                    Game.DisplayNotification("commonmenu", "mp_alerttriangle", "LiveLights by PNWParksFan", "~y~Update Available", $"~b~LiveLights {VersionCheck.LatestRelease.TagName}~w~ is available!\n\n~y~<i>{VersionCheck.LatestRelease.Name}</i>");
                }
                else
                {
                    Game.LogTrivial($"Current version is up to date");
                }
            }


            GameFiber.ExecuteWhile(Menu.MenuController.Process, () => true);
            GameFiber.Hibernate();
        }
예제 #9
0
        private static void Main()
        {
            Game.LogTrivial("Getting test methods");
            foreach (Type type in Assembly.GetExecutingAssembly().GetTypes())
            {
                foreach (MethodInfo method in type.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))
                {
                    TestCaseAttribute att = method.GetCustomAttribute <TestCaseAttribute>();
                    if (att != null)
                    {
                        Game.LogTrivial($" - {method.Name}");
                        TestMethodsByName.Add(method.Name, method);
                    }
                }
            }

            GameFiber.Hibernate();
        }
예제 #10
0
        internal static void Main()
        {
            GameFiber.StartNew(delegate
            {
                _menusProcessFiber = new GameFiber(ProcessLoop);

                _menuPool = new MenuPool();
                _mainMenu = new UIMenu("Detective/Supervisor Interaction", "");

                _menuPool.Add(_mainMenu);

                _mainMenu.RefreshIndex();

                _menusProcessFiber.Start();

                GameFiber.Hibernate();
            });
        }
예제 #11
0
        private static void Main()
        {
            while (Game.IsLoading)
            {
                GameFiber.Yield();
            }
            Game.LogTrivial("Enabling Player Loop...");
            var PlayerProcessFiber = new GameFiber(BackWeapon.PlayerLoop);

            PlayerProcessFiber.Start();
            if (enableAI)
            {
                Game.LogTrivial("Enabling AI Loop...");
                var AIProcessFiber = new GameFiber(BackWeapon.AIPedsLoop);
                AIProcessFiber.Start();
            }
            Game.LogTrivial("Stow That Weapon (BackWeapon.dll) by willpv23 has been loaded!");
            GameFiber.Hibernate();
        }
예제 #12
0
 void CheckForBinderEvents()
 {
     while (FiberCanRun)
     {
         if (EventTriggeredCallback != null && BoundKeys.Any(x => x.IsPressed))
         {
             if (MaxEvents.HasValue)
             {
                 EventsTriggered += 1;
             }
             EventTriggeredCallback();
         }
         GameFiber.Yield();
         if (MaxEvents.HasValue && MaxEvents.Value <= EventsTriggered)
         {
             GameFiber.Hibernate();
         }
     }
 }
예제 #13
0
        public static void initMainMenu()
        {
            current_item = "Bolingbroke"; // The current item of the list of police stations is updated to Bolingbroke, this fixes a bug where upon first loading the plugin, a user
                                          // Would have to switch to a different location before being able to teleport back to Bolingbroke.

            GoMenu      = new UIMenu("GoThere", "~b~LET'S MOVE!");
            StationList = new UIMenuListItem("~g~List of Stations: ", "", "Bolingbroke", "Davis", "Downtown Vinewood", "La Mesa", "LSIA", "Mission Row",
                                             "Paleto Bay", "Rockford Hills", "Sandy Shores", "Vespucci", "Vinewood Hills");


            menu_pool = new MenuPool();

            MenuProcessFiber = new GameFiber(ProcessLoop);


            menu_pool.Add(GoMenu);       // Add our menu to the menu pool
            GoMenu.AddItem(StationList); // Add a list of destinations -- maybe we want to hold destination OBJECTS. We shall see.
            GoMenu.OnItemSelect += OnItemSelect;
            GoMenu.OnListChange += OnListChange;

            if (customLocationsEnabled) // If custom locations are enabled
            {
                navigateToLocMenu = new UIMenuItem("Custom Locations");
                LocMenu           = new UIMenu("Custom Locations", "Teleport to custom locations.");                             // Initialize the locations menu
                menu_pool.Add(LocMenu);                                                                                          // Add the locations menu to the menu pool

                GoMenu.AddItem(navigateToLocMenu);                                                                               // Add the ui item to the main menu
                GoMenu.BindMenuToItem(LocMenu, navigateToLocMenu);                                                               // Bind the locations menu to the ui item
                LocMenu.ParentMenu = GoMenu;                                                                                     // Set the parent menu of the locations menu to be the main menu
                InstructionalButton removeButtonKeyButton = new InstructionalButton(removeKey.ToString(), "Remove Destination"); // Add instructional button showing users how to remove a dest.
                LocMenu.AddInstructionalButton(removeButtonKeyButton);
                RefreshCustomLocationsMenu();
            }
            GoMenu.RefreshIndex();                                                                               // Set the index at 0 by using the RefreshIndex method

            MenuProcessFiber.Start();                                                                            // Start process fiber

            Game.DisplayNotification("~r~[GoThere] \nGoThere v1.0 ~w~by ~b~Cavasi ~w~has loaded successfully!"); // Display a notification above the radar that the plugin loaded successfully

            GameFiber.Hibernate();                                                                               // Continue with our plugin. Prevent it from being unloaded
        }
예제 #14
0
        private void ComputerPlusMain()
        {
            do
            {
                if (!Globals.CloseRequested && Globals.OpenRequested)
                {
                    CheckForCloseTrigger();
                }
                else
                {
                    CheckForOpenTrigger();
                }

                CheckForDeliverTicketTrigger();

                //Function.Log(String.Format("{0} {1} {2}", Game.TimeScale, Game.GameTime, World.DateTime.ToString("hh:mm:ss.f")));
                //World.TimeOfDay = DateTime.Now.TimeOfDay;
                GameFiber.Yield();
            }while (Globals.IsPlayerOnDuty);
            GameFiber.Hibernate();
        }
예제 #15
0
        public static void Main()
        {
            Game.LogTrivial("Loading SirenMastery " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version + ", developed by Albo1125");
            Albo1125.Common.DependencyChecker.RegisterPluginForDependencyChecks(PluginName);
            Albo1125.Common.UpdateChecker.VerifyXmlNodeExists(PluginName, FileID, DownloadURL, Path);
            if (Albo1125.Common.DependencyChecker.DependencyCheckMain(PluginName, Albo1125CommonVer, MinimumRPHVer, OtherRequiredFilesToCheckFor: OtherFilesToCheckFor))
            {
                if (Albo1125.Common.DependencyChecker.CheckIfFileExists("NAudio.dll", new Version("1.8.0.0")))
                {
                    if (Directory.Exists("Plugins/SirenMastery/vehicles"))
                    {
                        if (Albo1125.Common.DependencyChecker.CheckIfThereAreNoConflictingFiles(PluginName, new string[] { "Plugins/SirenControl.dll" }))
                        {
                            Game.LogTrivial("SirenMastery, developed by Albo1125, has been loaded successfully!");
                            SirenMasterySetup.Setup();
                        }
                        else
                        {
                            Game.DisplayNotification("~r~SirenMastery exited due to an installation error.");
                        }
                    }
                    else
                    {
                        Albo1125.Common.CommonLibrary.ExtensionMethods.DisplayPopupTextBoxWithConfirmation(PluginName, "You're missing the following folder: GTAV/Plugins/SirenMastery/vehicles. Please follow Part 2 of the documentation installation guide thoroughly before trying again.", true);
                    }
                }
                else
                {
                    Albo1125.Common.CommonLibrary.ExtensionMethods.DisplayPopupTextBoxWithConfirmation(PluginName, "Your version of NAudio.dll is out of date or you don't have it installed. Please install the NAudio.dll that's packaged in the download.", true);
                }
            }
            else
            {
                Game.DisplayNotification("~r~SirenMastery by Albo1125 has exited due to an installation error.");

                GameFiber.Hibernate();
                return;
            }
        }
예제 #16
0
        public override void Update()
        {
            try
            {
                switch (m_BehavPath)
                {
                default:    //Shoot each other and run
                    #region default
                    if (!m_HasEventStarted)
                    {
                        m_TimeBeforeEventTimer += Game.FrameTime;
                    }

                    if (m_TimeBeforeEventTimer >= Settings.ShootingWanderTime && !m_HasEventStarted)    //Stop wander start shoot
                    {
                        m_HasEventStarted = true;

                        ResourceManager.RemoveBlip(m_Blip);
                        m_Blip       = ResourceManager.CreatBlip(m_Peds[0].Position.Around(2), 20.0f);
                        m_Blip.Alpha = 0.5f;
                        m_Blip.Color = System.Drawing.Color.Yellow;

                        for (int i = 0; i < m_Peds.Length; i++)
                        {
                            m_Peds[i].Inventory.GiveNewWeapon(WeaponHash.Pistol, 500, true);
                            if (i == 0)
                            {
                                m_Peds[i].Tasks.FireWeaponAt(m_Peds[1], Random.Next(5000, 10000), FiringPattern.BurstFire);
                            }
                            else
                            {
                                m_Peds[i].Tasks.FireWeaponAt(m_Peds[0], Random.Next(5000, 10000), FiringPattern.BurstFire);
                            }
                        }

                        GameFiber.StartNew(delegate
                        {
                            GameFiber.Sleep(15000);
                            m_Pursuit = Functions.CreatePursuit();

                            foreach (Ped p in m_Peds)
                            {
                                if (p.Exists())
                                {
                                    Functions.AddPedToPursuit(m_Pursuit, p);
                                    PedPursuitAttributes attri = Functions.GetPedPursuitAttributes(p);
                                    attri.HandlingAbility      = (float)Random.NextDouble() + 0.5f;
                                }
                            }

                            Functions.SetPursuitCopsCanJoin(m_Pursuit, true);
                            Functions.SetPursuitTacticsEnabled(m_Pursuit, true);
                            Functions.SetPursuitIsActiveForPlayer(m_Pursuit, true);
                            GameFiber.Hibernate();
                        });
                    }

                    if (m_HasEventStarted)
                    {
                        m_TimeoutTimer += Game.FrameTime;
                        if (m_TimeoutTimer >= m_TimeoutTime && Game.LocalPlayer.Character.DistanceTo(m_Peds[0].Position) > 50 && AllPedsDead())
                        {
                            End();
                        }
                    }

                    break;
                    #endregion

                case 1:    //Shoot at cop and run
                    #region 1
                    if (!m_HasEventStarted)
                    {
                        m_TimeBeforeEventTimer += Game.FrameTime;
                    }

                    if (m_TimeBeforeEventTimer >= Settings.ShootingWanderTime && !m_HasEventStarted)    //Stop wander start shoot
                    {
                        m_HasEventStarted = true;

                        ResourceManager.RemoveBlip(m_Blip);
                        m_Blip       = ResourceManager.CreatBlip(m_Peds[0].Position.Around(2), 20.0f);
                        m_Blip.Alpha = 0.5f;
                        m_Blip.Color = System.Drawing.Color.Yellow;

                        for (int i = 0; i < m_Peds.Length; i++)
                        {
                            m_Peds[i].Inventory.GiveNewWeapon(WeaponHash.Pistol, 12, true);
                            m_Peds[i].Tasks.FireWeaponAt(Game.LocalPlayer.Character, Random.Next(5000, 10000), FiringPattern.BurstFirePistol);
                        }

                        GameFiber.StartNew(delegate
                        {
                            GameFiber.Sleep(15000);
                            m_Pursuit = Functions.CreatePursuit();

                            foreach (Ped p in m_Peds)
                            {
                                if (p.Exists())
                                {
                                    Functions.AddPedToPursuit(m_Pursuit, p);
                                    PedPursuitAttributes attri = Functions.GetPedPursuitAttributes(p);
                                    attri.HandlingAbility      = (float)Random.NextDouble() + 0.5f;
                                }
                            }

                            Functions.SetPursuitCopsCanJoin(m_Pursuit, true);
                            Functions.SetPursuitTacticsEnabled(m_Pursuit, true);
                            Functions.SetPursuitIsActiveForPlayer(m_Pursuit, true);
                            GameFiber.Hibernate();
                        });
                    }

                    if (m_HasEventStarted)
                    {
                        m_TimeoutTimer += Game.FrameTime;
                        if (m_TimeoutTimer >= m_TimeoutTime && Game.LocalPlayer.Character.DistanceTo(m_Peds[0].Position) > 50 && AllPedsDead())
                        {
                            End();
                        }
                    }
                    #endregion
                    break;

                case 2:    //Run
                    #region 2
                    if (!m_HasEventStarted)
                    {
                        m_TimeBeforeEventTimer += Game.FrameTime;
                    }

                    if (m_TimeBeforeEventTimer >= Settings.ShootingWanderTime && !m_HasEventStarted &&
                        Game.LocalPlayer.Character.DistanceTo(m_Peds[0].Position) < 50)    //Stop wander start shoot
                    {
                        m_HasEventStarted = true;

                        ResourceManager.RemoveBlip(m_Blip);
                        m_Blip       = ResourceManager.CreatBlip(m_Peds[0].Position.Around(2), 20.0f);
                        m_Blip.Alpha = 0.5f;
                        m_Blip.Color = System.Drawing.Color.Yellow;

                        for (int i = 0; i < m_Peds.Length; i++)
                        {
                            m_Peds[i].Inventory.GiveNewWeapon(WeaponHash.AssaultRifle, 12, true);
                        }

                        m_Pursuit = Functions.CreatePursuit();

                        foreach (Ped p in m_Peds)
                        {
                            if (p.Exists())
                            {
                                Functions.AddPedToPursuit(m_Pursuit, p);
                                PedPursuitAttributes attri = Functions.GetPedPursuitAttributes(p);
                                attri.HandlingAbility = (float)Random.NextDouble() + 0.5f;
                            }
                        }

                        Functions.SetPursuitCopsCanJoin(m_Pursuit, true);
                        Functions.SetPursuitTacticsEnabled(m_Pursuit, true);
                        Functions.SetPursuitIsActiveForPlayer(m_Pursuit, true);
                        GameFiber.Hibernate();
                    }

                    if (m_HasEventStarted)
                    {
                        m_TimeoutTimer += Game.FrameTime;
                        if (m_TimeoutTimer >= m_TimeoutTime && Game.LocalPlayer.Character.DistanceTo(m_Peds[0].Position) > 50 && AllPedsDead())
                        {
                            End();
                        }
                    }
                    #endregion
                    break;
                }

                if (Game.LocalPlayer.Character.DistanceTo(m_Peds[0]) > 400)
                {
                    End();
                }
            }
            catch (Exception e)
            {
                Game.LogTrivial("[ee] ERROR: " + e);
                Game.DisplayNotification("Epic events encounterd an error, please file a bug report with your ragepluginhook.log");
                End();
            }
        }
예제 #17
0
 public static void Main()
 {
     Log("Plugin loaded.");
     GameFiber.Hibernate();
 }
예제 #18
0
 public static void Main()
 {
     Log("Loading...");
     Game.TerminateAllScripts("selector");
     (new FileInfo(ini)).Directory.Create();
     cfg = new InitializationFile(ini);
     if (!File.Exists(ini))
     {
         Log($"File {ini} doesn't exist, creating new one.");
         cfg.Write("General", "debug", "false");
         cfg.Write("General", "addBlipsOnStartup", "true");
         cfg.Write("General", "revealMapOnStartup", "false");
         cfg.Write("General", "customBlipsXML", $"{folder}customBlips.xml");
     }
     else
     {
         if (!cfg.DoesKeyExist("General", "debug"))
         {
             cfg.Write("General", "debug", "false");
         }
         if (!cfg.DoesKeyExist("General", "addBlipsOnStartup"))
         {
             cfg.Write("General", "addBlipsOnStartup", "true");
         }
         if (!cfg.DoesKeyExist("General", "revealMapOnStartup"))
         {
             cfg.Write("General", "revealMapOnStartup", "false");
         }
         if (cfg.ReadString("General", "customBlipsXML", "") == "")
         {
             cfg.Write("General", "customBlipsXML", $"{folder}customBlips.xml");
         }
     }
     if (cfg.ReadBoolean("General", "revealMapOnStartup", false))
     {
         Log("revealMapOnStartup set, revealing map...");
     }
     Game.IsFullMapRevealForced = true;
     file = cfg.ReadString("General", "customBlipsXML");
     if (bool.Parse(cfg.ReadString("General", "addBlipsOnStartUP")))
     {
         DirectoryInfo d = new DirectoryInfo(folder);
         foreach (var file in d.GetFiles("*.xml"))
         {
             try
             {
                 XDocument xDocument = XDocument.Load(file.FullName);
                 XElement  root      = xDocument.Element("CustomBlips");
                 foreach (XElement el in root.Descendants())
                 {
                     var blip = XmlToBlip(el);
                     Log($"Added new Blip {blip.Name} from {file.Name} at {blip.Position.X},{blip.Position.Y},{blip.Position.Z}", true);
                 }
                 Log($"Added all Blips from {file.Name}");
             }
             catch
             {
                 Log($"Cannot load {file.FullName}\nMake sure it exists and check it's validaty with http://codebeautify.org/xmlvalidator");
             }
         }
     }
     Log("Loaded successfully.");
     GameFiber.Hibernate();
 }
예제 #19
0
 public static void Main()
 {
     GameFiber.Hibernate();
 }
예제 #20
0
        /// <summary>
        /// The initializer method of the NAL.
        /// <b>Do not</b> call directly. This will break the whole game.
        /// </summary>
#pragma warning disable S4210 // Windows Forms entry points should be marked with STAThread
        public static void Main()
#pragma warning restore S4210 // Windows Forms entry points should be marked with STAThread
        {
            try
            {
                Logger.Info("Main", "Initializing NAL...");
                GetConfig();
                Logger.Info("Main", "Setting prop density and loading GTAO map...");

                NativeFunction.Natives.x808519373FD336A3(true); // SetPlayerIsInDirectorMode, so we hide the name
                NativeFunction.Natives.x0888C3502DBBEEF5();     // ON_ENTER_MP, so we load the map
                NativeFunction.Natives.x9BAE5AD2508DF078(1);    // SET_INSTANCE_PRIORITY_MODE, so we set the props
                Functions.IsInRiot = ConfigurationHandler.Config.Riot;

                Logger.Info("Main", "Map loaded. Changing player model...");
#if DEBUG
                var model = new Model("mp_f_freemode_01"); // request the model (for god sake)
                model.LoadAndWait();
                Game.LocalPlayer.Model = model;
                Game.LogTrivial("WARNING: IF YOU ARE STILL IN CONSOLE, EXIT THE CONSOLE, NOW!!!");
                Game.LogTrivial("WARNING: IF YOU ARE STILL IN CONSOLE, EXIT THE CONSOLE, NOW!!!");
                Game.LogTrivial("WARNING: IF YOU ARE STILL IN CONSOLE, EXIT THE CONSOLE, NOW!!!");
                GameFiber.Wait(500);
                Game.LocalPlayer.Character.IsVisible = true; // It has to be set to visible manually
                model.Dismiss();
                NextGenCharacter.ApplyNextGenCharFeatures(Game.LocalPlayer.Character);
#else
                Game.LocalPlayer.Model = "a_m_m_bevhills_02";
#endif
                Game.FadeScreenOut(1000);
                GameFiber.Sleep(1000);
                Logger.Info("Main", "Changed the model, setting up game");
                Game.LocalPlayer.Character.Position = new Vector3(459.8501f, -1001.404f, 24.91487f);
                Game.LocalPlayer.Character.Inventory.GiveFlashlight();
                Game.LocalPlayer.Character.Inventory.GiveNewWeapon(WeaponHash.Pistol, 50, true);
                Game.MaxWantedLevel = 0;
                GameContentUtils.SetRelationship(Difficulty.Initial);
                Functions.BlackoutStatus = true;
                EventManager.RegisterEvent(typeof(ArmedPed));

                Logger.Info("Main", "GameFiber > MenuManager.FiberInit > Creating & Starting Instance");
                GameFiber.StartNew(MenuManager.FiberInit, "MenuManager");
                Logger.Info("Main", "GameFiber > GameManager.ProcessEach100 > Creating & Starting Instance");
                process = GameFiber.StartNew(GameManager.ProcessEach100, "Process");
                Logger.Info("Main", "GameFiber > HungryManager.FiberNew > Creating & Start Instance");
                HungryUtils.StartFiber();
                Logger.Info("Main", "GameFiber > ShopManager.Fiber > Creating & Starting Instance");
                shops = GameFiber.StartNew(ShopManager.Loop, "ShopManager");
                Logger.Info("Main", "GameFiber > RespawnManager.Loop() > Starting");
                GameFiber.StartNew(RespawnManager.Loop);

                GameFiber.Sleep(5000);
                Game.FadeScreenIn(1000);
#if DEBUG
                Logger.Info("Main", "Loading Plug-ins");
                PluginManager.LoadPlugins();
#endif
                Logger.Info("Main", "DONE!");
                Game.DisplayHelp("Welcome to NoArtifactLights!");

                NativeFunction.Natives.x92F0DA1E27DB96DC(210); // set notification colors
                Game.DisplayNotification("You have currently playing the ~h~RAGE Plug-in Hook~s~ version.");

                NativeFunction.Natives.x92F0DA1E27DB96DC(6);
                Game.DisplayNotification("~h~WARNING~w~: PoC next-gen character is active.");

                GameFiber.Hibernate();
            }
            catch (ThreadAbortException)
            {
                Logger.Info("Main", "Someone is aborting our thread");
            }
            catch (Exception ex)
            {
                Game.DisplayHelp("There was an error prevents NAL from loading. See the log for more information.");
                Game.LogTrivial(ex.ToString());
                Game.LogTrivial("------------------- END OF CURRENT STATE -------------------");
                throw;
            }
            finally
            {
                Common.InstanceRunning = false;
                PluginManager.Finally();
            }
        }
예제 #21
0
        private static void  VanillaALPR()
        {
            Function.LogDebug("Executing VanillaALPR");
            bool shouldRun = true;

            OnStopAlprVanilla += (sender, args) =>
            {
                shouldRun = !shouldRun;
            };
            while (true)
            {
                while (shouldRun)
                {
                    var vehicle = Game.LocalPlayer.LastVehicle;
                    if (vehicle != null && vehicle.Exists() && vehicle.HasDriver && vehicle.Driver == Game.LocalPlayer.Character)
                    {
                        Vector3 front        = Game.LocalPlayer.Character.GetOffsetPositionFront(ReadDistanceThreshold);
                        Vector3 rear         = Game.LocalPlayer.Character.GetOffsetPositionFront((0 - vehicle.Width) - ReadDistanceThreshold);
                        Vector3 driver       = Game.LocalPlayer.Character.GetOffsetPositionRight((0 - vehicle.Length) - ReadDistanceThreshold);
                        Vector3 passenger    = Game.LocalPlayer.Character.GetOffsetPositionRight(ReadDistanceThreshold);
                        var     nearVehicles = World.EnumerateVehicles()
                                               .Where(x => x != vehicle && !ALPR_Detected.Exists(y => y.Vehicle == x) && x.IsOnScreen)
                                               .Where(x => x.DistanceTo(Game.LocalPlayer.Character.Position) <= ReadDistanceThreshold * 3)
                                               .Where(x => x.IsCar && x.ShouldVehiclesYieldToThisVehicle)
                                               .Select(x =>
                        {
                            Function.LogDebug(String.Format("Detected plate: {0}", x.LicensePlate));
                            return(x);
                        });
                        if (nearVehicles != null)
                        {
                            var handler = (EventHandler <ALPR_Arguments>)OnAlprVanillaMessage;
                            foreach (var x in nearVehicles)
                            {
                                ALPR_Arguments entry = null;
                                if (x.Position.DistanceTo(front) <= ReadDistanceThreshold)
                                {
                                    Function.LogDebug("Vehicle detected FRONT");
                                    entry = new ALPR_Arguments(x, ALPR_Position.FRONT);
                                }
                                else if (x.Position.DistanceTo(rear) <= ReadDistanceThreshold)
                                {
                                    Function.LogDebug("Vehicle detected REAR");
                                    entry = new ALPR_Arguments(x, ALPR_Position.REAR);
                                }
                                else if (x.Position.DistanceTo(driver) <= ReadDistanceThreshold)
                                {
                                    Function.LogDebug("Vehicle detected DRIVER");
                                    entry = new ALPR_Arguments(x, ALPR_Position.DRIVER);
                                }
                                else if (x.Position.DistanceTo(passenger) <= ReadDistanceThreshold)
                                {
                                    Function.LogDebug("Vehicle detected PASSENGER");
                                    entry = new ALPR_Arguments(x, ALPR_Position.PASSENGER);
                                }

                                if (entry != null)
                                {
                                    AddAlprScan(entry);
                                    var data = LookupVehicle(entry.Vehicle);
                                    if (data != null && data.PedPersona.Wanted)
                                    {
                                        var msg = String.Format("~r~Wanted Owner:~w~ {0} {1} {2}", data.Vehicle.Model.Name, data.Vehicle.LicensePlate, data.PedPersona.FullName);
                                        Game.DisplayNotification(msg);
                                        Function.Log(msg);
                                    }
                                    if (handler != null)
                                    {
                                        handler(null, entry);
                                    }
                                }
                            }
                        }
                    }
                    GameFiber.Yield();
                }
                GameFiber.Hibernate();
            }
        }
예제 #22
0
        public static void Main()
        {
            // Create a fiber to process our menus
            MenusProcessFiber = new GameFiber(ProcessLoop);

            // Create the MenuPool to easily process our menus
            menuPool = new MenuPool();

            // Create our main menu
            mainMenu = new UIMenu("RAGENative UI", "~b~RAGENATIVEUI SHOWCASE");

            // Add our main menu to the MenuPool
            menuPool.Add(mainMenu);

            // create our items and add them to our main menu
            mainMenu.AddItem(ketchupCheckbox = new UIMenuCheckboxItem("Add ketchup?", false, "Do you wish to add ketchup?"));

            mainMenu.AddItem(dishesListItem = new UIMenuListItem("Food", "",
                                                                 "Banana",
                                                                 "Apple",
                                                                 "Pizza",
                                                                 "Quartilicious",
                                                                 0xF00D));
            mainMenu.AddItem(cookItem = new UIMenuItem("Cook!", "Cook the dish with the appropiate ingredients and ketchup."));

            var menuItem = new UIMenuItem("Go to another menu.");

            mainMenu.AddItem(menuItem);
            cookItem.SetLeftBadge(UIMenuItem.BadgeStyle.Star);
            cookItem.SetRightBadge(UIMenuItem.BadgeStyle.Tick);

            carsList = new UIMenuListItem("Cars Models", "",
                                          "Adder",
                                          "Bullet",
                                          "Police",
                                          "Police2",
                                          "Asea",
                                          "FBI",
                                          "FBI2",
                                          "Firetruk",
                                          "Ambulance",
                                          "Rhino");
            mainMenu.AddItem(carsList);

            spawnCar = new UIMenuItem("Spawn Car");
            mainMenu.AddItem(spawnCar);

            coloredItem = new UIMenuItem("Color!");
            mainMenu.AddItem(coloredItem);

            mainMenu.RefreshIndex();

            mainMenu.OnItemSelect     += OnItemSelect;
            mainMenu.OnListChange     += OnListChange;
            mainMenu.OnCheckboxChange += OnCheckboxChange;
            mainMenu.OnIndexChange    += OnItemChange;

            // Create another menu
            newMenu = new UIMenu("RAGENative UI", "~b~RAGENATIVEUI SHOWCASE");
            newMenu.CounterOverride = "Counter Override";
            menuPool.Add(newMenu);       // add it to the menu pool
            for (int i = 0; i < 35; i++) // add items
            {
                newMenu.AddItem(new UIMenuItem("PageFiller " + i.ToString(), "Sample description that takes more than one line. More so, it takes way more than two lines since it's so long. Wow, check out this length!"));
            }
            newMenu.RefreshIndex();
            mainMenu.BindMenuToItem(newMenu, menuItem); // and bind it to an item in our main menu

            // Start our process fiber
            MenusProcessFiber.Start();

            // Continue with our plugin... in this example, hibernate to prevent it from being unloaded
            GameFiber.Hibernate();
        }
예제 #23
0
 private static void Main()
 {
     Game.LogTrivial("Loaded Cayo Perico Loader");
     GameFiber.Hibernate();
 }
 public static void Main()
 {
     SetNorthYanktonEnabled(true);
     GameFiber.Hibernate();
 }
예제 #25
0
        private void EventLoop()
        {
            m_Looping    = true;
            m_Generating = true;

            GameFiber.StartNew(delegate
            {
                Game.LogTrivial("[EE] EvenController Starting thread #2.");
                while (m_Looping)
                {
                    if (Game.IsKeyDown(Keys.F7) && !Game.IsAltKeyDownRightNow)
                    {
                        SetSpecificEvent(typeof(Events.Shooting));
                    }

                    if (Game.IsKeyDown(Keys.F7) && Game.IsAltKeyDownRightNow)
                    {
                        Main.ResourceManager.RemoveAll();
                    }

                    if (m_ActiveEvent == null)
                    {
                        if (!m_Generating)
                        {
                            m_Looping = false;
                            Game.LogTrivial("[EE] EvenController stopping thread #2");
                            GameFiber.Hibernate();
                        }
                        else
                        {
                            //generate new events.
                            if (m_TimeBetween == 0)
                            {
                                m_TimeBetween = Random.Next(m_MinTimeBetween, m_MaxTimeBetween);
                            }

                            if (m_TimeBetweenTimer >= m_TimeBetween)//gen event
                            {
                                Type type = m_Events[Random.Next(0, m_Events.Count)];
                                Event e   = (Event)Activator.CreateInstance(type);

                                bool ev = e.Start();
                                if (ev)
                                {
                                    m_ActiveEvent = e;
                                }

                                m_TimeBetweenTimer = 0;
                            }
                            else
                            {
                                m_TimeBetweenTimer += Game.FrameTime;
                            }
                        }
                    }
                    else
                    {
                        m_ActiveEvent.Update();

                        if (Game.IsKeyDownRightNow(Keys.End))
                        {
                            m_ActiveEvent.End();
                            m_ActiveEvent = null;
                        }
                    }

                    GameFiber.Yield();
                }
                GameFiber.Yield();
            });
        }
예제 #26
0
        public static void Main()
        {
            GameFiber.StartNew(delegate
            {
                // Initialize plugin
                Game.DisplayHelp("Hit the G key to start the assasination.");
                Game.DisplayNotification("matsn0w Modding plugin successfully loaded");
                Game.LogTrivial("matsn0w Modding plugin has loaded successfully.");

                // User hits button and a spawned ped drives to the player to kill him.
                while (true)
                {
                    // Wait for the user to hit the G key
                    GameFiber.Yield();
                    if (Game.IsKeyDown(System.Windows.Forms.Keys.G))
                    {
                        // Stop waiting, launch the event
                        break;
                    }

                    Game.LogTrivial("G key pressed!");
                    Game.HideHelp();

                    // Create new ped (the attacker) which is a SWAT guy, 10m in front of the player, heading towards the player
                    Ped attacker_ped = new Ped("s_m_y_swat_01", Game.LocalPlayer.Character.GetOffsetPositionFront(10f), Game.LocalPlayer.Character.Heading + 180f);

                    // Create new vehicle (for the attacker) which is a mesa, 15m in front of the player, heading towards the player
                    Vehicle attacker_veh = new Vehicle("mesa", Game.LocalPlayer.Character.GetOffsetPositionFront(15f), Game.LocalPlayer.Character.Heading + 180f);

                    // Prevent the attacker from being deleted by GTA
                    attacker_ped.BlockPermanentEvents = true;
                    attacker_ped.IsPersistent         = true;

                    // Prevent the attacker's vehicle from being deleted by GTa
                    attacker_veh.IsPersistent = true;

                    // Make the attacker get into the vehicle
                    attacker_ped.Tasks.EnterVehicle(attacker_veh, 10000, -1).WaitForCompletion(10000);

                    // Make the attacker drive towards the player
                    attacker_ped.Tasks.DriveToPosition(Game.LocalPlayer.Character.Position, 15f, VehicleDrivingFlags.Emergency).WaitForCompletion(10000);

                    // Make the attacker get out of the vehicle
                    attacker_ped.Tasks.LeaveVehicle(LeaveVehicleFlags.None).WaitForCompletion(6000);

                    // Give the attacker a pistol
                    attacker_ped.Inventory.GiveNewWeapon("WEAPON_PISTOL", -1, true);

                    // Make the attacker fight the player
                    attacker_ped.Tasks.FightAgainst(Game.LocalPlayer.Character);

                    Game.LogTrivial("Let the game begin!");

                    // Check if either the player or the attacker is dead
                    while (true)
                    {
                        GameFiber.Yield();

                        if (Game.LocalPlayer.Character.IsDead || attacker_ped.IsDead)
                        {
                            break;
                        }

                        Game.LogTrivial("Someone's dead!");

                        // Clean up the game
                        if (attacker_ped.Exists())
                        {
                            attacker_ped.Dismiss();
                        }

                        // Stop the GameFiber
                        GameFiber.Hibernate();

                        Game.LogTrivial("Bye!");
                    }
                }
            });
        }