DgsMenuRemoveItem

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

This function removes an item from a DGS menu element.

Syntax

bool dgsMenuRemoveItem ( element menu, int uniqueID )

Required Arguments

  • menu: The DGS menu element from which to remove the item
  • uniqueID: The unique ID of the menu item to remove (returned by dgsMenuAddItem)

Returns

Returns true if the item was successfully removed, false if the item with the specified uniqueID was not found.

Examples

loadstring(exports.dgs:dgsImportFunction())()-- load functions

-- Create a menu with items
local menu = dgsCreateMenu(200, 200, 200, 150, false)
local item1 = dgsMenuAddItem(menu, "Option 1", "command1")
local item2 = dgsMenuAddItem(menu, "Option 2", "command2")
local item3 = dgsMenuAddItem(menu, "Option 3", "command3")

-- Remove the second item
local removeItem = dgsMenuRemoveItem(menu, item2)


-- Show the menu (item2 will not be visible)
dgsMenuShow(menu)

See Also

Author

Mohab.