Console command help.

How would I create a console command that only admins can use and it will save the value on the server, but clients can access the value?
[lua]MBH = {}
MBH.MaxKills = 16
MBH.MaxScale = 2
MBH.PercentRemove = 0.2 --percentage between 0 and 1[/lua]
I want to be able to change these 3 global values, which are shared.

Hope this will work :[lua]concommand.Add(“changethings”, function(ply, cmd, args)

if ply:IsAdmin() then
    MBH.MaxKills = args[1] or 16
    MBH.MaxScale = args[2] or 2
    MBH.PercentRemove = args[3] or 0.2
else
    print("you need to be an admin to use this command")
end

end)[/lua]
usage:


changethings <.MaxKills> <MaxScale>  <PercentRemove>

But I want it to be saved, so the owner doesn’t need to redo the values every time.

[editline]08:29PM[/editline]

I was thinking with this: http://wiki.garrysmod.com/?title=G.CreateConVar
But I’m not sure how that works with admin only stuff.

I’m not sure about what you mean, you can store your value in a sql database, but i’m sure there is a lot of way more easier than that to do this.

I think he means making a command such as in DarkRP (example) where if you turn on HungerMod, then HungerMod will still be on when the server restarts or the admin leaves etc

oh, darkrp use **[G.CreateConVar

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=G.CreateConVar)**
to do this

Urgh, no. DarkRP is not the standard by which you should base your coding.

In general, if have values that should be set only by the server but can be read by the client AND they are not entity- or player-specific, then you should use GlobalVariables, using functions like **[G.SetGlobalString

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=G.SetGlobalString)**.