dobrograd-13-06-2022/garrysmod/addons/feature-gmpanel/lua/gmpanel/actions/sounds/server.lua
Jonny_Bro (Nikita) e4d5311906 first commit
2023-11-16 15:01:19 +05:00

26 lines
702 B
Lua

gmpanel.registerAction('sounds', function(obj)
if isstring(obj.soundId) then
obj.soundId = utf8.sub(obj.soundId, 1, 48)
else obj.soundId = nil end
if istable(obj.stopsounds) and table.IsSequential(obj.stopsounds) then
for i = #obj.stopsounds, 1, -1 do
local str = obj.stopsounds[i]
if not isstring(str) then
table.remove(obj.stopsounds, i)
continue
end
str = utf8.sub(str:gsub(' ', ''), 1, 48)
if str == '' then
table.remove(obj.stopsounds, i)
continue
end
obj.stopsounds[i] = str
end
else obj.stopsounds = {} end
local players = gmpanel.buildTargets(obj.players or {})
obj.players = nil
netstream.Start(players, 'dbg-event.action.sound', obj)
end)