Skip to main content

QBOX Support for the GetPlayerJob function

T
Written by Tim Plate
Updated today

In visn_are/script/helpers/s_functions.lua around line 410

function GetPlayerJob(source)     
source = tonumber(source)
local groups = exports.qbx_core:GetGroups(source)

if not groups then
print(("[visn_are] QBOX: GetGroups returned nil for player %s"):format(source))
return ""
end

local allJobs = exports.qbx_core:GetJobs()

for groupName, grade in pairs(groups) do
if allJobs[groupName] then
local jobData = allJobs[groupName]
print(("[visn_are] QBOX Player %s has job: %s (label: %s, grade: %s)"):format(source, groupName, jobData.label or "Unknown", tostring(grade)))

return groupName
end
end

print(("[visn_are] QBOX: No valid job found in groups for player %s"):format(source))

return ""

end

Did this answer your question?