Codex Studios
Visit our Tebex StoreOur Discord
  • ๐Ÿ‘‹Welcome to Codex Studios
  • Overview
    • ๐Ÿ’กAbout Us
    • โœจOur Features
  • ๐Ÿ’…RedM-Scripts
    • ๐ŸŒ[Codex Studios] : Core
      • Client Side
      • Server Side - CodexCore API
      • Config
      • ๐Ÿ“ Client Side (clientside.lua)
      • ๐Ÿงพ Server Side (serverside.lua)
      • ๐Ÿ›ก๏ธCodexCore Security Module
      • ๐Ÿ—’๏ธSecurity Detailed Explanation
      • ๐Ÿ”Client-Side: Securing Event Triggers
      • ๐Ÿ”’Server-Side: Securing Event Triggers
    • ๐Ÿ’ช[Codex Studios] : Trust Level
      • Client Side
      • Config
      • SQL
  • ๐Ÿ“ฆ[Codex Studios]: Supplies System
    • Client Side
    • Server-Side Town Supplies
    • Config
    • ๐Ÿช›Examples and Commands
    • Sql Updated
Powered by GitBook
On this page

Was this helpful?

  1. RedM-Scripts
  2. [Codex Studios] : Core

๐Ÿ“ 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)
PreviousConfigNext๐Ÿงพ Server Side (serverside.lua)

Last updated 1 month ago

Was this helpful?

๐Ÿ’…
๐ŸŒ