Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. Assign a script to another server - how?

Assign a script to another server - how?

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
8 Posts 3 Posters 323 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • MrGamerProsundefined Offline
    MrGamerProsundefined Offline
    MrGamerPros
    wrote on last edited by
    #1

    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?

    Kalitosundefined 1 Reply Last reply
    0
    • Kalitosundefined Offline
      Kalitosundefined Offline
      Kalitos
      replied to MrGamerPros on last edited by
      #2

      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")

      MrGamerProsundefined 2 Replies Last reply
      1
      • MrGamerProsundefined Offline
        MrGamerProsundefined Offline
        MrGamerPros
        replied to Kalitos on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • MrGamerProsundefined Offline
          MrGamerProsundefined Offline
          MrGamerPros
          replied to Kalitos on last edited by
          #4

          Kalitos Hey M8 whats up - could you help me right now ?

          Kalitosundefined 1 Reply Last reply
          0
          • Kalitosundefined Offline
            Kalitosundefined Offline
            Kalitos
            replied to MrGamerPros on last edited by Kalitos
            #5

            MrGamerPros

            
            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()
            {
            
            }
            
            1 Reply Last reply
            0
            • Xerxesundefined Offline
              Xerxesundefined Offline
              Xerxes Plutonium Staff
              wrote on last edited by
              #6

              I would rather use the server key instead of the port to identify the server.

              1 Reply Last reply
              0
              • Kalitosundefined Offline
                Kalitosundefined Offline
                Kalitos
                wrote on last edited by
                #7

                It is useful too. The idea is the same.

                1 Reply Last reply
                0
                • Xerxesundefined Offline
                  Xerxesundefined Offline
                  Xerxes Plutonium Staff
                  wrote on last edited by
                  #8

                  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.

                  1 Reply Last reply
                  0

                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Donate