Running console commands on server via derma

Hi, as part of my derma function i want to run a console command through the console because the client does not have sufficant rights to do it but i don’t know how to do it because derma is clientside not serverside. I was thinking maybe having the derma function call a console command which starts a function on a serverside script, calling a command. But this wouldnt work because to run the command it needs some variables contained within the derma script; so unless there is someway to transport them over multiple scripts i have no more ideas… so, anyone have an idea how to do this? Thanks for the help.

RunConsoleCommand(“say HAI!”)

No it wouldnt work, because that would run it on the client because it would be called in a clientside script, and the client wont have sufficiant rights within the server to call it. Correct me if im wrong.

Put a function like

[lua]function gameCC(Pl, Cmd, Args)
concommand.Add(“GameCC”, gameCC)[/lua]

on the server. This will make a concommand on the clients so you can do like

GameCC “sv_gravity 300”

in the console and it will do it on the server.

Be aware however, this will let any client do any command on the server. Also note that the command needs to go in quotes.

Some commands are blocked. See here:

Yeah i did think of something like that but it would be to risky if everyone could use all of the commands… so there is no way to send data from one lua file to another (within the same addon) because if there was, it would solve my problem.


What exactly are you trying to do that would require sending data from one lua file to another?

Also, you can add checks to see if a player passes certain requirements for them to use it. Like if you wanted to limit it to admins from Assmod, or limit it to only people with your steamID (i.e. you).

Ok well, i am making a ‘account’ mod for people on my server with a derma menu to acompany it and within the derma menu it has certain controls for the ‘account’. These include a ulx command to delete your rank, being that their rank is considered part of their account. Now if i were to do player.ConCommand(ulx remove) it would block it, and i cant run it through game.ConCommand because its a clientside script. So i wanted to send the data (nick of player executing the command) to a server side script, so i can use game.ConCommand.

Edit: LOL ok… my bad i totaly missed it i could just place the file in autorun… not autorun/client that way i can run serverside functions!