blocking non sv_cheats commands

Post Reply
OfficialDellacry
New to forums
New to forums
Posts: 2
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Wed Dec 04, 2013 4:29 am

blocking non sv_cheats commands

Post by OfficialDellacry »

I was wondering if i could block commands such as kill and suicide (Console.) because its really making people mad on my server, when its on freak fortress 2 how people are killing themselves with it before the boss can get to them. Any ideas or help would be appreciated.. thanks!
User avatar
Spray
Former staff
Former staff
Posts: 630
Joined: Wed Dec 28, 2011 10:41 pm
Location: Oregon

Re: blocking non sv_cheats commands

Post by Spray »

Sourcemod would be your friend here, as it can block commands sent from the client to the server. What you're asking for is fairly simple, here is an example plugin that will block the "kill" and "explode" commands, which are commands that suicide the player:

Code: Select all

#pragma semicolon 1

#include <sourcemod>
#define PLUGIN_VERSION "0.1"

public Plugin:myinfo = {
	name = "Block Suicide",
	author = "Spray",
	description = "Blocks commands that suicide the player",
	version = PLUGIN_VERSION,
	url = "http://example.com/"
};

public OnPluginStart()
{
	AddCommandListener(KillCallback, "kill");
	AddCommandListener(ExplodeCallback, "explode");
}
 
public Action:KillCallback(client, const String:command[], argc)
{
	PrintToConsole(client, "Notice: The kill command is blocked on this server");
	return Plugin_Handled;
}

public Action:ExplodeCallback(client, const String:command[], argc)
{
	PrintToConsole(client, "Notice: The explode command is blocked on this server");
	return Plugin_Handled;
}
Download: Link
OfficialDellacry
New to forums
New to forums
Posts: 2
Joined: Wed Dec 04, 2013 4:29 am

Re: blocking non sv_cheats commands

Post by OfficialDellacry »

Does this include admins as well?
User avatar
Spray
Former staff
Former staff
Posts: 630
Joined: Wed Dec 28, 2011 10:41 pm
Location: Oregon

Re: blocking non sv_cheats commands

Post by Spray »

OfficialDellacry wrote:Does this include admins as well?
Yes, this doesn't check for permissions, it simply blocks the commands altogether.
Post Reply