GM/PhysgunPickup

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
m (Fixing bad code)
Line 23: Line 23:
 
|Description=Allows Admins to pick up players.
 
|Description=Allows Admins to pick up players.
 
|Code=local function PlayerPickup(ply, ent)
 
|Code=local function PlayerPickup(ply, ent)
if ( ply:IsAdmin() and ent:GetClass():lower() == "player" ) then
+
if ply:IsAdmin() and ent:IsPlayer() then
 
return true
 
return true
 
end
 
end

Revision as of 19:05, 4 December 2019

 GM:PhysgunPickup( )

Contents

Description

Called to determine if a player should be able to pick up an entity with the Physics Gun.

See GM:OnPhysgunPickup for a hook which is called when a player has successfully picked up an entity.

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 Physics 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:IsPlayer() then
		return true
	end
end
hook.Add("PhysgunPickup", "Allow Player Pickup", PlayerPickup)


Personal tools
Navigation