Garry's Mod Wiki

Revision Difference

GM:AllowPlayerPickup#511422

<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.⤶ </description>⤶ <realm>Server</realm>⤶ <predicted>No</predicted>⤶ <file line="786">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>⤶ local function up( ply, ent )⤶ return ply:IsAdmin()⤶ end⤶ hook.Add( "AllowPlayerPickup", "some_unique_name", up )⤶ </code>⤶ ⤶ </example>