guiSetAlpha | Multi Theft Auto: Wiki Skip to content

guiSetAlpha

Client-side
Server-side
Shared

Pair: guiGetAlpha

Manual Review Required

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


This changes the alpha level (the visibleness/transparency) of a GUI element

OOP Syntax Help! I don't understand this!

  • Method: guielement:setAlpha(...)
  • Variable: .alpha

Syntax

bool guiSetAlpha ( element guielement, float alpha )
Required Arguments
  • guielement: MISSING_PARAM_DESC
  • alpha: The visibility/transparency of the GUI element. Ranges from 0 (fully transparent) to 1 (fully opaque). Default value is 0.80.

Returns

  • bool: value

Returns true if the gui element's alpha was successfully changed, false otherwise.

Code Examples

shared

This creates a GUI window and allows a player to change it's alpha (the visibleness/transparency) value with a command.

--Create a gridlist
myWindow = guiCreateWindow ( 0.30, 0.10, 0.5, 0.60, "GUI window title", true )
--Add a command handler to change the alpha of the GUI window.
--Usage example: '/alpha 0.8', where 0.8 is stored as alphaAmount
function changeAlpha ( commandName, alphaAmount )
alphaAmount = tonumber(alphaAmount)
guiSetAlpha ( myWindow, alphaAmount )
end
addCommandHandler ( "alpha", changeAlpha )

See Also

GUI Functions