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

Plutonium

  1. Home
  2. BO2 Modding Releases & Resources
  3. [OUTDATED] Gun Locker Fix

[OUTDATED] Gun Locker Fix

Scheduled Pinned Locked Moved BO2 Modding Releases & Resources
14 Posts 8 Posters 2.2k 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.
  • Sorexundefined Offline
    Sorexundefined Offline
    Sorex Contributor
    wrote on last edited by Sorex
    #1

    Black Ops II Plutonium Gun Locker Fix

    Developed by DoktorSAS

    Contributors

    • fed for helping with the plugin

    Through these files it will be possible to get the Gun Locker Fully Working. Implementing the following scripts is very easy. In order to make the IW4M admin plugin work you also need to modify the mod in your server. You will have to add some lines of code

    Prerequisites:

    • IW4M Admin: To have the gun locker running on a server you must have IW4M

    How does this work?

    Everything has been done to make it as simple as possible, in fact it's just a few lines of code to add to a mod and a plugin to insert in the plugin folder of iw4m admin.

    How to use it?

    To implement these features takes two minutes, just follow this guide carefully and you will understand how to implement the bank on your servers.

    Guide

    Step by step

    How to add the the plugin to my IW4M?

    1. Download the compiled files and not the source code
    2. Take/Copy the GunLockerFix.dll file and put it in the plugins folder of IW4M Admin

    How to add the code on my mods?

    1. Open your not compiled mod file with GSC Studio or other text editor
    2. Add to your init function this lines of code
     if (getDvar("mapname") == "zm_buried" || getDvar("mapname") == "zm_highrise" || getDvar("mapname") == "zm_transit") {
    		level thread onPlayerConnect_gun_locker_fix();
    		level thread onEndGame_gun_locker_fix();
    	}
    

    like

    init(){
         if (getDvar("mapname") == "zm_buried" || getDvar("mapname") == "zm_highrise" || getDvar("mapname") == "zm_transit") {
    		level thread onPlayerConnect_gun_locker_fix();
    		level thread onEndGame_gun_locker_fix();
    	}
    }
    
    1. Add the this other funciton where you want in the mod
    onEndGame_gun_locker_fix(){
    	level waittill("end_game");
    	foreach(player in level.players){
    		if(isDefined(player.stored_weapon_data)){
    			new_dvar_value = "IW4MLOCKER;" + player.guid + "," + player.stored_weapon_data["name"] + "," + player.stored_weapon_data["lh_clip"] + "," + player.stored_weapon_data["clip"] + "," + player.stored_weapon_data["stock"] + "," + player.stored_weapon_data["alt_clip"]  + "," + player.stored_weapon_data["alt_stock"];
    			logPrint(new_dvar_value + "\n");
    		}else{
    			new_dvar_value = "IW4MLOCKER;" + player.guid + "," + "none";
    			logPrint(new_dvar_value + "\n");
    		}
    	}
    }
    
    onPlayerConnect_gun_locker_fix(){
        for(;;){
            level waittill("connected", player);
            player thread gun_locker_fix();
            player thread onPlayerDisconnect_gun_locker_fix();
        }
    }
    
    onPlayerDisconnect_gun_locker_fix(){
    	self waittill("disconnect");
    	stored_weapon_data = self.stored_weapon_data;
    	guid = self.guid;
    	if(isDefined(self.stored_weapon_data)){
    		new_dvar_value = "IW4MLOCKER;" + guid + "," + stored_weapon_data["name"] + "," + stored_weapon_data["lh_clip"] + "," + stored_weapon_data["clip"] + "," + stored_weapon_data["stock"] + "," + stored_weapon_data["alt_clip"]  + "," + stored_weapon_data["alt_stock"];
    		logPrint(new_dvar_value + "\n");
    	}else{
    		new_dvar_value = "IW4MLOCKER;" + guid + "," + "none";
    		logPrint(new_dvar_value + "\n");
    	}
    }
    
    gun_locker_fix(){
    	level endon("end_game");
    	self waittill("spawned_player");
    	while(getDvar( "guns_clients_information" ) == "" || !self setLockerGun(  )) // As long as the value of the bank is not valid then it remains in the loop
    		wait 0.001;
    
    }
    
    setLockerGun(  ) {
    	guns_data = strTok(getDvar( "guns_clients_information" ), "-"); // The dvar is divided into many elements so many players are in game
    	for (i = 0; i < guns_data.size; i++) {
    		client_data = strTok(guns_data[i], ","); // Divides each player's data into arrays with 7 values
    		if (int(client_data[0]) == int(self.guid)) { // If the GUID matches the user in analysis then sets the value of the stored weapondata and says that the value is valid
    			weapondata = [];
    			if(client_data[1] != "none"){
            		weapondata[ "name" ] 		= client_data[1];
           			weapondata[ "lh_clip" ] 	= client_data[2];
            		weapondata[ "clip" ] 		= client_data[3];
           		 	weapondata[ "stock" ]	 	= client_data[4];
            		weapondata[ "alt_clip" ] 	= client_data[5];
            		weapondata[ "alt_stock" ]	= client_data[6];
            		self.stored_weapon_data = weapondata;
            		self iprintln("Weapon Set!");
    			}
    			return 1;
    		}
    	}
    	return 0;
    }
    
    1. Compile the file
    2. Put the compiled file in maps\mp\gametypes_zm
    3. Start the server
    4. Start IW4M
    5. END

    Download

    Download the files from Github

    Source Code

    Download and/or read the source files from Github

    Use this forum post to report problems, also for code improvements and new features to implement. I remember it is a pre-release. Everything is in testing phase. In order to release an official version I need people to use this script on their servers.
    Ch00chinat0rundefined 1 Reply Last reply
    3
    • Lewis5441undefined Offline
      Lewis5441undefined Offline
      Lewis5441
      wrote on last edited by
      #2

      Great releases as always, keep it up. 🙂

      1 Reply Last reply
      2
      • SappFireundefined Offline
        SappFireundefined Offline
        SappFire
        wrote on last edited by
        #3

        What are the chat commands for getting more slots?

        AdrX003undefined 1 Reply Last reply
        0
        • Sorexundefined Offline
          Sorexundefined Offline
          Sorex Contributor
          wrote on last edited by
          #4

          SappFire There no more slot, only 1. Is only a fix, is a system to have the gun locker working as the original game

          1 Reply Last reply
          0
          • AdrX003undefined Offline
            AdrX003undefined Offline
            AdrX003
            replied to SappFire on last edited by
            #5

            SappFire wut? slots? what are these in game?

            1 Reply Last reply
            0
            • Sorexundefined Offline
              Sorexundefined Offline
              Sorex Contributor
              wrote on last edited by
              #6

              AdrX003 I think he is talking about the limit of the gun locker, like store more then 1 gun

              AdrX003undefined 1 Reply Last reply
              1
              • AdrX003undefined Offline
                AdrX003undefined Offline
                AdrX003
                replied to Sorex on last edited by AdrX003
                #7

                Sorex oh, that i wouldnt like, the bank and fridge are kinda OP already.

                1 Reply Last reply
                0
                • NourSofanatiundefined Offline
                  NourSofanatiundefined Offline
                  NourSofanati
                  wrote on last edited by
                  #8

                  I'm getting this error on IW4MAdmin for some reason, can you guide me on how to fix it please?

                  =====================================================
                   IW4MAdmin
                   by RaidMax
                   Version 2021.6.7.1
                  =====================================================
                  Failed to initialize IW4MAdmin
                  Unable to load one or more of the requested types.
                  Could not load type 'SharedLibraryCore.Database.Models.EFMeta' from assembly 'SharedLibraryCore, Version=2021.6.7.1, Culture=neutral, PublicKeyToken=null'.
                  Could not load type 'SharedLibraryCore.Database.Models.EFMeta' from assembly 'SharedLibraryCore, Version=2021.6.7.1, Culture=neutral, PublicKeyToken=null'.
                  Press enter to exit...
                  
                  
                  
                  1 Reply Last reply
                  0
                  • Sorexundefined Offline
                    Sorexundefined Offline
                    Sorex Contributor
                    wrote on last edited by
                    #9

                    NourSofanati Soon update if an user tell me if all work fine

                    1 Reply Last reply
                    0
                    • Ch00chinat0rundefined Offline
                      Ch00chinat0rundefined Offline
                      Ch00chinat0r
                      replied to Sorex on last edited by
                      #10

                      Sorex I don't believe this is working since the recent update 😞 Any chance we will get a fix soon? Love the idea of getting the locker working 🙂

                      Ch00chinat0rundefined 1 Reply Last reply
                      0
                      • Ch00chinat0rundefined Offline
                        Ch00chinat0rundefined Offline
                        Ch00chinat0r
                        replied to Ch00chinat0r on last edited by
                        #11

                        gun fix issue.PNG

                        1 Reply Last reply
                        0
                        • -HuayRaccoon-undefined Offline
                          -HuayRaccoon-undefined Offline
                          -HuayRaccoon-
                          wrote on last edited by
                          #12

                          I tried to use the command to store a pack a punched raygun and it didn't work. Is this something devs are planning to fix? Or is it intended to be impossible to store wonder weapons. It also happens with 1911 and with the akimbo mustang and Sally.

                          RedxSkullundefined 1 Reply Last reply
                          0
                          • RedxSkullundefined Offline
                            RedxSkullundefined Offline
                            RedxSkull
                            replied to -HuayRaccoon- on last edited by RedxSkull
                            #13

                            -HuayRaccoon- There is nothing to fix. I'm assuming you never played Bo2 before plutonium like on console or steam. The locker never had any commands and you couldn't store certain weapons like Wonder Weapons. Only with GSC could you change how the locker works like add in a command to deposit and withdraw. Plutonium has their games in their original state, but anyone can mod them with GSC for either private match or servers.

                            1 Reply Last reply
                            0
                            • Sorexundefined Offline
                              Sorexundefined Offline
                              Sorex Contributor
                              wrote on last edited by Sorex
                              #14

                              -HuayRaccoon- RedxSkull
                              I add that the GunLocker fix its now outated and not needed anymore. Before plutonium new stats system server did not have a way to make bank and locker work as intended (Like the original game) so i just made a fix for that.

                              Now plutonium fixed those issue and this plugins are not needed anymore.

                              P.S:

                              Both GunLockerFix and BankFix don't add any commands. They just make the weapon store on the iw4m database.

                              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