guiRadioButtonGetSelected | Multi Theft Auto: Wiki Skip to content

guiRadioButtonGetSelected

Client-side
Server-side
Shared

Pair: guiRadioButtonSetSelected

This function gets a radio button's selection state.

OOP Syntax Help! I don't understand this!

Syntax

bool guiRadioButtonGetSelected ( ​gui-radiobutton guiRadioButton )
Required arguments
  • guiRadioButton: The radio button you wish to retrieve the selection state of.

Returns

Returns true if the radio button is selected, false if it is not.

  • bool: result

Code Examples

client
local label = guiCreateLabel(0.3, 0.35, 0.1, 0.025, "What's your favorite color?", true)
local blue = guiCreateRadioButton(0.3, 0.4, 0.03, 0.015, 'Blue', true)
local green = guiCreateRadioButton(0.3, 0.45, 0.03, 0.015, 'Green', true)
local red = guiCreateRadioButton(0.3, 0.5, 0.03, 0.015, 'Red', true)
addEventHandler('onClientGUIClick', resourceRoot, function()
if (source ~= label) then
local selected = guiRadioButtonGetSelected(source)
if (selected) then
outputChatBox('Oh! Your favorite color is: '..guiGetText(source))
end
end
end)

See Also

GUI Functions