GuiComboBoxAddPlayersName
From Multi Theft Auto: Wiki
this function will be add the players name in the combo box
Syntax
guiComboBoxAddPlayersName( element combobox )
Required Arguments
- combobox: The gui-combobox element.
Source Code
Click to collapse [-]
Clientside scriptfunction guiComboBoxAddPlayersName( combo )
if( getElementType( combo ) == "gui-combobox" ) then
guiComboBoxClear ( combo )
for _, players in ipairs(getElementsByType('player')) do
guiComboBoxAddItem(combo, getPlayerName(players))
end
end
end
Example
Click to collapse [-]
Clientside script
function guiComboBoxAddPlayersName( combo )
if( getElementType( combo ) == "gui-combobox" ) then
guiComboBoxClear ( combo )
for _, players in ipairs(getElementsByType('player')) do
guiComboBoxAddItem(combo, getPlayerName(players))
end
end
end
GUIEditor = {
combobox = {}
}
local screenW, screenH = guiGetScreenSize()
GUIEditor.combobox[1] = guiCreateComboBox((screenW - 346) / 2, (screenH - 173) / 2, 346, 173, "", false)
guiSetVisible(GUIEditor.combobox[1], false)
bindKey("F3","down",
function()
if ( guiGetVisible(GUIEditor.combobox[1]) == false ) then
guiSetVisible(GUIEditor.combobox[1], true)
showCursor(true)
guiComboBoxAddPlayers( GUIEditor.combobox[1] )
else
guiSetVisible(GUIEditor.combobox[1], false)
showCursor(false)
end
end
)
author
Original Author : #Himoo
Skype : live:kdark8703