Assign a script to another server - how?
-
Hi, everyone. I have 2 servers running. But I want a different script to run on each server. How can I do that? As soon as I edit one, the script for the other server is logically adopted - how can I assign the script to exactly one server?
-
MrGamerPros You can add a check in the main function to differentiate which server to run the script on. You can do it by differentiating the ports of each one.
getdvar("net_port")
-
Kalitos Hey Kalitos and thank you very much for your time and your feedback. Could you explain that in more detail? In which main function can I change this? Do you maybe have a little step-by-step tutorial for me? I sincerely thank you.
-
Kalitos Hey M8 whats up - could you help me right now ?
-
init() { if(getdvar("net_port")=="4976") //Server 1 use 4976 net_port { level thread function1(); } if(getdvar("net_port")=="4986") //Server 2 use 4986 net_port { level thread function2(); } } function1() { } function2() { }
-
I would rather use the server key instead of the port to identify the server.
-
It is useful too. The idea is the same.
-
The basic idea is the same but the server key has the advantage that it won't change while the port can change depending on if a client is run, or in which turns the servers got started or a server crashed and restarted while not freeing the port. It just makes it easier for beginners.