feat(server/commands): setjob

This commit is contained in:
Andyyy7666
2023-08-28 03:06:30 +02:00
parent b7237729f4
commit 151961b401

View File

@@ -61,3 +61,44 @@ lib.addCommand("setmoney", {
args = {"Staff action", staffMessage} args = {"Staff action", staffMessage}
}) })
end) end)
lib.addCommand("setjob", {
help = "Admin command, set a players job.",
restricted = "group.admin",
params = {
{
name = "target",
type = "playerId",
help = "Target player's server id"
},
{
name = "job",
type = "string",
help = "Job name"
},
{
name = "rank",
type = "number",
optional = true
}
}
}, function(source, args, raw)
local player = NDCore.getPlayer(args.target)
local job = args.job:lower()
local jobInfo = player.setJob(job, args.rank)
if not player or not jobInfo then return end
player.notify({
title = "Staff action",
description = ("Job updated to %s, rank %s"):format(jobInfo.label, jobInfo.rankName),
type = "inform",
duration = 10000
})
if not source then return end
TriggerClientEvent("chat:addMessage", source, {
color = {50, 100, 235},
multiline = true,
args = {"Staff action", "success"}
})
end)