Garry's Mod Wiki

GM:CanProperty

  boolean GM:CanProperty( Player ply, string property, Entity ent )
This hook is predicted. This means that in singleplayer, it will not be called in the Client realm.

Description

Controls if a property can be used or not.

Arguments

1 Player ply
Player, that tried to use the property
2 string property
Class of the property that is tried to use, for example - bonemanipulate
This is not guaranteed to be the internal property name used in properties.Add!
3 Entity ent
The entity, on which property is tried to be used on

Returns

1 boolean
Return false to disallow using that property

Example

Stops non-admins from using the remover property.

hook.Add( "CanProperty", "block_remover_property", function( ply, property, ent ) if ( !ply:IsAdmin() && property == "remover" ) then return false end end )