Player/GetWeapons

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(Use # instead of table.Count now that the table is ordered)
 
(10 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
{{Func
 
{{Func
|Name=GetWeapons
+
|Description=Returns a table of the player's weapons.
|Parent=Player
+
|Description=Returns a table of the player's weapons. Read only.
+
 
|Realm=Shared
 
|Realm=Shared
 
|IsClass=Yes
 
|IsClass=Yes
Line 12: Line 10:
 
{{Example
 
{{Example
 
|Description=Prints how many weapons the player has.
 
|Description=Prints how many weapons the player has.
|Code=print(table.Count(Player(1):GetWeapons()))
+
|Code=print( #Entity(1):GetWeapons() )
 
|Output=The number of weapons the player has (e.g. 5).
 
|Output=The number of weapons the player has (e.g. 5).
 
}}
 
}}

Latest revision as of 21:40, 10 October 2019

 Player:GetWeapons( )

Contents

Description

Returns a table of the player's weapons.

Returns

table

All the weapons the player currently has.

Examples

Example

Prints how many weapons the player has.

print( #Entity(1):GetWeapons() )

Output:

The number of weapons the player has (e.g. 5).
Personal tools
Navigation