GM/PhysgunPickup

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
m (Example: declared a local function instead of a global one)
Line 3: Line 3:
 
|Realm=Shared
 
|Realm=Shared
 
|Predicted=Yes
 
|Predicted=Yes
 +
|HidePredictionWarning=No
 
|Name=PhysgunPickup
 
|Name=PhysgunPickup
 
|Parent=GM
 
|Parent=GM
Line 22: Line 23:
 
{{Example
 
{{Example
 
|Description=Allows Admins to pick up players.
 
|Description=Allows Admins to pick up players.
|Code=function PlayerPickup(ply, ent)
+
|Code=local function PlayerPickup(ply, ent)
 
if ( ply:IsAdmin() and ent:GetClass():lower() == "player" ) then
 
if ( ply:IsAdmin() and ent:GetClass():lower() == "player" ) then
 
return true
 
return true

Revision as of 12:13, 18 May 2016

 GM:PhysgunPickup( )

Contents

Description

Called whenever a player picks up an entity with the Physgun.

NOTE

This hook is predicted. This means that in singleplayer, it will not be called in the Client realm.

Arguments

Player player

The player that is picking up using the phys gun.

Arguments

Entity entity

The entity that is being picked up.

Returns

boolean

Returns whether the player can pick up the entity or not.

Examples

Example

Allows Admins to pick up players.

local function PlayerPickup(ply, ent)
	if ( ply:IsAdmin() and ent:GetClass():lower() == "player" ) then
		return true
	end
end
hook.Add("PhysgunPickup", "Allow Player Pickup", PlayerPickup)


Personal tools
Navigation