[OUTDATED] Gun Locker Fix
-
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?
- Download the compiled files and not the source code
- Take/Copy the GunLockerFix.dll file and put it in the plugins folder of IW4M Admin
How to add the code on my mods?
- Open your not compiled mod file with GSC Studio or other text editor
- 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(); } }- 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; }- Compile the file
- Put the compiled file in maps\mp\gametypes_zm
- Start the server
- Start IW4M
- 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.
-
-
-
SappFire There no more slot, only 1. Is only a fix, is a system to have the gun locker working as the original game
-
What are the chat commands for getting more slots?
-
AdrX003 I think he is talking about the limit of the gun locker, like store more then 1 gun
-
-
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... -
NourSofanati Soon update if an user tell me if all work fine
-
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?
- Download the compiled files and not the source code
- Take/Copy the GunLockerFix.dll file and put it in the plugins folder of IW4M Admin
How to add the code on my mods?
- Open your not compiled mod file with GSC Studio or other text editor
- 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(); } }- 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; }- Compile the file
- Put the compiled file in maps\mp\gametypes_zm
- Start the server
- Start IW4M
- 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.
