Gmod Ammo System + HUDs - Script
Gmod Ammo System + HUDs is a complete ammo management system that will allow you to modulate the gameplays that involve ammo, from ammo management to maximum transportable ammo, customizing the display of magazines on the HUD with thousands of probabilities to do something unique, from the behavior of ammo on the ground, such as whether to press USE or just touch it to pick it up, to the behavior of the ammo. Whether or not players should loot their ammo when they die, or even how likely it is to happen. If they can via a chat command drop their ammo to the ground. It also allows you to create scripted ammo entities easily.
In short, this GMod addon is new in its genre and has the word "System" in its name for a reason.
❮
❯
Description of Gmod Ammo System + HUDs
Summary:- π¦ What Gmod Ammo System + HUDs contains
- π Description of Gmod Ammo System + HUDs
- β What type of need can Gmod Ammunition System meet?
- ποΈ A HUD Maker to customize the display of ammunition and magazines of weapons in hand
- π§° All variables included and modifiable from the management interface
- π§ 2D and 3D model system of your ammunition
- πΉοΈ Commands
- π¬ Modified Gmod API to make this possible
π¦ What Gmod Ammo System + HUDs contains
1. A max limit management system by type of ammunition.
2. An existing ammunition detection system on a server displaying in red the ammunition not included in the limitation system.
3. An administration interface
4. An integrated spawn menu of your ammunition generated easily from the configuration file.
5. A system of replacement of 3D models by 2D models just with simple images in png format.
6. A system of editing the display of ammunition on the HUD for a personal and unique rendering.
7. A style system to upload your own ammo icons, size, hide the capacity of a magazine on the interface if you disable it.
8. A System of gameplay modules
π Description of Gmod Ammo System + HUDs
Gmod Ammo System + HUDs will finally allow you to limit the maximum capacity of ammunition by having the possibility to disable the ammunition HUD or to replace it by a fully customized HUD.
On the gameplay side, you will be able to define the maximum capacity of ammunition transport that could evolve with the user's level or not.
The maximum capacity to carry a type of ammunition, modifiable in real time.
Choose if a player loot his ammo inventory, or even choose the chance rate, for example set to 50% there will be one chance in two.
Finally, allow your players to drop their ammunition as roleplay, being able to drop everything on the ground is important. Even in terms of realism. Then if you apply a maximum limit it will be important to be able to drop your stock as well.
β What type of need can Gmod Ammunition System meet?
If you have all these questions in mind, this script brings its solution:
How to disable the HUD of Gmod ammo (HL2)?
How to make people have a max ammo limit per ammo type to avoid having 9999 ammo, for example to limit the inventory to 5 rockets?
How to change the HUD of the ammo on Garry's Mod?
How to create ammo?
How do I change the value of ammo?
How do I add a command for people to drop their ammo?
How do I make people who die boot their ammo on the ground?
How to disable adding ammo to GMod when a user picks up a weapon?
How to enable max ammo limit on GMod?
How to disable notification when a player picks up ammo?
How to limit the max ammo carrying capacity?
ποΈ A HUD Maker to customize the display of ammunition and magazines of weapons in hand
1. Move the ammunition HUD up and down and from left to right.
4. Edit the style of the ammunition HUD and magazines, displaying bullets, cartridges, or single point of light, in line, circle, arc, etc...
2. Choose the size and width of the HUD of the magazines of the equipped weapons.
3. Change the ammo icon on the HUD. Upload on an image host for example imgur, copy the link of the image ending with .png. And it's done, the sharing will be done without workshop steam.
4. Edit the colors, the bar, the background, the icon, the text.
5. Edit the size of the icon. Respect the size you have configured, for example if the image is 32px and you have set a size of 22px it will be pixelated.
7. Choose to display the max capacity or not of the magazines, for example instead of displaying a magazine of 18 bullets, 18 / 18 you will have 18.
π§° All variables included and modifiable from the management interface
ammo_capacity_max = "Maximum ammunition carrying capacity" <numeric value>.
ammo_limitation = "Enable limitation of this type of ammunition" ON | OFF
weap_give_ammo = "Collects ammunition when picking up a weapon" ON | OFF
notification_ammo = "Notify when ammo is obtained" ON | OFF
ammo_drop_death = "Percentage chance of dropping ammo when player dies" <chance rate>%.
cmd_drop_ammo = "User can drop all his ammo with : drop_ammo" ON | OFF
ammo_max= "Max ammo storage capacity of a specific weapon type" <numeric value>
π§ 2D and 3D model system of your ammunition
Turn any 3D model into a useful ammunition entity. It may happen that you don't have your 3D ammunition models yet. With a simple image in png format create your ammunition entities from the configuration file. They will then be 2D models. Demonstration in video : https://youtu.be/IKO_BDwZmnk
πΉοΈ Commands
To open the management interface of Gmod Ammo System + HUDs:
You can use the chat command: !ammo
From the console: ammo
To drop the ammo on the ground on the chat: !drop_ammo
Or drop ammo by console command: drop_ammo
Or from my admin system access the shortcut buttons.
π¬ Modified Gmod API to make this possible
1. Lua functions: Server side modified to make this possible : Although modifying the following functions will not affect the proper functioning of this one with the other addons. Since the variables used are the same.
player:GiveAmmo( number amount, string type, boolean hidePopup = false ) = Allows you to give or remove ammunition from the player.
1. number amount // Quantity of ammunition
2. string type // Type of ammo. This can also be a number for the ammo ID, useful for custom ammo types.
3. boolean hidePopup = false // Hide the display window when assigning ammo.
player:SetAmmo( number ammoCount, any ammoType ) = Allows you to define the player's ammunition.
1. ammoCount // The amount of ammo to define.
2. any ammoType // The type of ammunition. This can be an ammo ID number or a string for the ammo name.
player:Give( string weaponClassName, boolean bNoAmmo = false ) = Allows to give a weapon to the player.
1. string weaponClassName // Name of the weapon class to give to the player
2. boolean bNoAmmo = false // Set to true to give no ammo when the weapon appears. (Reserve ammo is defined by DefaultClip).
Path: garrysmod/addons/norda_hud_ammo_system
- The AddWorkshop function is automatically added to the script server file and can be deactivated from the configuration file. : resource.AddWorkshop( 2771081584 )
- To add gmod workshop resources to your collection : Gmod Ammo System + HUDs [Content Only] | Gmod Workshop
You can use the chat command: !ammo
From the console: ammo
Or from my administration system access the shortcut buttons.
Click on a type of ammunition, example: AR2AltFire, and insert a number in the variable ammo_max.
In the image below I have put 90. This means that users will not be able to have more than 90 in AR2AltFire ammunition.
ammo_capacity_max set the value you want.
0 = Disabled
weap_give_ammi switch to OFF
notification_ammo set the line to OFF by clicking on it.
ammo_drop_death : Numeric value between 0 and 100.
0 = Disabled
100 = 100% ie a chance at all times that it drops its ammunition
cmd_drop_ammo switch to ON to activate it.
The chat command to drop ammo : !ammo_drop
The console command to drop ammo : ammo_drop
Move the Dslider, remember to have a weapon in hand that has ammunition since the HUD does not display for weapons that do not have ammunition such as the crowbar for example.
Insert the image link in: Update ammo icon
Insert the numerical value which will be the number of pixels. By default 22pixel. Remember to upload images that will have the size you have defined to avoid pixelated materials.
For example upload an image of 22px for a configured size of 22px on the interface.
0 = Do not display the max magazine capacity of the weapon in hand.
1 = Show the maximum magazine capacity of the weapon in hand.
Pos X = Move up and down
Pos Y = Left to right
Lenght = Length
Height = Thickness, for some styles this line increases the brightness.
All in the title of the color blocks :
This is a table that serves as an example, the examples are the ammunition of Half Life 2 that we find in Gmod.
cfg.Ammo_List={
{Class="item_ammo_pistol",Name="Pistol Ammo",AmmoType="Pistol",Ammo=20,Model="models/Items/boxsrounds.mdl",Icon="boxsrounds",Sound="physics/metal/weapon_impact_soft2.wav"},
{Class="item_ammo_smg1",Name="SMG Ammo",AmmoType="SMG1",Ammo=45,Model="models/Items/boxmrounds.mdl",Icon="boxmrounds",Sound="physics/metal/weapon_impact_soft2.wav"},
{Class="item_box_buckshot",Name="Buckshot Ammo",AmmoType="Buckshot",Ammo=20,Model="models/Items/boxbuckshot.mdl",Icon="boxbuckshot",Sound="physics/metal/weapon_impact_soft2.wav"},
{Class="item_ammo_357",Name="357 Ammo",AmmoType="357",Ammo=6,Model="models/Items/357ammo.mdl",Icon="357ammo",Sound="physics/metal/weapon_impact_soft2.wav"},
{Class="item_ammo_ar2",Name="AR2 Ammo",AmmoType="AR2",Ammo=30,Model="models/Items/combine_rifle_cartridge01.mdl",Icon="combine_rifle_cartridge01",Sound="physics/metal/weapon_impact_soft2.wav"},
{Class="item_ammo_ar2_altfire",Name="AR2 Energy Ball",AmmoType="AR2AltFire",Ammo=1,Model="models/Items/combine_rifle_ammo01.mdl",Icon="combine_rifle_ammo01",Sound="physics/metal/weapon_impact_soft2.wav"},
{Class="item_ammo_smg1_grenade",Name="SMG1 Grenade",AmmoType="SMG1_Grenade",Ammo=30,Model="models/Items/ar2_grenade.mdl",Icon="ar2_grenade",Sound="physics/metal/weapon_impact_soft2.wav"},
{Class="item_ammo_crossbow",Name="XBowBolt Ammo",AmmoType="XBowBolt",Ammo=6,Model="models/Items/crossbowrounds.mdl",Icon="crossbowrounds",Sound="physics/metal/weapon_impact_soft2.wav"},
}