guiComboBoxRemoveItem | Multi Theft Auto: Wiki Skip to content

guiComboBoxRemoveItem

Client-side
Server-side
Shared

Pair: guiComboBoxAddItem

This function removes an item from a combobox.

OOP Syntax Help! I don't understand this!

Syntax

bool guiComboBoxRemoveItem ( ​gui-combobox comboBox, ​int itemId )
Required arguments
  • comboBox: The combobox containing the item you're interested in.
  • itemId: The index of the item to remove. Indexing starts at 0.

Returns

Returns true if the item was removed successfully, false otherwise.

  • bool: result

Code Examples

client

This example removes selected item.

local comboBox = guiCreateComboBox(10, 10, 200, 100, "Select an item", false)
guiComboBoxAddItem(comboBox, "Item 1")
guiComboBoxAddItem(comboBox, "Item 2")
addCommandHandler("remove", function()
local item = guiComboBoxGetSelected(comboBox)
if (item == -1) then
outputChatBox("No item selected!")
return
end
local text = guiComboBoxGetItemText(comboBox, item)
guiComboBoxRemoveItem(comboBox, item)
outputChatBox("Item with text " .. text .. " has been removed!")
end)

See Also

GUI Functions