Garry's Mod Wiki

Revision Difference

SANDBOX:CanProperty#512818

<function name="CanProperty" parent="SANDBOX" type="hook">⤶ <ishook>yes</ishook>⤶ <description>Controls if a property can be used or not.</description>⤶ <realm>Shared</realm>⤶ <predicted>Yes</predicted>⤶ <args>⤶ <arg name="ply" type="Player">Player, that tried to use the property</arg>⤶ <arg name="property" type="string">Class of the property that is tried to use, for example - bonemanipulate&#xA;&#xA;&lt;warning&gt;This is not guaranteed to be the internal property name used in &lt;page&gt;properties.Add&lt;/page&gt;!&lt;/warning&gt;</arg>⤶ <arg name="ent" type="Entity">The entity, on which property is tried to be used on</arg>⤶ </args>⤶ <rets>⤶ <ret name="" type="boolean">Return false to disallow using that property</ret>⤶ </rets>⤶ </function>⤶ ⤶ <example>⤶ <description>Stops non-admins from using the remover property.</description>⤶ <code>⤶ hook.Add( "CanProperty", "block_remover_property", function( ply, property, ent )⤶ if ( !ply:IsAdmin() &amp;&amp; property == "remover" ) then return false end⤶ end )⤶ </code>⤶ ⤶ </example>