guiGetProperty | Multi Theft Auto: Wiki Skip to content

guiGetProperty

Client-side
Server-side
Shared

Pair: guiSetProperty

This function gets the value of a specific CEGUI property of a GUI element. For a list of properties and their meaning, see the CEGUI properties page.

OOP Syntax Help! I don't understand this!

Syntax

string|false guiGetProperty ( ​gui-element guiElement, ​string property )
Required arguments
  • guiElement: The GUI element you wish to get a property of.
  • property: The name of property you want the value of.

Returns

If the function succeeds, it returns a string with the value of the property. If it fails, it returns false.

  • string|false: property value

Code Examples

client

This example creates a button when the resource starts and defines a console command that toggles it between enabled (clickable) and disabled (not clickable).

local button
addEventHandler("onClientResourceStart", resourceRoot, function()
button = guiCreateButton(20, 200, 150, 30, "Test", false)
end)
addCommandHandler("togglebtn", function()
local currentState = guiGetProperty(button, "Disabled")
if currentState == "False" then
guiSetProperty(button, "Disabled", "True")
else
guiSetProperty(button, "Disabled", "False")
end
end)

See Also

GUI Functions