landsandboat/scripts/commands/messagebasic.lua

36 lines
788 B
Lua
Raw Permalink Normal View History

-----------------------------------
-- func: messagebasic
2016-01-16 01:26:33 -05:00
-- desc: Injects a message basic packet.
-----------------------------------
---@type TCommand
local commandObj = {}
2016-01-16 01:26:33 -05:00
commandObj.cmdprops =
2016-01-16 01:26:33 -05:00
{
permission = 1,
parameters = 'iii'
}
2016-01-16 01:26:33 -05:00
local function error(player, msg)
player:printToPlayer(msg)
player:printToPlayer('!messagebasic <message ID> (param1) (param2)')
end
commandObj.onTrigger = function(player, msgId, param1, param2)
-- validate msgId
if msgId == nil then
error(player, 'You must provide a message ID.')
return
end
local target = player:getCursorTarget()
if target == nil then
target = player
end
-- inject message packet
player:messageBasic(msgId, param1, param2, target)
end
return commandObj