Skip to main content

setJob

xPlayer.setJob(name, grade)

This functions sets the player job, the job must be defined in the jobs database table.

Arguments

ArgumentData TypeOptionalDefault ValueExplanation
namestringNo-Job name
gradestring&numberNo-Job grade

Example

local xPlayer = ESX.GetPlayerFromId(source)
local Job = 'police'
local Grade = 4 -- highest police grade

if ESX.DoesJobExist(Job, Grade) then -- make sure the Job and Grade are both defined in the database
xPlayer.setJob(Job, Grade)
end