Made the following changes:
CLIENT:
local input = true -- Useless stuff
RegisterNetEvent("triggerMecanich")
AddEventHandler("triggerMecanich",function()
DisplayOnscreenKeyboard(false, "FMMC_KEY_TIP8", "", "", "", "", "", 60)
Citizen.CreateThread(function()
while input do
if input == true then
--HideHudAndRadarThisFrame() -- NO FUNCTION IS CALLED CUZ IT DOESN'T EXIST
if UpdateOnscreenKeyboard() == 1 then
local inputText = GetOnscreenKeyboardResult()
if string.len(inputText) > 0 then
TriggerServerEvent('syncMechanic', inputText)
--input = false
else
DisplayOnscreenKeyboard(false, "FMMC_KEY_TIP8", "", "", "", "", "", 60)
end
--elseif UpdateOnscreenKeyboard() == 2 then
--input = false
end
end
Citizen.Wait(0)
end
end)
end)
RegisterNetEvent('displayMecanich')
AddEventHandler('displayMecanich',function(inputText)
SetNotificationTextEntry("STRING");
AddTextComponentString(inputText);
SetNotificationMessage("CHAR_LS_CUSTOMS", "CHAR_LS_CUSTOMS", true, 1, "~y~Mechanic Service:~s~", "");
DrawNotification(false, true);
end)
SERVER:
RegisterServerEvent("syncMechanic")
AddEventHandler('syncMechanic', function(inputText)
TriggerClientEvent('displayMecanich', -1, inputText)
end)
AddEventHandler('chatMessage', function(from, name, message)
if message == "/mechanic" then
CancelEvent()
TriggerClientEvent("triggerMecanich", from)
end
end)
Please explain to me why you got functions that don’t even exist, such as:
- HideHudAndRadarThisFrame()
And also why did you even do:
if input == true then
When you already triggered:
while input do
Some stuff in this code doesn’t make sense to me.
Use those changes however you’d like to, best regards.