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

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. [Support] Save and load disabled

[Support] Save and load disabled

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
9 Posts 5 Posters 392 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.
  • lulaundefined Offline
    lulaundefined Offline
    lula Contributor
    wrote on last edited by Mr. Android
    #1

    i just added save and load on my server and its all good untill you join the server and it says save and load disabled. anybody know how to fix

    chorchi175undefined 1 Reply Last reply
    0
    • Ox_undefined Offline
      Ox_undefined Offline
      Ox_
      wrote on last edited by
      #2

      Maybe show code?
      Not quite sure what sort of answers you expect with the current state of your question.

      1 Reply Last reply
      0
      • lulaundefined Offline
        lulaundefined Offline
        lula Contributor
        wrote on last edited by
        #3

        Ox_ saveandload()

        {

        if (self.snl == 0)
        
        {
        
            self iprintln("^5Save and Load Enabled");
        
            self iprintln("Crouch and Press [{+actionslot 2}] To Save");
        
            self iprintln("Crouch and Press [{+actionslot 1}] To Load");
        
            self thread dosaveandload();
        
            self.snl = 1;
        
        }
        
        else
        
        {
        
            self iprintln("^1Save and Load Disabled");
        
            self.snl = 0;
        
            self notify("SaveandLoad");
        
        }
        

        }
        dosaveandload()

        {

        self endon("disconnect");
        
        self endon("SaveandLoad");
        
        load = 0;
        
        for(;;)
        
        {
        
        if (self actionslottwobuttonpressed() && self GetStance() == "crouch" && self.snl == 1)
        
        {
        
            self.o = self.origin;
        
            self.a = self.angles;
        
            load = 1;
        
            self iprintln("^5Position Saved");
        
            wait 2;
        
        }
        
        if (self actionslotonebuttonpressed() && self GetStance() == "crouch" && load == 1 && self.snl == 1)
        
        {
        
            self setplayerangles(self.a);
        
            self setorigin(self.o);
        
        }
        
        wait 0.05;
        

        }

        }

        And self thread saveandload(); in onPlayerSpawned() {

        Ox_undefined 1 Reply Last reply
        0
        • Ox_undefined Offline
          Ox_undefined Offline
          Ox_
          replied to lula on last edited by
          #4

          lula said in Save and load disabled:

          Ox_ saveandload()

          {

          if (self.snl == 0)
          
          {
          
              self iprintln("^5Save and Load Enabled");
          
              self iprintln("Crouch and Press [{+actionslot 2}] To Save");
          
              self iprintln("Crouch and Press [{+actionslot 1}] To Load");
          
              self thread dosaveandload();
          
              self.snl = 1;
          
          }
          
          else
          
          {
          
              self iprintln("^1Save and Load Disabled");
          
              self.snl = 0;
          
              self notify("SaveandLoad");
          
          }
          

          }
          dosaveandload()

          {

          self endon("disconnect");
          
          self endon("SaveandLoad");
          
          load = 0;
          
          for(;;)
          
          {
          
          if (self actionslottwobuttonpressed() && self GetStance() == "crouch" && self.snl == 1)
          
          {
          
              self.o = self.origin;
          
              self.a = self.angles;
          
              load = 1;
          
              self iprintln("^5Position Saved");
          
              wait 2;
          
          }
          
          if (self actionslotonebuttonpressed() && self GetStance() == "crouch" && load == 1 && self.snl == 1)
          
          {
          
              self setplayerangles(self.a);
          
              self setorigin(self.o);
          
          }
          
          wait 0.05;
          

          }

          }

          And self thread saveandload(); in onPlayerSpawned() {

          I'd assume you probably never define self.snl? You should define it before using it.
          Also toggling it on/off every time the player spawns in doesn't sound very good to me.

          1 Reply Last reply
          0
          • lulaundefined Offline
            lulaundefined Offline
            lula Contributor
            wrote on last edited by
            #5

            Ox_ what do i do to define it

            Sassundefined 1 Reply Last reply
            0
            • Sassundefined Offline
              Sassundefined Offline
              Sass Plutonium Staff
              replied to lula on last edited by Sass
              #6

              lula Just as a reminder, the scripts you can find in the forum are mostly samples that are here to help people having a working script, so you can build your own mod around that. Copy pasting stuff and praying for the best doesn't always work.

              Not to mention that the script itself is pretty shitty tbh, since that saveandload() function does nothing but swap the values of self.snl between 1 and 0, so you should DEFINETLY NOT call that in your onPlayerSpawned() if you want this to work correctly.


              What I would do is completely get rid of the saveandload() function, and instead call dosaveandload() in your onPlayerSpawned(). Maybe save the "Crouch and Press" iprintlns to paste them at the start of dosaveandload(), between self endon("SaveandLoad"); and load = 0;, so you still have the explaination text popping up.

              Then in your OnPlayerConnect(), put player.snl = 1; between the closest brackets, and every user who connects will be able to use the Save & Load thing. If you have some kind of VIP check or anything, you can use it in your OnPlayerConnect() function to either grant the SnL or not, like this for example :

              // This doesn't actually work unless the isVip function exists, this is only an example...
              if(player isVip())
                  player.snl = 1;
              else
                  player.snl = 0;
              
              1 Reply Last reply
              0
              • lulaundefined Offline
                lulaundefined Offline
                lula Contributor
                wrote on last edited by
                #7

                Thanks Thats nice to know

                1 Reply Last reply
                0
                • Ducxyundefined Offline
                  Ducxyundefined Offline
                  Ducxy
                  wrote on last edited by
                  #8

                  For me I just completely removed the toggle. So delete the part that makes it disabled and anything else to do with disabling it.

                  1 Reply Last reply
                  0
                  • chorchi175undefined Offline
                    chorchi175undefined Offline
                    chorchi175
                    replied to lula on last edited by
                    #9
                    This post is deleted!
                    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