Garry's Mod Wiki

Revision Difference

Player:GetWeapons#561591

<function name="GetWeapons" parent="Player" type="classfunc"> <description> Returns a table of the player's weapons. <note>⤶ This function returns a sequential table, meaning it should be looped with <page>Global.ipairs</page> instead of <page>Global.pairs</page> for efficiency reasons.⤶ </note>⤶ </description> <realm>Shared</realm> <rets> <ret name="" type="table">All the weapons the player currently has.</ret> </rets> </function> <example> <description>Prints how many weapons the player has.</description> <code>print( #Entity( 1 ):GetWeapons() )</code> <output>The number of weapons the player has (e.g. 5).</output> </example>