Player/Give

From Garry's Mod
Jump to: navigation, search
 Player:Give( )

Contents

Description

Gives the player a weapon.

NOTE

While this function is meant for weapons/pickupables only, it is not restricted to weapons. Any entity can be spawned using this function, including NPCs and SENTs.

Arguments

string weaponClassName

Class name of weapon to give the player

Arguments

boolean bNoAmmo=false

Set to true to not give any ammo on weapon spawn. (Reserve ammo set by DefaultClip)

Returns

Weapon

The weapon given to the player, if one was given. It will return NULL if the player already has the weapon, or the weapon entity (entity with given classname) doesn't exist.

Examples

Example

Gives the player a toolgun

Entity( 1 ):Give( "gmod_tool" )


Examples

Example

Removes all weapons and ammo from a player and gives a weapon_base SWEP with no ammo in it.

Entity( 1 ):StripWeapons()
Entity( 1 ):StripAmmo()

local w = Entity( 1 ):Give( "weapon_base", true )


Personal tools
Navigation