Prolly one of the noobie’ist questions ever but.
How would I go changing the hostname in lua?

RunConsoleCommand(“hostname”, “zqdzqdzqd” )

But nothing happens

  • I’m doing this in a GM:Initialize hook., not sure if this is because the cvar is blocked or do the fact that the dedicated server file is runned after this hook? if this is the case what event is called when server (re)starts but after the dedicated server file is executed?

any errors?


Don’t bother putting it in initialise.

Since the server files is loaded after it?

yeah, right server.cfg loads after the initialise. try to use this hook.
i think that loads after server.cfg

Well i’ll try that, but need the change of name in a function in Initialize, using a timer now and that works :smiley:
Thanks for help

well i dont recomend using a timer with that function since peoples servers may run a bit slower than your.

So? timer will only start when they have load it?
What’s the problem with timers in initialize?
Can you explain a bit more please?

The InitPostEntity hook is ran after the server has ran server.config, your timer will still work in some cases but it could run too soon and not change the hostname,

hook.Add( “InitPostEntity”, “HostnameInit”, function() RunConsoleCommand(“hostname”, “zqdzqdzqd” ) end)

Correct me if i am wrong.

Yuup would work fine.

And another disadvantage of using a timer is that it will only run when players are in the server.

Thanks all for the info

game.ConsoleCommand anyone?

I prefer RunConsoleCommand personally.

They are not the same thing:tinfoil:

It still works on the server.

game.ConsoleCommand I THINK is not limited to commands compared to RunConsoleCommand on servers.



They pretty much are, besides from the fact that RunConsoleCommand takes multiple arguments, rather than a single string.