Hello,
I am trying to create a GTA V Menu using NativeUI, when trying to add a subtitle with UI.ShowSubtitle("Text"); I get the error "The name 'UI' does not exist in the current context"
Here is my code:
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing;
using GTA;
using GTA.Native;
using GTA.Math;
using NativeUI;
namespace ModMenu
{
public class Class1 : Script
{
MenuPool modMenuPool;
UIMenu mainMenu;
UIMenuItem resetWantedLevel;
public Class1()
{
Setup();
Tick += OnTick;
KeyDown += OnKeyDown;
}
void Setup()
{
modMenuPool = new MenuPool();
mainMenu = new UIMenu("Mod Menu", "SELECT AN OPTION");
modMenuPool.Add(mainMenu);
resetWantedLevel = new UIMenuItem("Reset Wanted Level");
mainMenu.AddItem(resetWantedLevel);
mainMenu.OnItemSelect += OnMainMenuItemSelect;
}
void OnMainMenuItemSelect(UIMenu sender, UIMenuItem item, int index)
{
if (item == resetWantedLevel)
{
if (Game.Player.WantedLevel == 0)
{
UI.ShowSubtitle("You are not wanted");
}
else
{
Game.Player.WantedLevel = 0;
}
}
}
void OnTick(object sender, EventArgs e)
{
if (modMenuPool != null)
modMenuPool.ProcessMenus();
}
void OnKeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.H && !modMenuPool.IsAnyMenuOpen())
{
mainMenu.Visible = !mainMenu.Visible;
}
}
}
}
Display More