landsandboat/scripts/commands/capskill.lua

38 lines
841 B
Lua
Raw Permalink Normal View History

-----------------------------------
-- func: capskill
2016-01-16 01:26:33 -05:00
-- desc: Caps a specific skill.
-----------------------------------
---@type TCommand
local commandObj = {}
commandObj.cmdprops =
2016-01-16 01:26:33 -05:00
{
permission = 1,
parameters = 's'
}
2016-01-16 01:26:33 -05:00
local function error(player, msg)
player:printToPlayer(msg)
player:printToPlayer('!capskill <skillID>')
end
commandObj.onTrigger = function(player, skillId)
-- validate skillId
if skillId == nil then
error(player, 'You must provide a skillID.')
return
2016-01-16 01:26:33 -05:00
end
2021-04-01 15:10:15 -04:00
skillId = tonumber(skillId) or xi.skill[string.upper(skillId)]
if skillId == nil or skillId == 0 then
error(player, 'Invalid skillID.')
return
2016-01-16 01:26:33 -05:00
end
-- cap skill
player:capSkill(skillId)
player:printToPlayer(string.format('Capped skillID %i.', skillId))
2016-01-16 01:26:33 -05:00
end
return commandObj