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

Plutonium

Vl.Sunnyundefined

Vl.Sunny

@Vl.Sunny
About
Posts
5
Topics
2
Shares
0
Groups
0
Followers
6
Following
5

Posts

Recent Best Controversial

  • Wall buy fills weapon clip to max
    Vl.Sunnyundefined Vl.Sunny

    Couldn't find any working scripts so I made a server script that fills the clip to max when buying ammo from a wall buy.

    Script should be copy and pasted into your plutonium server folder at
    c:\storage\t6\scripts\zm

    Also I'm new to all of this stuff so let me know if there are any bugs or things that can be fixed, thanks!

    #include common_scripts\utility;
    #include maps\mp\_utility;
    #include maps\mp\zombies\_zm_utility;
    #include maps\mp\zombies\_zm_weapons;
    main()
    {
    	replaceFunc(maps\mp\zombies\_zm_weapons::ammo_give,::new_ammo_give);
    }
    new_ammo_give( weapon ) //checked changed to match cerberus output
    {
        give_ammo = 0;
        fill_clip = 0; // Add a flag to control clip filling
        if ( !is_offhand_weapon( weapon ) )
        {
            weapon = get_weapon_with_attachments( weapon );
            if ( isDefined( weapon ) )
            {
                stockmax = 0;
                stockmax = weaponstartammo( weapon );
                clipmax = weaponclipsize( weapon ); // Get the maximum clip size
                clipcount = self getweaponammoclip( weapon );
                currstock = self getammocount( weapon );
                stockleft = currstock - clipcount;
                if ( stockleft < stockmax )
                {
                    give_ammo = 1;
                }
                // Always fill the clip when buying ammo for a primary weapon
                if ( clipcount < clipmax )
                {
                    fill_clip = 1;
                }
            }
        }
        else if ( self has_weapon_or_upgrade( weapon ) )
        {
            if ( self getammocount( weapon ) < weaponmaxammo( weapon ) )
            {
                give_ammo = 1;
                // For offhand weapons, we might not want to automatically "refill" in the same way
                // Consider if you want to add a specific clip mechanic for offhands.
            }
        }
        if ( give_ammo || fill_clip ) // Give ammo OR fill the clip
        {
            self play_sound_on_ent( "purchase" );
            if ( give_ammo )
            {
                self givemaxammo( weapon );
                alt_weap = weaponaltweaponname( weapon );
                if ( alt_weap != "none" )
                {
                    self givemaxammo( alt_weap );
                }
            }
            if ( fill_clip )
            {
                self setweaponammoclip( weapon, clipmax ); // Fill the clip to max
            }
            return 1;
        }
        return 0;
    }
    
    BO2 Modding Releases & Resources
  • 1 / 1
  • Login

  • Don't have an account? Register

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