Garry's Mod Wiki

Revision Difference

GM:AllowPlayerPickup#529087

<function name="AllowPlayerPickup" parent="GM" type="hook"> <ishook>yes</ishook> <description> Called when a player tries to pick up something using the "use" key, return to override. ⤶ See <page>GM:GravGunPickupAllowed</page> for the Gravity Gun pickup variant. ⤶ This hook will not be called if `sv_playerpickupallowed` is set to 0. ⤶ See <page>GM:GravGunPickupAllowed</page> for the Gravity Gun pickup variant.<br/>⤶ See <page>GM:PhysgunPickup</page> for the Physics Gun pickup variant.⤶ </description> <realm>Server</realm> <predicted>No</predicted> <file line="818-L828">gamemodes/base/gamemode/player.lua</file> <args> <arg name="ply" type="Player">The player trying to pick up something.</arg> <arg name="ent" type="Entity">The Entity the player attempted to pick up.</arg> </args> <rets> <ret name="" type="boolean">Allow the player to pick up the entity or not.</ret> </rets> </function> <example> <description>Allows only admins to pick up things.</description> <code> hook.Add( "AllowPlayerPickup", "AllowAdminsPickUp", function( ply, ent ) return ply:IsAdmin() end ) </code> </example>