guiSetProperty | Multi Theft Auto: Wiki Skip to content

guiSetProperty

Client-side
Server-side
Shared

Pair: guiGetProperty

This function sets 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

bool guiSetProperty ( ​gui-element guiElement, ​string property, ​string value )
Required arguments
  • guiElement: The GUI element you wish to get a property of.
  • property: The name of of property you want the value of.
  • value: The new value for the property.

Returns

If the function succeeds it returns true, if it fails it returns false.

  • bool: result

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
function onStart()
button = guiCreateButton(20, 200, 150, 30, "Test", false)
end
addEventHandler("onClientResourceStart", resourceRoot, onStart)
function toogleButton()
local currentState = guiGetProperty(button, "Disabled")
if currentState == "False" then
guiSetProperty(button, "Disabled", "True")
else
guiSetProperty(button, "Disabled", "False")
end
end
addCommandHandler("togglebtn", toogleButton)

See Also

GUI Functions