Installing for ESX

To integrate ZeroTrust with an ESX-based server, you'll need to replace the function Cfg.GetAdminGroup inside config_s.lua with the following code to ensure proper compatibility:

Cfg.WhitelistedGroups = { 
     ["mod"] = true,
     ["admin"] = true,
     ["superadmin"] = true,
}

ESX = exports["es_extended"]:getSharedObject() -- NEW ESX ONLY
Cfg.GetAdminGroup = function(source) 
    if source == nil then return 0 end
    if source == 0 then return "superadmin" end

    local xPlayer = ESX.GetPlayerFromId(source)
    while xPlayer == nil do Wait(0) end
    return xPlayer.getGroup()
end

This new function ensures that ZeroTrust correctly retrieves the player's admin group, allowing it to recognize different permission levels (e.g., "superadmin") within your ESX framework.

Make sure you have ESX installed and properly configured before making these changes. If you're running the latest version of ESX, this updated function is essential for correct operation.

ZeroTrust caches the result of Cfg.GetAdminGroup after the first use per player. This ensures that each player's admin group is checked only once, minimizing unnecessary calls and avoiding potential spam.

Last updated