Standalone Function
The interesting part starts here.
When switching the config to standalone
Config.authorizedJobs = 'police'PlayerJob = QBCore.Functions.GetPlayerData().job.nameRegisterNetEvent('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
Last updated