Standalone Function

The interesting part starts here.

When switching the config to standalone

Lets see for example client/checks_client.lua this event checks what framework we set in the config and takes the player job to allow him to open the casino doors, in line 80 you will have to take your way of taking the player job and implement it that if the player job is set to

Config.authorizedJobs = 'police'

In line 80 implement your logic for example you can see how qbcore is doing it

PlayerJob = QBCore.Functions.GetPlayerData().job.name
RegisterNetEvent('s-casinoheist:client:doorlock')
AddEventHandler('s-casinoheist:client:doorlock', function()
    CreateThread(function()
        if Config.Framework == "ESX" then
            ESX = exports[Config.CoreName]:getSharedObject()
            PlayerData = ESX.GetPlayerData()
            PlayerJob = PlayerData.job.name
        elseif Config.Framework == "QB" then
            QBCore = exports[Config.CoreName]:GetCoreObject()
            while not QBCore.Functions.GetPlayerData().job do Citizen.Wait(100) end
            PlayerJob = QBCore.Functions.GetPlayerData().job.name
        else
            --standalone-- implement your logic here
        end
        if Config.debug then print("PlayerJob", PlayerJob) end
        while true do
            local playerPed = PlayerPedId()
            local playerCoords = GetEntityCoords(playerPed)
            -- Reset door interaction status for this iteration
            isNearDoor = false
            closestCategory = nil
            closestDoorId = nil
            -- Check proximity to doors and handle interaction
            for category, doors in pairs(Config.Doors) do
-- the rest of the code
-- ...

All the places you will have to implement your logic

and again remember, all of this is optional it all depands if you want full integration

-- checks_server.lua - line 16 - optional
elseif Config.Framework == "QB" then
    QBCore = exports[Config.CoreName]:GetCoreObject()
else
    -- standalone here you will be able to grab your framework server object
end

Last updated