Log in to reply
 

Mod Menu without NativeUI [PROBLEM]



  • Hi, it's been a few days since I got the idea to create a menu WITHOUT using NativeUI.

    I succeeded, the menu opens and all the functions are fine.
    But I wanted to make a swich of "on" and "off" (when I click on the god mode if it is active "on" appears and when it is deactivated it appears "off") but I have no idea how to do it!
    I tried to do this:

        public static bool on;
        public static List<UIText> MainItems = new List<UIText>();
        public static List<string> MainItemsFunction = new List<string>();``
    
    
        public static void Items(string caption, Point pos, float scale, Color color, GTA.Font font, bool centered, string function)
        {
            MainItems.Add(new UIText(caption, pos, scale, color, font, centered));
            MainItemsFunction.Add(function);
        }
    
        public static void Initialize()
        {
            Items("Immortale" + "  " + on, new Point(100, 34), 0.4f, textColor, GTA.Font.Pricedown, true, "GodMode");
            Items("Espulsione", new Point(100, 64), 0.4f, textColor, GTA.Font.Pricedown, true, "Eject");
            Items("Player Menu", new Point(100, 94), 0.4f, textColor, GTA.Font.Pricedown, true, "Player");
            Items("Test", new Point(100, 124), 0.4f, textColor, GTA.Font.Pricedown, true, "Sound");
            Items("Test", new Point(100, 154), 0.4f, textColor, GTA.Font.Pricedown, true, "Vehicle");
            Items("Test", new Point(100, 184), 0.4f, textColor, GTA.Font.Pricedown, true, "Info");
    
            container = new UIContainer(new Point(10, 50), new Size(200, 210), Colorbody);
        }
    

    Then I tried to do that when it clicked on the GodMode function, it made the player immortal and set the variable "on" to true.
    obviously, however, once the menu with the word "false" was loaded it was not changed automatically.
    To try to remedy the problem I tried to:

    after setting the variable to true, I tried to call "Initialize();", but this caused all the scripts to be reloaded completely, also returning the "on" variable to false.
    I also tried Calling "container.Draw();", this did nothing to make the menu reappear (always with the word "false")

    As you can see, I have really tried ALL of them, even meaningless things, I'm desperate and I have no idea how to do it ...
    Can someone help me?

    Sorry for my English..

    Thanks again



  • You'll have to get the god mode UIText item and set its Caption to what you'd want it to be.



  • @Jitnaught
    And how can I do this?
    Thanks for your answer :)



  • @Jitnaught I tried a few things but they didn't succeed, depending on the information you have in the post, could you tell me how you can do it?



  • There are a few ways to go about this, some better than others. One easy but bad way is to get the item from the List using a hard-coded index. A good but more complex way might be creating an "OnMenuItemPress" event that has the index and the name in the arguments, connecting your menu to that event, and using the index/name from there to call your functions.


Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.