Blocking the "Status command" from players.

Basically, I’m wondering if there’s any possible way to code a quick function to block the “status” command form clients on a server. It’s being abused on the PostNukeRP server I manage to metagame; It makes it hard for players, namely the admins to Roleplay as different characters.

http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index4d65.html

try this


no… it’s blocking only bind

I was looking around the wiki but I wasn’t sure what to look for, I’ll try this, thank you!
[Edit]
Wait this is called when a keybind is used… Well it certainly stops people from binding the key, but it can still be typed in console. Thanks anyways, I may use this in other places. Maybe I can kick people instantly if they use the command? Anyone know the the hook to run a function when a console command is entered?

You can create a concommand.Add, or remove. And it will remove it and use yours but only after letting them use it the first time.

You could override that to quit out when the command matches status and otherwise run the original function. Though it’s not recommended.

I don’t think I can override it. I tried this in the gamemode’s shared.lua
[lua]
function statusnoap( player, command, arguments )
print(“Noap”)
– making it just print so I can test without getting kicked… obviously
end

concommand.Add( “status”, statusnoap )
[/lua]
It didn’t work and it just showed what status already shows. When I changed the commandcommand.Add from “status” to “derpblah” and entered derpblah in to console, “Noap” printed just fine.

You could write a binary module to control the info sent to clients, but that’s probably out of the question.

It’s probably super easy to bypass but this seemed to stop it for me.


] alias status "echo nope"
] status
nope

Can you run alias command from RunConsoleCommand though?

nope, guess not. i dunno then lol

Nope. Doesn’t do anything for me.

Bump for interest, I’ve been trying to solve this myself for days, with no luck so far :frowning:

Have you tried concommand.Remove(“status”)?

OR you can try something like this…

[LUA]
RunConsoleCommand(“con_filter_text_out”, “SOME_STRING_THAT_IS_PART_OF_A_STATUS_PRINT”)
RunConsoleCommand(“con_filter_enable”, “1”)
[/LUA]

That’ll only block it if they don’t know that it’s enabled, but you can be sneaky about it.

I have tried concommand.Remove(“status”), but it seems to only work for commands manually added using concommand.Add, not for the built-in ones. And concommand.Add sadly doesn’t override them.
The second solution might somewhat work, although it won’t do any good for other commands that aren’t about output.

Not entirely sure if this works for GM13, but the source is there as well:

http://forum.facepunch.com/showthread.php?t=994287

Lua exerts no control over the existing lower level commands afaik, so you would need something like the above to block them.

Other than that you can only really use trickery that works on most players but the odd one will probably be experienced enough to get around it.

You can use cvar3 and rename/remove the command.

I made a custom status command on my servers. You could add a time check to prevent spamming if needed.

[lua]require(“cvar3”)

if cvars.GetCommand then
local status = cvars.GetCommand( “status” )
local status_old = cvars.GetCommand( “status_old” )

if status and !status_old then
	status:SetName( "status_old" )
end

end

util.AddNetworkString( “BreakpointStatus” )

concommand.Add( “status”, function( ply, cmd, args )
if ply == NULL then – The server ran the command, so fake it and run the old unmodified status instead
RunConsoleCommand( “status_old” )
return
end

local headerInfo = {
	["version"] = VERSION,
	["ip"] = GetConVarString( "ip" ),
	["port"] = GetConVarNumber( "hostport" ),
}

local playerInfo = {}

for k, ply in pairs( player.GetAll() ) do
	playerInfo[ ply:EntIndex() ] = {
		name = ply:Nick(),
		userid = ply:UserID(),
		steamid = ply:SteamID(),
		rank = ply:GetNWString( "UserGroup" ),
		time = ply:TimeConnected(),
	}
end

net.Start( "BreakpointStatus" )
	net.WriteTable( headerInfo )
	net.WriteTable( playerInfo )
net.Send( ply )

end )[/lua]

Wouldn’t people be able to get around this by simply doing status_old?

And whatever you do to remove the info that status provides could be retrieved some other way.

Is there a library version for Linux? It would be awesome.

Yeah, here you go.

https://dl.dropboxusercontent.com/u/38214687/gmsv_cvar3_linux.dll

Works like a charm, you have no idea how grateful I am, thank you!

Just a little question, any way to block players from using cl_playermodel to change their playermodels? I assume this wouldn’t work, since cl_playermodel is a clientside convar.