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

15 lines
406 B
Lua

local dsps = {
1, -- normal
15, -- medium
16, -- hard
}
gmpanel.registerAction('deafen', function(obj)
if not isnumber(obj.screen) or not isnumber(obj.sound) then return false end
local players = gmpanel.buildTargets(obj.players or {})
local dsp = dsps[obj.sound + 1] or dsps[1]
for _,ply in ipairs(players) do
ply:SetDSP(dsp)
netstream.Start(ply, 'gmpanel.darkenScreen', obj.screen)
end
end)