okokDocs
  • About Us
  • Scripts
    • okokVehicleControl
      • Config file
    • okokMechanicJob
      • Config file
    • okokPoliceJob
      • Config file
      • qb-inventory support
    • okokBossMenu
      • Config file
    • okokMulticharacter
      • Config file
    • okokPhone
    • okokSpawnSelector
      • Config file
      • qb-multicharacter support
    • okokLoadingScreen
      • Config file
    • okokVehicleSales
      • Config file
    • okokShop
      • Config file
    • okokGasStation
      • Config file
    • okokTuning
      • Config file
    • okokGarage
      • Config file
      • RGB vehicle colors
      • Inventories metadata
      • Housing integrations
      • qb-phone support
    • okokVehicleShop
      • Config file
      • Common errors
    • okokBanking
      • Config file
      • Paycheck transactions
      • Registering transactions
    • okokMarketplace
      • Config file
      • Common errors
    • okokChat
      • Config file
      • Export
    • okokBilling
      • Config file
      • Snippets
    • okokCrafting
      • Config file
    • okokContract
      • Config file
    • okokTalkToNPC
      • Config file
    • okokReports
      • Config file
    • okokNotify
      • Config file
      • Snippets
    • okokTextUI
      • Config file
      • Snippets
    • okokRequests
    • okokDeleteVehicles
      • Config file
  • Others
    • Discord Webhook
Powered by GitBook
On this page
  • QBCore DrawText to okokTextUI
  • ESX.TextUI to okokTextUI
  1. Scripts
  2. okokTextUI

Snippets

QBCore DrawText to okokTextUI

Change the following code in qb-core/client/drawtext.lua:

local function hideText()
    exports['okokTextUI']:Close()
end

local function drawText(text, _)
    exports['okokTextUI']:Open(text, 'darkblue', 'right')
end

-- local function changeText(text, position) -- Can't use
--     if type(position) ~= "string" then position = "left" end

--     SendNUIMessage({
--         action = 'CHANGE_TEXT',
--         data = {
--             text = text,
--             position = position
--         }
--     })
-- end

local function keyPressed()
    CreateThread(function() -- Can't use
        --[[ 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) -- Can't use
--     changeText(text, position)
-- end)

RegisterNetEvent('qb-core:client:HideText', function()
    hideText()
end)

-- RegisterNetEvent('qb-core:client:KeyPressed', function() -- Can't use
--     keyPressed()
-- end)

exports('DrawText', drawText)
--exports('ChangeText', changeText) -- Can't use
exports('HideText', hideText)
exports('KeyPressed', keyPressed) -- Can't use

ESX.TextUI to okokTextUI

Navigate to es_extended/client/functions.lua and edit the following functions:

ESX.TextUI

function ESX.TextUI(message, type)
    if type == 'info' then
        type = 'darkblue' -- or `lightblue`
    elseif type == 'success' then
        type = 'darkgreen' -- or 'lightgreen'
    elseif type == 'error' then
        type = 'darkred' -- or 'lightred'
    else 
        type = 'darkgrey' -- or 'lightgrey'
    end

    if GetResourceState('okokTextUI') ~= 'missing' then
        exports['okokTextUI']:Open(message, type, "left")
    else
        print('[^1ERROR^7] ^5okokTextUI^7 is Missing!')
    end
end

ESX.HideUI

function ESX.HideUI()
    if GetResourceState("okokTextUI") ~= "missing" then
        exports["okokTextUI"]:Close()
    else 
        print("[^1ERROR^7] ^5okokTextUI^7 is Missing!")
    end
end
PreviousConfig fileNextokokRequests

Last updated 1 year ago