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
| Name | Type | Description |
|---|---|---|
| focused | bool | true to give focus to this resource's page, false to take focus from any page. |
| cursor | bool | Whether 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)Note
cursor currently changes nothing: with focus, the page always gets the pointer.