Player/PickupObject

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(Extra note.)
(Note template)
 
Line 2: Line 2:
 
|Description=This makes the player hold ( same as pressing {{Key|E}} on a small prop ) the provided entity.
 
|Description=This makes the player hold ( same as pressing {{Key|E}} on a small prop ) the provided entity.
  
'''Note:''' Don't get this confused with picking up items like ammo or health kits.
+
{{Note|Don't get this confused with picking up items like ammo or health kits}}
  
'''Note:''' This picks up the passed entity regardless of its mass or distance from the player.
+
{{Note|This picks up the passed entity regardless of its mass or distance from the player}}
 
|Realm=Server
 
|Realm=Server
 
|IsClass=Yes
 
|IsClass=Yes

Latest revision as of 15:35, 20 September 2016

 Player:PickupObject( )

Contents

Description

This makes the player hold ( same as pressing E on a small prop ) the provided entity.

NOTE

Don't get this confused with picking up items like ammo or health kits

NOTE

This picks up the passed entity regardless of its mass or distance from the player

Arguments

Entity entity

Entity to pick up.

Examples

Example

An extra function to make sure the object isn't held before being picked up.

function PlayerPickupObject(ply, obj)
	if ( obj:IsPlayerHolding() ) then return end
	ply:PickupObject( obj )
end


Personal tools
Navigation