Server Side

So, I’d like a little info on how to run a server side command from a lua script.

Lets say that I make a lua script, and basically I want it to add a console command that when called, checks the steamID of the person who called it, then if it matches, they get added to superadmin, if not, it does nothing. (I know how to add an else statement and such to modify it later) Also, when they leave, they get removed from the superadmin group.

I’m having trouble grasping the concept of functions in lua. I’ve only worked with Java and VB. I wrote this script:
[lua]
local enabled = false
if SERVER then

function dev()

if enabled == false then
 game.ConsoleCommand("ttt_debug_preventwin 1

");
game.ConsoleCommand("ttt_minimum_players 1
");
enabled = true
game.ConsoleCommand("say DEVMODE ENABLED
");
else
game.ConsoleCommand("ttt_debug_preventwin 0
");
game.ConsoleCommand("ttt_minimum_players 2
");
enabled = false
game.ConsoleCommand("say DEVMODE DISABLED
");
end

end

concommand.Add(“devmode”, dev)

end
[/lua]

but it only works if I rcon in and run it. I want one that can be run from the client.