I have an idea of a multiple server which shares same data as the other server instance. The whole CS2D dedicated server start/stop is controlled with Luvit (Node.js equivalent to Lua). The plan is to let the Luvit app spawn 4 dedicated server using 1 CS2D directory (as it uses exactly same scripts for the 4 dedicated servers) and tell the dedicated server later which port to use. The port range is 36901 for the first dedicated server, 36902 for the 2nd dedicated server, and so on.
As I can't modify sv_hostport at server.cfg, I have script something like this in my server.lua
1
2
3
4
2
3
4
initializeServer(function(name, port) 	parse("sv_name \""..name.."\") 	parse("sv_hostport "..port) end)
initializeServerpurpose is to connect back to the Luvit app which is listening to specific port where the Luvit app will send the server name and the port to the connected dedicated server. This part works, I receive the server name and the port, but line 3 at code above seem has no effect. I still see the server in my LAN tab (which means the server still listen on 36963, which is NOT what I want). PS: the function
initializeServerwaits indefinely, effectively stopping the whole CS2D dedicated execution until it receive the name and the port necessary.
The question is how can I change the server port when server.lua is loaded? I can't change the port in server.cfg!
Thanks,
AuahDark