๐Ÿ“ Client Side (clientside.lua)

๐ŸŽฎ This script shows how to use all the client-side functions provided by CodexCore. These can be used for accessing player info, jobs, currencies, map blips, and communicating with the server.


local CodexCore = exports['codex_core']:getLibClient()

-- ๐Ÿ”„ Check if player is loaded
Citizen.CreateThread(function()
    while not CodexCore.IsLoaded() do
        Wait(500)
    end

    print('โœ… Player is loaded into the session.')
end)

-- ๐Ÿชช Get Character Identifier
RegisterCommand("mycid", function()
    local cid = CodexCore.GetCharacterIdentifier()
    print("๐Ÿ†” Your Character Identifier is:", cid)
end)

-- ๐Ÿ‘ทโ€โ™‚๏ธ Get Job and Grade
RegisterCommand("myjob", function()
    local job = CodexCore.GetJob()
    local grade = CodexCore.GetJobGrade()
    print("๐Ÿ‘ท Job:", job, "| ๐Ÿ“ˆ Grade:", grade)
end)

-- ๐Ÿ’ฐ Get Money & Gold
RegisterCommand("mymoney", function()
    local cash = CodexCore.GetMoney()
    local gold = CodexCore.GetGold()
    print("๐Ÿ’ต Cash:", cash, "| ๐Ÿช™ Gold:", gold)
end)

-- ๐ŸŽญ Get Group
RegisterCommand("mygroup", function()
    local group = CodexCore.GetGroup()
    print("๐Ÿ›ก๏ธ Group:", group)
end)

-- ๐Ÿ“ Add a Blip
RegisterCommand("addblip", function()
    local blip = CodexCore.AddBlipForCoords(2500.0, -1300.0, 48.0, 212, "My Blip", 1)
    print("๐Ÿ“ Blip added at location!")
end)

-- ๐Ÿ” Use Server Callback
RegisterCommand("getcidfromsv", function()
    CodexCore.TriggerServerCallback('CodexCore-lib:fetchUserCharacterIdentifier', function(cid)
        print("๐Ÿ“ก Server returned Character ID:", cid)
    end)
end)

Last updated

Was this helpful?