forked from Simnation/Main
55 lines
1.3 KiB
Lua
55 lines
1.3 KiB
Lua
![]() |
if not ESX then
|
||
|
local exportExists, obj = pcall(function()
|
||
|
return exports.es_extended:getSharedObject()
|
||
|
end)
|
||
|
|
||
|
if exportExists then
|
||
|
ESX = obj
|
||
|
else
|
||
|
TriggerEvent('esx:getSharedObject', function(esx)
|
||
|
ESX = esx
|
||
|
end)
|
||
|
|
||
|
while not ESX do
|
||
|
Wait(100)
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
local HELP_TEXT <const> = {
|
||
|
keyboard = GetLocalization('help_text_keyboard', '~INPUT_89560A13~'),
|
||
|
controller = GetLocalization('help_text_controller', '~INPUT_5FCAA612~')
|
||
|
}
|
||
|
|
||
|
local isShowingHelpText = false
|
||
|
|
||
|
---Displays the slash tire help text for the next 25 ticks
|
||
|
local function showHelpText()
|
||
|
local isUsingKeyboard = IsUsingKeyboard(1)
|
||
|
local message = (isUsingKeyboard and HELP_TEXT.keyboard) or HELP_TEXT.controller
|
||
|
|
||
|
for _tick = 1, 25 do
|
||
|
ESX.ShowHelpNotification(message, true)
|
||
|
Wait(0)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
---Runs a thread to show the help text
|
||
|
local function helpTextThread()
|
||
|
while isShowingHelpText do
|
||
|
showHelpText()
|
||
|
Wait(0)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
---Starts showing the help text
|
||
|
function StartHelpText()
|
||
|
isShowingHelpText = true
|
||
|
CreateThread(helpTextThread)
|
||
|
end
|
||
|
|
||
|
---Stops showing the help text
|
||
|
function StopHelpText()
|
||
|
isShowingHelpText = false
|
||
|
end
|