broadcast.lua

main 27 lines · 711 bytes Raw
Alex Alex Commit Server upload 18/10/2026 23:38
1function onSay(player, words, param)
2 if not player:hasFlag(PlayerFlag_CanBroadcast) then
3 return true
4 end
5
6 if param == '' then
7 player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
8 return true
9 end
10
11 -- Permitir formato: color | mensaje
12 local color, message = param:match("^(%w+)%s*|%s*(.+)$")
13 if color and message then
14 param = color .. "|" .. message
15 end
16
17 local MESSAGE_STATUS_WARNING = 20
18
19 -- Enviar el mensaje a todos los jugadores con el modo correcto.
20 for _, targetPlayer in ipairs(Game.getPlayers()) do
21 targetPlayer:sendTextMessage(MESSAGE_STATUS_WARNING, param)
22 end
23
24 print("> " .. player:getName() .. " broadcasted: \"" .. param .. "\".")
25 return false
26end
27
Top