Log in to reply
 

[C#][NativeUI] How to create a mod menu using NativeUI(Part 3)



  • Hello guys, this is the part 3 of how to create a mod menu series.

    REQUIREMENTS:
    Need to follow the last two tutorials.

    Without further ado, lets start off with a Remove All Weapons feature, as promised. Keep in mind though, we will be using natives. Like every other function, lets create a new method for that function, which is RemoveAllWeapons():
    alt text
    Lets now create an Item, and an array to hold all of the weapons in the game:
    alt text
    Now we will add the item to the menu, and create the OnItemSelect event:
    alt text
    Now, we will check if the player has a certain weapon, like this, in a foreach loop of course, and call a Remove function:
    alt text
    Now, if we put the function in SetupWeaponFunctions():
    alt text
    And test it, there is a little bit of a bug:
    alt text
    As you can see, we dont have an unarmed weapon, whatever you call it, and you cant punch people. So, we need to add an if statement, if the weapon hash isnt unarmed, like this:
    alt text
    That fixes this bug, and so removing all weapons feature is complete. Next thing thing that is ESSENTIAL for a mod menu, is a vehicle color chooser, which is really like all of the selectors. First off, we will make a submenu, a list for both primary and secondary colors, and also put them in an array:
    alt text
    And now lets do the for loop to put everything in the lists:
    alt text
    Now, instead of doing a button, we will do a OnListChange. which gets called every time you select a new item in the list. I think that is an awesome way to do this, so lets first do it for the primarycolor:
    alt text
    Since this works, we will copy this code to make it for secondary as well:
    alt text
    And also, dont forget to add the function to the SetupVehicleFunctions() list!
    alt text
    Lets now work on a God Mode for the Player, which is quite easy. Remember, I am making a tutorial for a fully fledged Mod Menu, so this is important :D This is the whole and easy code for god mode:
    alt text
    We have a bool, which we put outside of the godModeOn function. We make the button, and do everything, and in the OnItemSelect event, we check if the button pressed is our button. If it is, we toggle between godModeOn. If it is true, we set our invincibility to true, and set the text. If false, we do the opposite. Simple enough, right?

    The final thing we will do now, is a Never Wanted button, with the same principal as above:
    alt text
    For this one, we will utilize the tick function, always setting our wanted level to 0, if the bool is true. But first, we have to toggle it!
    alt text
    And now, in our onTick, we make a simple if statement:
    alt text
    Done! We will keep doing new features for our mod menu, and keep modding it until we have a good menu setup. Until then, bye!



  • @GTAVModder4Life :thumbsup: man, i love your tutorials :)
    hint: you write part 4 instead of part 3 in your first sentence ;)
    yes i read every word :sweat_smile:



  • Oops xD @TobsiCred



  • Nice Tutorial like every of you tutorials :) maybe you come in skype online than i can explain it to you what i mean with Ceate PickUps !



  • @Eugenius of course, add me:
    ahk1224



  • When i enable the God Mode option in my menu it also enables Never Wanted. Any idea how to fix this?


  • MODERATOR

    @AHK1221 To remove all weapons simply call Game.Player.Character.Weapons.RemoveAll();


  • MODERATOR

    @MayhemGaming Show your code.



  • @Jitnaught Thanks!


Log in to reply
 

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