This is the code for the ulx gag. I'm a total newbie to LUA so I was wondering if anyone could rewrite it to have a set duration (minutes, hours) and have it appear on the ulx menu. Thanks!
------------------------------ Gag ------------------------------
function ulx.gag( calling_ply, target_plys, should_ungag, time )
local players = player.GetAll()
for i=1, #target_plys do
local v = target_plys[ i ]
v.ulx_gagged = not should_ungag
v:SetNWBool("ulx_gagged", v.ulx_gagged)
end
if not should_ungag then
ulx.fancyLogAdmin( calling_ply, "#A gagged #T", target_plys )
else
ulx.fancyLogAdmin( calling_ply, "#A ungagged #T", target_plys )
end
if not time or type( time ) ~= "number" then
time = 0
end
end
local gag = ulx.command( CATEGORY_NAME, "ulx gag", ulx.gag, "!gag" )
gag:addParam{ type=ULib.cmds.PlayersArg }
gag:addParam{ type=ULib.cmds.BoolArg, invisible=true }
gag:defaultAccess( ULib.ACCESS_ADMIN )
gag:help( "Gag target(s), disables microphone." )
gag:setOpposite( "ulx ungag", {_, _, true}, "!ungag" )
local function gagHook( listener, talker )
if talker.ulx_gagged then
return false
end
end
hook.Add( "PlayerCanHearPlayersVoice", "ULXGag", gagHook )