• Make Server name keep changing like Qbox:Sandbox?
    8 replies, posted
If anyone know how to Make our server name keep changing after a period of time like QBOX:Sandbox would you pls kindly tell me in the comments below?
-snip- I am dumb.
You don't have to edit the command line or server.cfg at all to change the host name. You can use the "hostname" convar.
[QUOTE=wishbone;43376966]You don't have to edit the command line or server.cfg at all to change the host name. You can use the "hostname" convar.[/QUOTE] Well that would of been nice too know 2 months ago ;~;
[lua] local names = { "name1", "name2", "etc", } local delay = 600 --Change every 10 minutes timer.Create( "changename", delay, 0, function() RunConsoleCommand( "hostname", table.Random( names ) ) end ) [/lua]
[QUOTE=Greetings;43376978][lua] local names = { "name1", "name2", "etc", } local delay = 600 --Change every 10 minutes timer.Create( "changename", delay, 0, function() RunConsoleCommand( "hostname", table.Random( names ) ) end ) [/lua][/QUOTE] The only downside is that the 10 minute timer will be reset at every map switch. If you REALLY wanted your maps to switch exactly every X amount of time, regardless of map switches, you could use this. [CODE] local names = { "name1", "name2", "etc", } local delay = 600 --delay in seconds. timer.Create( "MapNameChange", 1, 0, function() if ( os.time() % delay ) == 0 then RunConsoleCommand( "hostname", table.Random( names ) ) end end ) [/CODE] NOTE: WARNING: BE AWARE: This code is not as efficient as Greetings code, which is not as efficient as if you just used Think. However it is more reliable.
[QUOTE=Greetings;43376978][lua] local names = { "name1", "name2", "etc", } local delay = 600 --Change every 10 minutes timer.Create( "changename", delay, 0, function() RunConsoleCommand( "hostname", table.Random( names ) ) end ) [/lua][/QUOTE] And where should I put this exactly? lua>autorun?
[QUOTE=aning159;43377367]And where should I put this exactly? lua>autorun?[/QUOTE] autorun/server
Ahhh alright man thanks :D
Sorry, you need to Log In to post a reply to this thread.