OnClientMTAFocusChange: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
(Remove obsolete Requirements section)
 
Line 22: Line 22:
addEventHandler("onClientMTAFocusChange", root, onClientMTAFocusChange)
addEventHandler("onClientMTAFocusChange", root, onClientMTAFocusChange)
</syntaxhighlight>
</syntaxhighlight>
==Requirements==
{{Requirements|n/a|1.5.9-9.21313|}}


==See Also==
==See Also==

Latest revision as of 17:33, 7 November 2024

This event is triggered every time the MTA window gains or loses focus.

Parameters

bool windowFocused
  • windowFocused: A boolean, indicating whether the MTA window is focused or not.

Source

The source of this event is the root element.

Example

This example prints message on chat with focus state:

function onClientMTAFocusChange(windowFocused)
    local focusedText = windowFocused and "MTA has gained focus." or "MTA has lost focus."

    outputChatBox(focusedText)
end
addEventHandler("onClientMTAFocusChange", root, onClientMTAFocusChange)

See Also

Client other events


Client event functions