Skip to content
  • 0 Unread 0
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
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 950 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
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
    • MrGamerProsundefined MrGamerPros

      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 Offline
      Kalitosundefined Offline
      Kalitos
      wrote 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
      • Kalitosundefined Kalitos

        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 Offline
        MrGamerProsundefined Offline
        MrGamerPros
        wrote 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
        • Kalitosundefined Kalitos

          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 Offline
          MrGamerProsundefined Offline
          MrGamerPros
          wrote on last edited by
          #4

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

          Kalitosundefined 1 Reply Last reply
          0
          • MrGamerProsundefined MrGamerPros

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

            Kalitosundefined Offline
            Kalitosundefined Offline
            Kalitos
            wrote 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

                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                  With your input, this post could be even better 💗

                  Register Login
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

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