mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
feat(client): Text UI functions
This commit is contained in:
14
resource/interface/client/textui.lua
Normal file
14
resource/interface/client/textui.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
function lib.showTextUI(text, options)
|
||||
if not options then options = {} end
|
||||
options.text = text
|
||||
SendNUIMessage({
|
||||
action = 'textUi',
|
||||
data = options
|
||||
})
|
||||
end
|
||||
|
||||
function lib.hideTextUI()
|
||||
SendNUIMessage({
|
||||
action = 'textUiHide'
|
||||
})
|
||||
end
|
||||
@@ -33,6 +33,7 @@ const TextUI: React.FC = () => {
|
||||
const [visible, setVisible] = React.useState(false);
|
||||
|
||||
useNuiEvent<Props>("textUi", (data) => {
|
||||
if (!data.position) data.position = "right-center"; // Default right position
|
||||
setData(data);
|
||||
setVisible(true);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user