M MY Multiplayer: Wiki
Side
Kind

setNuiFocus

Client

Gives or takes focus from the calling resource's interface page. With focus, the page gets the mouse and the keyboard.

bool setNuiFocus(bool focused [, bool cursor = true])

Parameters

NameTypeDescription
focusedbooltrue to give focus to this resource's page, false to take focus from any page.
cursorboolWhether the cursor should show with the focus.default true

Returns

Always true, unless an argument is wrong.

Only one page has focus at a time. While a page has focus, the game gets neither the mouse nor the keyboard unless setNuiKeepInput(true) is on.

Example

addCommandHandler("menu", function()
    setNuiFocus(true, true)
    sendNuiMessage({ action = "open" })
end)

registerNuiCallback("close", function(_, cb)
    setNuiFocus(false)
    cb()
end)
Notecursor currently changes nothing: with focus, the page always gets the pointer.

See also