Anyone know how to do so the server name is changing between several names?.
Something like
[code]
local name = "whatever"
game.ConsoleCommand( "hostname " .. name .. "\n" )
[/code]
And then just have a timer which goes through a table of possible hostnames and runs that command on it.
[code]
local M = {}
M[1] = "Test 1"
M[2] = "Test 2"
M[3] = "Test 3"
M[4] = "Test 4"
M[5] = "Test 5"
game.ConsoleCommand("hostname Server name on startup.\n")
timer.Create("Title",600,0,function()
local message = M[math.random(1,#M)]
game.ConsoleCommand("hostname Server name with a custom message: "..message.."\n")
end)
[/code]
That way, if you're unlucky, you could have the same hostname for several cycles. Of course the OP didn't say that was a problem so sure, it'll work but:
[code]
local names = {
"Name 1",
"Name 2",
"Name 3",
"Name 4",
}
local i = 0
timer.Create( "Hostname", 600, 0, function()
i = i % #names + 1
game.ConsoleCommand( "hostname " .. names[ i ] .. "\n" )
end )
[/code]
Only issue left is that hostnames are cached.
Sorry, you need to Log In to post a reply to this thread.