Revision Difference
game.AddAmmoType#528307
<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>.
You can find a list of default ammo types [here](https://wiki.facepunch.com/gmod/Default_Ammo_Types).
<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>
</description>
<realm>Shared</realm>
<file line="24">lua/includes/extensions/game.lua</file>
<file line="2-L40">lua/includes/extensions/game.lua</file>
<args>
<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>⤶
<description>Add an ammo type.</description>⤶
<code>
game.AddAmmoType({
game.AddAmmoType( {
name = "ammo_9mm_max",
dmgtype = DMG_BULLET,
tracer = TRACER_LINE,
plydmg = 0,
npcdmg = 0,
force = 2000,
minsplash = 10,
maxsplash = 5
})
} )
</code>
⤶
</example></example>