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

Plutonium

  1. Home
  2. BO2 Modding Releases & Resources
  3. Max Ammo changed to work like BO3/BO4/Cold War (Clip Refills)

Max Ammo changed to work like BO3/BO4/Cold War (Clip Refills)

Scheduled Pinned Locked Moved BO2 Modding Releases & Resources
21 Posts 14 Posters 5.1k Views 2 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.
  • MisterX2003undefined MisterX2003

    Sorry if it already exists, but I couldn't find it. Just a buncha old scripts that wouldn't work., so I made my own with help from the discord

    #include common_scripts\utility;
    #include maps\mp\_utility;
    #include maps\mp\zombies\_zm_utility;
    #include maps\mp\zombies\_zm_powerups;
    
    init()
    {
        level thread onPlayerConnect();
    }
    
    onPlayerConnect()
    {
        level endon("game_ended");
        for(;;)
        {
            level waittill("connected", player);
            player thread onPlayerSpawned();
        }
    }
    
    onPlayerSpawned()
    {
        self endon("disconnect");
        level endon("game_ended");
        for(;;)
        {
            self waittill("spawned_player");
            if(!isDefined(level.maC1))
            {
                wait 5;
                level.maC1 = "DONE";
        		replaceFunc(maps\mp\zombies\_zm_powerups::full_ammo_powerup,::new_full_ammo_powerup);
            }    
        }
    }
    
    new_full_ammo_powerup( drop_item, player )
    {
        players = get_players( player.team );
    
        if ( isdefined( level._get_game_module_players ) ){
            players = [[ level._get_game_module_players ]]( player );
        }
    
        for ( i = 0; i < players.size; i++ )
        {
            if ( players[i] maps\mp\zombies\_zm_laststand::player_is_in_laststand() )
                continue;
    
            primary_weapons = players[i] getweaponslist( 1 );
            players[i] notify( "zmb_max_ammo" );
            players[i] notify( "zmb_lost_knife" );
            players[i] notify( "zmb_disable_claymore_prompt" );
            players[i] notify( "zmb_disable_spikemore_prompt" );
    
            for ( x = 0; x < primary_weapons.size; x++ )
            {
            	curWeapon = primary_weapons[x];
                if ( level.headshots_only && is_lethal_grenade(curWeapon) ){
                    continue;
                }
    
                if ( isDefined( level.zombie_include_equipment ) && isDefined( level.zombie_include_equipment[curWeapon] ) ){
                    continue;
                }
    
                if ( isDefined( level.zombie_weapons_no_max_ammo ) && isDefined( level.zombie_weapons_no_max_ammo[curWeapon] ) ){
                    continue;
                }
    
                if ( players[i] hasweapon( curWeapon ) ){
                    players[i] givemaxammo( curWeapon );
                    players[i] setweaponammoclip( curWeapon, 300);
                }
    
            }
        }
    
        level thread full_ammo_on_hud( drop_item, player.team );
    }
    

    Please report any bugs or errors.

    For the record, there is one I know of already, if you have a dual wield (eg. dual wield five sevens) and you have another weapon out when you get the max ammo, the dual wield weapon will only have one clip refilled.
    One of them won't
    If you're holding the dual wield, it refills as expected.
    If anyone knows how to fix, be my guest

    znchiundefined Offline
    znchiundefined Offline
    znchi
    wrote on last edited by
    #5

    MisterX2003 I believe you can omit this segment:

    init()
    {
        level thread onPlayerConnect();
    }
    
    onPlayerConnect()
    {
        level endon("game_ended");
        for(;;)
        {
            level waittill("connected", player);
            player thread onPlayerSpawned();
        }
    }
    
    onPlayerSpawned()
    {
        self endon("disconnect");
        level endon("game_ended");
        for(;;)
        {
            self waittill("spawned_player");
            if(!isDefined(level.maC1))
            {
                wait 5;
                level.maC1 = "DONE";
        		replaceFunc(maps\mp\zombies\_zm_powerups::full_ammo_powerup,::new_full_ammo_powerup);
            }    
        }
    }
    

    and write it as

    main()
    {
    	replaceFunc(maps\mp\zombies\_zm_powerups::full_ammo_powerup,::new_full_ammo_powerup);
    }
    

    afaik replaceFunc only needs to be run once per game, your code runs it once for each player.

    AdrX003undefined 1 Reply Last reply
    1
    • MisterX2003undefined MisterX2003

      Sorry if it already exists, but I couldn't find it. Just a buncha old scripts that wouldn't work., so I made my own with help from the discord

      #include common_scripts\utility;
      #include maps\mp\_utility;
      #include maps\mp\zombies\_zm_utility;
      #include maps\mp\zombies\_zm_powerups;
      
      init()
      {
          level thread onPlayerConnect();
      }
      
      onPlayerConnect()
      {
          level endon("game_ended");
          for(;;)
          {
              level waittill("connected", player);
              player thread onPlayerSpawned();
          }
      }
      
      onPlayerSpawned()
      {
          self endon("disconnect");
          level endon("game_ended");
          for(;;)
          {
              self waittill("spawned_player");
              if(!isDefined(level.maC1))
              {
                  wait 5;
                  level.maC1 = "DONE";
          		replaceFunc(maps\mp\zombies\_zm_powerups::full_ammo_powerup,::new_full_ammo_powerup);
              }    
          }
      }
      
      new_full_ammo_powerup( drop_item, player )
      {
          players = get_players( player.team );
      
          if ( isdefined( level._get_game_module_players ) ){
              players = [[ level._get_game_module_players ]]( player );
          }
      
          for ( i = 0; i < players.size; i++ )
          {
              if ( players[i] maps\mp\zombies\_zm_laststand::player_is_in_laststand() )
                  continue;
      
              primary_weapons = players[i] getweaponslist( 1 );
              players[i] notify( "zmb_max_ammo" );
              players[i] notify( "zmb_lost_knife" );
              players[i] notify( "zmb_disable_claymore_prompt" );
              players[i] notify( "zmb_disable_spikemore_prompt" );
      
              for ( x = 0; x < primary_weapons.size; x++ )
              {
              	curWeapon = primary_weapons[x];
                  if ( level.headshots_only && is_lethal_grenade(curWeapon) ){
                      continue;
                  }
      
                  if ( isDefined( level.zombie_include_equipment ) && isDefined( level.zombie_include_equipment[curWeapon] ) ){
                      continue;
                  }
      
                  if ( isDefined( level.zombie_weapons_no_max_ammo ) && isDefined( level.zombie_weapons_no_max_ammo[curWeapon] ) ){
                      continue;
                  }
      
                  if ( players[i] hasweapon( curWeapon ) ){
                      players[i] givemaxammo( curWeapon );
                      players[i] setweaponammoclip( curWeapon, 300);
                  }
      
              }
          }
      
          level thread full_ammo_on_hud( drop_item, player.team );
      }
      

      Please report any bugs or errors.

      For the record, there is one I know of already, if you have a dual wield (eg. dual wield five sevens) and you have another weapon out when you get the max ammo, the dual wield weapon will only have one clip refilled.
      One of them won't
      If you're holding the dual wield, it refills as expected.
      If anyone knows how to fix, be my guest

      Nuclear_Toonsundefined Offline
      Nuclear_Toonsundefined Offline
      Nuclear_Toons
      wrote on last edited by
      #6
      This post is deleted!
      AdrX003undefined 1 Reply Last reply
      0
      • Nuclear_Toonsundefined Nuclear_Toons

        This post is deleted!

        AdrX003undefined Offline
        AdrX003undefined Offline
        AdrX003
        wrote on last edited by AdrX003
        #7

        @The_Spectre115 As the plutonium docs say, you cannot "inject" things in any way, this word usually means that we are gonna use an external program that will patch the game memory wile its running, and thats exatcly what triggers the ban system.

        We instead "load" the scripts letting the Compiled GSC in a predefined folder plutonium setted up for it. the tutorial for it is on the point 6 in here:

        https://plutonium.pw/docs/modding/loading-mods/#t6

        1 Reply Last reply
        0
        • znchiundefined znchi

          MisterX2003 I believe you can omit this segment:

          init()
          {
              level thread onPlayerConnect();
          }
          
          onPlayerConnect()
          {
              level endon("game_ended");
              for(;;)
              {
                  level waittill("connected", player);
                  player thread onPlayerSpawned();
              }
          }
          
          onPlayerSpawned()
          {
              self endon("disconnect");
              level endon("game_ended");
              for(;;)
              {
                  self waittill("spawned_player");
                  if(!isDefined(level.maC1))
                  {
                      wait 5;
                      level.maC1 = "DONE";
              		replaceFunc(maps\mp\zombies\_zm_powerups::full_ammo_powerup,::new_full_ammo_powerup);
                  }    
              }
          }
          

          and write it as

          main()
          {
          	replaceFunc(maps\mp\zombies\_zm_powerups::full_ammo_powerup,::new_full_ammo_powerup);
          }
          

          afaik replaceFunc only needs to be run once per game, your code runs it once for each player.

          AdrX003undefined Offline
          AdrX003undefined Offline
          AdrX003
          wrote on last edited by AdrX003
          #8

          znchi just tested this one, it also works thanks to both of u 👏 👏

          1 Reply Last reply
          0
          • FantasticLokiundefined Offline
            FantasticLokiundefined Offline
            FantasticLoki
            wrote on last edited by
            #9

            This causes an infinite loop crash seemingly randomly on picking up a max ammo.

            1 Reply Last reply
            1
            • DoubleKundefined Offline
              DoubleKundefined Offline
              DoubleK
              wrote on last edited by
              #10

              FantasticLoki copied the actual max ammo code and added the extra line to fill the clip. works all the time for me without issues.

              new_full_ammo_powerup(drop_item, player) {
                      players = get_players( player.team );
              
              	if ( isDefined( level._get_game_module_players ) ) {
              		players = [[ level._get_game_module_players ]]( player );
              	}
              
              	i = 0;
              	while ( i < players.size ) {
              		if ( players[ i ] maps\mp\zombies\_zm_laststand::player_is_in_laststand() ) {
              			i++;
              			continue;
              		}    
              		else {
              			primary_weapons = players[ i ] getweaponslist( 1 );
              			players[ i ] notify( "zmb_max_ammo" );
              			players[ i ] notify( "zmb_lost_knife" );
              			players[ i ] notify( "zmb_disable_claymore_prompt" );
              			players[ i ] notify( "zmb_disable_spikemore_prompt" );
              
              			x = 0;
              			while ( x < primary_weapons.size ) {
              				if ( level.headshots_only && is_lethal_grenade( primary_weapons[ x ] ) ) {
              					x++;
              					continue;
              				}
              				else {
              					if ( isDefined( level.zombie_include_equipment ) && isDefined( level.zombie_include_equipment[ primary_weapons[ x ] ] ) )	{
              						x++;
              						continue;
              					}
              					else {
              						if ( players[ i ] hasweapon( primary_weapons[ x ] ) ) {
              							players[ i ] givemaxammo( primary_weapons[ x ] );
                            players[ i ] setweaponammoclip( primary_weapons[ x ], weaponclipsize( primary_weapons[ x ] ) );
              						}
              					}
              				}
              				x++;
              			}
              		}
              		i++;
              	}
              	level thread full_ammo_on_hud( drop_item, player.team );
              }
              
              1 Reply Last reply
              0
              • onicrazyyyundefined Offline
                onicrazyyyundefined Offline
                onicrazyyy
                wrote on last edited by
                #11

                How can I add this to my server?

                1 Reply Last reply
                0
                • DarkXwolf17._undefined Offline
                  DarkXwolf17._undefined Offline
                  DarkXwolf17._
                  wrote on last edited by
                  #12

                  i have a lil question,how do i add this to my game?

                  Resxtundefined 1 Reply Last reply
                  0
                  • DarkXwolf17._undefined DarkXwolf17._

                    i have a lil question,how do i add this to my game?

                    Resxtundefined Offline
                    Resxtundefined Offline
                    Resxt
                    Plutonium Staff
                    wrote on last edited by
                    #13

                    @Rubysexx read our doc

                    1 Reply Last reply
                    0
                    • HOOKEELundefined Offline
                      HOOKEELundefined Offline
                      HOOKEEL
                      wrote on last edited by
                      #14

                      I was testing and the game crashed for me.
                      The game crashes when performing the reload action of any weapon and at the same time taking maximum ammo.
                      This error was already described in this forum, but it was described as a random error, but it is not a random error.
                      If anyone finds a solution please share it, or if there is a forum about this please share it here.

                      1 Reply Last reply
                      0
                      • WhyYouNoSqueakyundefined Offline
                        WhyYouNoSqueakyundefined Offline
                        WhyYouNoSqueaky
                        wrote on last edited by
                        #15

                        no way to download it..

                        DirkRockfaceundefined 1 Reply Last reply
                        0
                        • WhyYouNoSqueakyundefined WhyYouNoSqueaky

                          no way to download it..

                          DirkRockfaceundefined Offline
                          DirkRockfaceundefined Offline
                          DirkRockface
                          Contributor
                          wrote on last edited by
                          #16

                          WhyYouNoSqueaky ??? nothing to download my man...

                          you cut and paste the code block, save it to a .gsc file, and put it in your scripts folder.

                          1 Reply Last reply
                          0
                          • WhyYouNoSqueakyundefined Offline
                            WhyYouNoSqueakyundefined Offline
                            WhyYouNoSqueaky
                            wrote on last edited by
                            #17

                            sounds complicated lol

                            Resxtundefined 1 Reply Last reply
                            0
                            • WhyYouNoSqueakyundefined WhyYouNoSqueaky

                              sounds complicated lol

                              Resxtundefined Offline
                              Resxtundefined Offline
                              Resxt
                              Plutonium Staff
                              wrote on last edited by
                              #18

                              WhyYouNoSqueaky it's not
                              Open a notepad, paste the text and save a new file with the .gsc extension

                              1 Reply Last reply
                              1
                              • WhyYouNoSqueakyundefined Offline
                                WhyYouNoSqueakyundefined Offline
                                WhyYouNoSqueaky
                                wrote on last edited by
                                #19

                                im literally slow, cuz i just cant even get it to be that type of file

                                Resxtundefined 1 Reply Last reply
                                0
                                • WhyYouNoSqueakyundefined WhyYouNoSqueaky

                                  im literally slow, cuz i just cant even get it to be that type of file

                                  Resxtundefined Offline
                                  Resxtundefined Offline
                                  Resxt
                                  Plutonium Staff
                                  wrote on last edited by
                                  #20

                                  WhyYouNoSqueaky choose "all" in type of files and add .gsc at the end of the file name

                                  WhyYouNoSqueakyundefined 1 Reply Last reply
                                  1
                                  • Resxtundefined Resxt

                                    WhyYouNoSqueaky choose "all" in type of files and add .gsc at the end of the file name

                                    WhyYouNoSqueakyundefined Offline
                                    WhyYouNoSqueakyundefined Offline
                                    WhyYouNoSqueaky
                                    wrote on last edited by
                                    #21

                                    Resxt you are my hero, thank you!

                                    1 Reply Last reply
                                    0
                                    Reply
                                    • Reply as topic
                                    Log in to reply
                                    • Oldest to Newest
                                    • Newest to Oldest
                                    • Most Votes


                                    • 1
                                    • 2
                                    • Login

                                    • Don't have an account? Register

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