OnClientMTAFocusChange

From Multi Theft Auto: Wiki
Revision as of 14:58, 8 October 2022 by LopSided (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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)

Requirements

Minimum server version n/a
Minimum client version 1.5.9-9.21313

Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version client="1.5.9-9.21313" />

See Also

Client other events


Client event functions