mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-09-02 11:18:58 +00:00
reset branch
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
local function hideText()
|
||||
SendNUIMessage({
|
||||
action = 'HIDE_TEXT',
|
||||
})
|
||||
end
|
||||
|
||||
local function drawText(text, position)
|
||||
if type(position) ~= 'string' then position = 'left' end
|
||||
|
||||
SendNUIMessage({
|
||||
action = 'DRAW_TEXT',
|
||||
data = {
|
||||
text = text,
|
||||
position = position
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
local function changeText(text, position)
|
||||
if type(position) ~= 'string' then position = 'left' end
|
||||
|
||||
SendNUIMessage({
|
||||
action = 'CHANGE_TEXT',
|
||||
data = {
|
||||
text = text,
|
||||
position = position
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
local function keyPressed()
|
||||
CreateThread(function() -- Not sure if a thread is needed but why not eh?
|
||||
SendNUIMessage({
|
||||
action = 'KEY_PRESSED',
|
||||
})
|
||||
Wait(500)
|
||||
hideText()
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterNetEvent('qb-core:client:DrawText', function(text, position)
|
||||
drawText(text, position)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('qb-core:client:ChangeText', function(text, position)
|
||||
changeText(text, position)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('qb-core:client:HideText', function()
|
||||
hideText()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('qb-core:client:KeyPressed', function()
|
||||
keyPressed()
|
||||
end)
|
||||
|
||||
exports('DrawText', drawText)
|
||||
exports('ChangeText', changeText)
|
||||
exports('HideText', hideText)
|
||||
exports('KeyPressed', keyPressed)
|
||||
Reference in New Issue
Block a user