Garry's Mod Wiki

Revision Difference

game.AddAmmoType#519107

<function name="AddAmmoType" parent="game" type="libraryfunc"> <description> Adds a new ammo type to the game. You can find a list of default ammo types <page text="here">Default_Ammo_Types</page>. <warning>This function must be called shared or you will have unexpected problems.</warning> <note>This function must be called in <page>GM:Initialize</page>.</note> <note>There is a limit of 128 ammo types, including the default ones.</note> <bug pull="1487">This will have unpredictable results when registering ammo types with the same name but different capitalisation.</bug> </description> <realm>Shared</realm> <file line="24">lua/includes/extensions/game.lua</file> <args> <arg name="ammoData" type="table">The attributes of the ammo. See the <page>AmmoData</page>.</arg> <arg name="ammoData" type="table">The attributes of the ammo. See the <page>Structures/AmmoData</page>.</arg> </args> </function> <example> <description>Add an ammo type</description> <code> game.AddAmmoType({ name = "ammo_9mm_max", dmgtype = DMG_BULLET, tracer = TRACER_LINE, plydmg = 0, npcdmg = 0, force = 2000, minsplash = 10, maxsplash = 5 }) </code> </example>