Skip to content

Implementing other frameworks

Luccboy edited this page Feb 21, 2026 · 3 revisions

You can implement other frameworks or your own system easily:

  1. Create a new folder at evidences/common/frameworks named after your framework and then create a server.lua and a client.lua file inside it. Copy and paste the following template code to this files and implement the functions:
    -- client.lua
    local framework <const> = {}
    
    ---@return string containing the first and lastName of the local player or nil
    function framework.getPlayerName()
        -- call your framework's functions that retrieve the player's name here
        local firstName = "John"
        local lastName = "Doe"
        return firstName .. " " .. lastName
    end
    
    --- Returns the player's grade within their current job
    ---@param job string The name of the job (e.g. "police")
    ---@return number The player's grade of the job
    function framework.getGrade(job)
        -- check if the player has the given job and return their grade in that job
        -- return nil if the player doesn't have the job
        local grade = 0
        return grade
    end
    
    return framework
    -- server.lua
    local framework <const> = {}
    
    ---@param playerId number The player's server id also refered to as source
    ---@return the unique identifier of the current character the player has selected
    function framework.getIdentifier(playerId)
        local charId = ""
        return charId
    end
    
    ---@param playerId number The player's server id also refered to as source
    ---@return string containing the first and lastName of the player
    function framework.getPlayerName(playerId)
        -- call your framework's functions that retrieve the player's name here
        local fullName = "John Doe"
        return fullName or "undefined"
    end
    
    --- Returns the player's grade within their current job
    ---@param job string The name of the job (e.g. "police")
    ---@param playerId number The id of the player to execute the permission check for
    ---@return number The player's grade of the job
    function framework.getGrade(job, playerId)
       -- check if the player has the given job and return their grade in that job
       -- return nil if the player doesn't have the job
       local grade = 0
       return grade
    end
    
    function framework.getCitizens(searchText, limit, offset)
       local pattern <const> = "%" .. searchText:gsub("\\", "\\\\"):gsub("%%", "\\%%"):gsub("_", "\\_") .. "%"
    
       -- Adapt the query to your framework
       -- Important: each citizen in the returned array needs an identifier, fullName, birthdate and gender
       return database.query(
          [[
             SELECT
                identifier,
                fullName,
                birthdate,
                gender
             FROM characters
             WHERE fullName LIKE ?
             LIMIT ? OFFSET ?
          ]],
          pattern, limit, offset
       )
    end
    
    function framework.getCitizen(identifier)
       return database.selectFirstRow(
          [[
             SELECT
                charId AS identifier,
                fullName,
                birthdate,
                gender
             FROM characters
             WHERE charId = ?
          ]],
          identifier
       )
    end
    
    return framework
  2. Finally add a new entry to the supportedFrameworks table in evidences/common/frameworks/framework.lua:
    local supportedFrameworks <const> = {
        -- the key has to be the name your framework's script (e.g. "es_extended" for ESX)
        -- the value has to be the name of the folder you previously created inside evidences/frameworks folder (we chose to name it "esx" for example)
        ["your_framework"] = "your_folder",
        ["es_extended"] = "esx",
        ...
    }

Clone this wiki locally