Description: A simple module which allows a coder to see all console commands being run and choose to disable them from running.
**[lua] require( “concmdhook” )
local function PlayerFromAddress(address)
for k, v in ipairs(player.GetAll()) do
if (v:IPAddress() == address) then
if CLIENT then
hook.Add( “OnConCommand”, “TestHook”, function ( cmd )
Msg( "Command was run: " … cmd … "
if ( string.find(cmd, “disconnect”) ) then
Msg(“Now you can never leave me!”)
hook.Add( “OnConCommand”, “TestHook”, function ( cmd, addr )
local ply = PlayerFromAddress( addr )
if ply == nil then
Msg("Server command ran: " … cmd … "
Msg("Player " … ply:Name() … " ran " … cmd … "
if ( string.find(cmd, “npc_thinknow”) ) then
ply:ChatPrint(“Please don’t crash us :)”)
Other Info: This module is statesafe, meaning the client, server, and menu can all use this module without interfering. The order by which the module asks for input is Menu, Server, Client.
More Info: The addr argument is the IP address of the player running the command. Bare with me on this, but please use the supplied function to find the player with the given IP address.