protecting console commands

how would I protect a console command from being used by a player, but still letting a gamemode use it?

[lua]function hello(ply, cmd, args)
if ply:IsValid() then return end
// code here
concommand.Add(“hello”, hello)[/lua]

I think he wants the gamemode to run the command on the client though

yes, I want it to be used on the client.

In the /server/ file put
function test(ply,cmd,args)
if args[1] == nil then ply:ChatPrint(“Must contain arguements”) return end
if ply:IsAdmin() or not ValidEntity(ply) then – if we’re admin or console then continue
PrintMessage(HUD_PRINTTALK, args[1])
concommand.Add(“AdminMessage”, test)

Use or instead of the command.

concommand.Add does the same as that but if you want to protect it use if ply:IsAdmin() then protected end in the server file, it’s not like they’re gonna magically know what console command you put in the server side anyway.