[C#][NativeUI] How to create a mod menu using NativeUI(Part 2)
-
Yes, I have a lot of time on my hands
Hello guys, this is the part two of the mod menu creation series, I was bored and want to do it now
Requirements:
Need to follow the last tutorial to keep up.In the last one, we left off at a simple weapon selector and a reset wanted level. First thing I want to do is re-organize some stuff, like put the Reset Wanted Level into its own Player submenu and the Weapon Selector in its own Weapon submenu. Lets start by adding the UIMenu variables:
Now, lets edit the Setup function a bit:
I also want to edit one more thing, I want to add different functions to setup the functions, like this:
Now, let's cleanup some code, like we did for the weapon selector, and put everything in one function(for the reset wanted level, of course):
I removed the other onMainMenuItemSelect code, since it was useless now. This is what the code looks like now, and I would say it is very more readable. We also need to change one line of code in our Weapon Selector:
Also we should remove the call to WeaponSelectorMenu() in the constructor, and instead put the SetupPlayerWeapons in the setup:
Everything is good now! Lets now make a new Vehicle menu, and add a Vehicle Selector(like the Weapon selector) and also a way to spawn by name. Lets start with the menu:
And lets edit our Setup function:
Lets now make a SetupVehicleFunction method:
Awesome! Now here we will put all our Vehicle functions. Lets start by the Vehicle Selector:
NOTE: I messed up, and put weaponsMenu in the AddSubMenu function. Make sure to put vehiclesMenu!!!!!
It is like the weapon selector, so i skipped most of it. But now, lets spawn our selecter vehicle and warp our player into it:
Lets put this function in our SetupVehicleFunction, and lets test this:
:
Game.GetUserInput
hey i want to get intiger type values from user and want to use it in my script then what should i do
-
@harshil You can get the string from GetUserInput and then parse it into an integar by using int.TryParse or int.Parse.
-
@AHK1221 ok but if user add number as sting and i convert it into intiger then is it posible that the number is chenged because of it's ASCI value or somthing else
-
@harshil It shouldn't be. Whenever I've tried it it worked fine.
-
@AHK1221 ok thank you
-
Thanks this is very indept and it all still works as of August 29th 2019 but I was wondering if you were going to make more and if you did please link.
-
This post is deleted!