37 lines
728 B
Lua
37 lines
728 B
Lua
-----------------------------------
|
|
-- func: pettp
|
|
-- desc: Sets the players pet tp.
|
|
-----------------------------------
|
|
---@type TCommand
|
|
local commandObj = {}
|
|
|
|
commandObj.cmdprops =
|
|
{
|
|
permission = 1,
|
|
parameters = 'i'
|
|
}
|
|
|
|
local function error(player, msg)
|
|
player:printToPlayer(msg)
|
|
player:printToPlayer('!pettp <amount>')
|
|
end
|
|
|
|
commandObj.onTrigger = function(player, tp)
|
|
-- validate target
|
|
local targ = player:getPet()
|
|
if targ == nil then
|
|
error(player, 'You do not have a pet.')
|
|
return
|
|
end
|
|
|
|
-- validate tp amount
|
|
if tp == nil or tp < 0 then
|
|
error(player, 'Invalid amount of tp.')
|
|
return
|
|
end
|
|
|
|
-- set pet tp
|
|
targ:setTP(tp)
|
|
end
|
|
|
|
return commandObj
|