๐Unique ID
// Get UID from player ID
exports.cdx-uid:GetUIDfromID()// Get ID from player UID
exports.cdx-uid:GetIDfromUID()QBCore.Commands.Add('setjob', Lang:t('command.setjob.help'), {
{ name = Lang:t('command.setjob.params.uid.name'), help = Lang:t('command.setjob.params.uid.help') },
{ name = Lang:t('command.setjob.params.job.name'), help = Lang:t('command.setjob.params.job.help') },
{ name = Lang:t('command.setjob.params.grade.name'), help = Lang:t('command.setjob.params.grade.help') }
}, true, function(source, args)
local uid = tonumber(args[1])
local targetId = exports.cdx:GetIDfromUID(uid)
if targetId then
local Player = QBCore.Functions.GetPlayer(targetId)
if Player then
Player.Functions.SetJob(tostring(args[2]), tonumber(args[3]))
TriggerClientEvent('QBCore:Notify', source, Lang:t('success.job_set'), 'success')
else
TriggerClientEvent('QBCore:Notify', source, Lang:t('error.not_online'), 'error')
end
else
TriggerClientEvent('QBCore:Notify', source, Lang:t('error.invalid_uid'), 'error')
end
end, 'admin')Last updated