PermaGag and PermaMute for ULX/TTT

Yeah, I have looked around and tested some of the commands I have found on Google but none of them seem to function properly. I don’t know if I am doing something wrong but I have noticed that other servers have this command and I am curious how I could go about getting it. I don’t know if individual server developers code it for their own servers, but if there is any way I could get some help getting a command like this to function that would be very helpful.

Also a side note, prop killing on my server has been prominent recently is there anyway to either prevent it or to tell who threw the prop and killed the player? It is very difficult to deal with these scenarios. I tried a script that prevents crush damage but sadly it did not work.

Preventing prop killing you kinda have to deal case by case I’ve noticed. If its T killing inno its fine but its your rules I don’t think creating a prop damage protection script is gonna solve problems.

As for perma gag and mute.
You can create a script and have it ran as a player joins.

Basicly it would be
Player joins > database is checked for any permissions > if offender found apply one or all conditions.

I’m not a lua scripter but that’s probably what you’d look for.

I am not a lua scripter either, so I am clueless as to how to do that… I’d be willing to provide compensation for someone who would personally help me though.

Also I figured out the crush damage script does work it just makes things like the rat trap on dolls not damage you, which I think is a fine sacrifice. Here is the public code if anyone wants it. You just pop it in a .lua file in lua/autorun/server



local badusers = {
"STEAM_0:X:XXXXXX",
"STEAM_0:X:XXXXXX",
"STEAM_0:X:XXXXXX"
}

hook.Add("PlayerInitialSpawn", "mutebadpeople", function(ply)
    if (table.HasValue(badusers, ply:SteamID())) then
        RunConsoleCommand("ulx", "mute", ply:Nick())
    end
end)


Replace STEAM_0:X:XXXXXX with the bad user’s SteamID

Should be put somewhere serverside. i.e. lua/autorun/server

But this is all manual, as in I would have to grab the offenders SteamID everytime and put it in the list? I was looking for something where I could simply type “!pgag PLAYERNAME” or “!unpgag PLAYERNAME” I’ve seen it before

Uh, does ULX not keep mutes saved? I mean like, “!mute player” should keep them muted through the rounds, but it should be removed on map change. I don’t understand what you’re asking for.

I am asking for a command that persists through map change. Like your table there but when I !pgag them the SteamID is added permanently and removed permanently when I !unpgag them

You could probably do something with a simple file.Write, or SQL if you wanted to get ~fancy~. I don’t make ULX commands though, so all I could give you is the base code, and you would have to figure out how to turn it into a ULX command.

Or just use PData.

How do you even do that? Can you do the same thing to ban people from certain teams?

It would depend on the gamemode as to how much work it require to write that in, but absolutely. If you give me a couple minutes I’ll write you perm gag and perm mute chat commands for ULX.

TabletoJson,

Json to table

^ storing the data

that should be enough to get your started/finished

here you go!
[LUA]
local CATEGORY = “Chat”
function ulx.pmute( admin, targs, should_unmute )

for _,v in ipairs( targs ) do

	if should_unmute then

		v.gimp = nil
		v:SetPData( "pmute", false )

	else

		v.gimp = ID_MUTE
		v:SetPData( "pmute", true )

	end

end

if not should_unmute then

	ulx.fancyLogAdmin( admin, "#A permanently muted #T", targs )

else

	ulx.fancyLogAdmin( admin, "#A removed the permanent mute from #T", targs )

end

end

local pmute = ulx.command( CATEGORY, “ulx pmute”, ulx.pmute, “!pmute” )
pmute:addParam{ type=ULib.cmds.PlayersArg }
pmute:addParam{ type=ULib.cmds.BoolArg, invisible=true }
pmute:defaultAccess( ULib.ACCESS_SUPERADMIN )
pmute:help( “Permanently mutes target(s) so they are unable to chat.” )
pmute:setOpposite( “ulx unpmute”, {_, _, true}, “!unpmute” )

function ulx.pgag( admin, targs, should_ungag )

for _,v in ipairs( targs ) do

	v.ulx_gagged = not should_ungag
	v:SetPData( "pgag", not should_ungag )

end

if not should_ungag then

	ulx.fancyLogAdmin( admin, "#A permanently gagged #T", targs )

else

	ulx.fancyLogAdmin( admin, "#A removed the permanent gag from #T", targs )

end

end

local pgag = ulx.command( CATEGORY, “ulx pgag”, ulx.pgag, “!pgag” )
pgag:addParam{ type=ULib.cmds.PlayersArg }
pgag:addParam{ type=ULib.cmds.BoolArg, invisible=true }
pgag:defaultAccess( ULib.ACCESS_SUPERADMIN )
pgag:help( “Permanently gag target(s), disables microphone.” )
pgag:setOpposite( “ulx unpgag”, {_, _, true}, “!unpgag” )

if SERVER then

hook.Add( "PlayerInitialSpawn", "pmute_pgag_check", function( ply ) 

	if ply:GetPData( "pgag" ) then

		ply.ulx_gagged = true

		for _, v in ipairs( player.GetAll() ) do
			
			v:ChatPrint( ply:Name() .. " has been gagged upon joining due to a previous permanent gag." )

		end

	end

	if ply:GetPData( "pmute" ) then
		
		ply.gimp = ID_MUTE

		for _, v in ipairs( player.GetAll() ) do
			
			v:ChatPrint( ply:Name() .. " has been muted upon joining due to a previous permanent mute." )

		end

	end

end )

end
[/LUA]

If you need help installing this, feel free to ask.

Thanks!

  • snip -