2021-01-18 13:34:00 -05:00
|
|
|
-----------------------------------
|
2016-07-29 08:35:15 -06:00
|
|
|
-- func: messagebasic
|
2016-01-16 01:26:33 -05:00
|
|
|
-- desc: Injects a message basic packet.
|
2021-01-18 13:34:00 -05:00
|
|
|
-----------------------------------
|
2024-08-25 10:54:45 -04:00
|
|
|
---@type TCommand
|
2023-09-02 07:01:35 -04:00
|
|
|
local commandObj = {}
|
2016-01-16 01:26:33 -05:00
|
|
|
|
2023-09-02 07:01:35 -04:00
|
|
|
commandObj.cmdprops =
|
2016-01-16 01:26:33 -05:00
|
|
|
{
|
|
|
|
|
permission = 1,
|
2023-08-28 21:02:28 -04:00
|
|
|
parameters = 'iii'
|
2020-02-19 21:40:57 -08:00
|
|
|
}
|
2016-01-16 01:26:33 -05:00
|
|
|
|
2023-09-02 07:01:35 -04:00
|
|
|
local function error(player, msg)
|
2023-12-09 23:54:00 +00:00
|
|
|
player:printToPlayer(msg)
|
|
|
|
|
player:printToPlayer('!messagebasic <message ID> (param1) (param2)')
|
2020-02-19 21:40:57 -08:00
|
|
|
end
|
2017-08-06 12:44:08 -04:00
|
|
|
|
2023-09-02 07:01:35 -04:00
|
|
|
commandObj.onTrigger = function(player, msgId, param1, param2)
|
2017-08-06 12:44:08 -04:00
|
|
|
-- validate msgId
|
2022-11-02 17:03:50 -04:00
|
|
|
if msgId == nil then
|
2023-08-28 21:02:28 -04:00
|
|
|
error(player, 'You must provide a message ID.')
|
2020-02-19 21:40:57 -08:00
|
|
|
return
|
2017-08-06 12:44:08 -04:00
|
|
|
end
|
2017-11-29 21:23:30 -08:00
|
|
|
|
2020-02-19 21:40:57 -08:00
|
|
|
local target = player:getCursorTarget()
|
2017-11-29 21:23:30 -08:00
|
|
|
if target == nil then
|
2020-02-19 21:40:57 -08:00
|
|
|
target = player
|
2017-11-29 21:23:30 -08:00
|
|
|
end
|
2020-03-19 18:41:42 -07:00
|
|
|
|
2017-08-06 12:44:08 -04:00
|
|
|
-- inject message packet
|
2020-02-19 21:40:57 -08:00
|
|
|
player:messageBasic(msgId, param1, param2, target)
|
2020-03-19 18:41:42 -07:00
|
|
|
end
|
2023-09-02 07:01:35 -04:00
|
|
|
|
|
|
|
|
return commandObj
|