[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.
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():
Lets now create an Item, and an array to hold all of the weapons in the game:
Now we will add the item to the menu, and create the OnItemSelect event:
Now, we will check if the player has a certain weapon, like this, in a foreach loop of course, and call a Remove function:
Now, if we put the function in SetupWeaponFunctions():
And test it, there is a little bit of a bug:
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:
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:
And now lets do the for loop to put everything in the lists:
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:
Since this works, we will copy this code to make it for secondary as well:
And also, dont forget to add the function to the SetupVehicleFunctions() list!
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 This is the whole and easy code for god mode:
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:
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!
And now, in our onTick, we make a simple if statement:
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 man, i love your tutorials
hint: you write part 4 instead of part 3 in your first sentence
yes i read every word
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: