guiComboBoxGetItemCount | Multi Theft Auto: Wiki Skip to content

guiComboBoxGetItemCount

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function returns the number of items in a combo box.

Syntax

guiComboBoxGetItemCount ( )

Code Examples

client

This example creates a gui combo box, fills it with the names of the connected players and prints the number of items (players) in the chatbox.

addEventHandler('onClientResourceStart',resourceRoot,function()
local playersList = guiCreateComboBox(0.35,0.40,0.31,0.20,'Players',true) -- create gui combo box
for key,player in ipairs(getElementsByType('player')) do -- get the connected players
guiComboBoxAddItem(playersList, getPlayerName(player)) -- add players name to the combo box
end
local playersCount = guiComboBoxGetItemCount(playersList) -- get the number of items
outputChatBox('Number of connected players: '..playersCount) -- show info on chatbox
end)

See Also

GUI Functions