Changelog

11/29/2018

  • Updated Documentation

06/15/2018

  • Added UIMenuSliderItem

06/14/2018

  • Fixed rectangle colors
  • Added faster navigation (Hold Up, Down or Left, Right)
  • Added counter at the top right

05/03/2018

  • Fixed numbers in UIMenuListItem items
  • Fixed description formatting when to long
  • Added ItemsCollection for future updates
  • Added BackColor, HighlightedBackColor, ForeColor and HighlightedForeColor to UIMenuItem

Example

Code

const NativeUI = require("nativeui"); const Menu = NativeUI.Menu; const UIMenuItem = NativeUI.UIMenuItem; const UIMenuListItem = NativeUI.UIMenuListItem; const UIMenuCheckboxItem = NativeUI.UIMenuCheckboxItem; const UIMenuSliderItem = NativeUI.UIMenuSliderItem; const BadgeStyle = NativeUI.BadgeStyle; const Point = NativeUI.Point; const ItemsCollection = NativeUI.ItemsCollection; const Color = NativeUI.Color; const ListItem = NativeUI.ListItem; mp.gui.cursor.visible = false; mp.gui.chat.show(false); const ui = new Menu("Test UI", "Test UI Subtitle", new Point(50, 50)); ui.AddItem(new UIMenuListItem( "List Item", "Fugiat pariatur consectetur ex duis magna nostrud et dolor laboris est do pariatur amet sint.", new ItemsCollection(["Item 1", "Item 2", "Item 3"]) )); ui.AddItem(new UIMenuSliderItem( "Slider Item", ["Fugiat", "pariatur", "consectetur", "ex", "duis", "magna", "nostrud", "et", "dolor", "laboris"], 5, "Fugiat pariatur consectetur ex duis magna nostrud et dolor laboris est do pariatur amet sint.", true )); ui.AddItem(new UIMenuCheckboxItem( "Checkbox Item", false, "Fugiat pariatur consectetur ex duis magna nostrud et dolor laboris est do pariatur amet sint." )); ui.ItemSelect.on(item => { if (item instanceof UIMenuListItem) { console.log(item.SelectedItem.DisplayText, item.SelectedItem.Data); } else if (item instanceof UIMenuSliderItem) { console.log(item.Text, item.Index, item.IndexToItem(item.Index)); } else { console.log(item.Text); } }); // ui.SliderChange.on((item, index, value) => { // console.log(item.Text, index, value); // }); mp.keys.bind(0x71, false, () => { if (ui.Visible) ui.Close(); else ui.Open(); });

Result

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Functions

new Menu(Title, Subtitle, Offset, spriteLibrary = "commonmenu", spriteName = "interaction_bgd")

  • Functions
  • AddItem(UIMenuItem)
  • BindMenuToItem(NativeUI, UIMenuItem)
  • ReleaseMenuFromItem(UIMenuItem)
  • Open()
  • Close()
  • Events
  • IndexChange: (Index)
  • ListChange: (UIMenuListItem, Index)
  • CheckboxChange: (UIMenuCheckboxItem, Checked)
  • ItemSelect: (UIMenuItem, Index)
  • SliderChange: (UIMenuSliderItem, Index, Value)
  • MenuClose: ()
  • MenuChange: (Menu)

new UIMenuItem(Caption, Description = "")

  • Functions
  • SetLeftBadge(BadgeStyle)
  • SetRightBadge(BadgeStyle)
  • SetRightLabel(Text)
  • Variables
  • Text: String
  • Description: String
  • Enabled: Boolean
  • BackColor: Color
  • HighlightedBackColor: Color
  • ForeColor: Color
  • HighlightedForeColor: Color

new UIMenuListItem(Caption, Description = "", collection = new ItemsCollection([]), startIndex = 0) (Extends UIMenuItem)
Does not support SetRightBadge and SetRightLabel

  • Variables
  • Collection: ItemsCollection
  • SelectedItem: string
  • SelectedValue: string

new UIMenuCheckboxItem(Caption, checked = false, Description = "") (Extends UIMenuItem)
Does not support SetRightBadge and SetRightLabel

  • Variables
  • Checked: boolean
  • Events
  • CheckedChanged: (Checked)

new UIMenuSliderItem(Caption, Items, Startindex, Description = "", Divider = false) (Extends UIMenuItem)
Does not support SetRightBadge and SetRightLabel

  • Variables
  • Index: number
  • Functions
  • IndexToItem: any

new Point(X, Y)

  • Variables
  • X: number
  • Y: number

new Size(Width, Height)

  • Variables
  • Width: number
  • Height: number

new Color(Red, Green, Blue, Alpha = 255)

  • Variables
  • R: number
  • G: number
  • B: number
  • A: number

new ItemsCollection(Array)

Enums

BadgeStyle

enum BadgeStyle {
	None,
	BronzeMedal,
	GoldMedal,
	SilverMedal,
	Alert,
	Crown,
	Ammo,
	Armour,
	Barber,
	Clothes,
	Franklin,
	Bike,
	Car,
	Gun,
	Heart,
	Makeup,
	Mask,
	Michael,
	Star,
	Tatoo,
	Trevor,
	Lock,
	Tick
}

Font

enum Font {
	ChaletLondon = 0,
	HouseScript = 1,
	Monospace = 2,
	CharletComprimeColonge = 4,
	Pricedown = 7
}