Garry's Mod Wiki

Revision Difference

GM:PreRegisterSENT#528923

<cat>hook</cat>⤶ <title>GM:PreRegisterSENT</title>⤶ ⤶ <function name="PreRegisterSENT" parent="GM" type="hook">⤶ <ishook>yes</ishook>⤶ <description>⤶ Called by <page>scripted_ents.Register</page>.⤶ </description>⤶ <realm>Shared</realm>⤶ <file line="L55">lua/includes/modules/scripted_ents.lua</file>⤶ <args>⤶ <arg name="ENT" type="table">The ENT table to be registered</arg>⤶ <arg name="classname" type="string">The class name to be assigned</arg>⤶ </args>⤶ <rets>⤶ <ret name="" type="boolean">Return `false` to prevent the entity from being registered. Returning any other value has no effect.</ret>⤶ </rets>⤶ </function>⤶ ⤶ <example>⤶ <description>Disallow registration of entities created by Garry, and change admin-only entities into regular entities.</description>⤶ <code>⤶ hook.Add( "PreRegisterSENT", "MakeThingsFun", function( ENT, classname )⤶ if ENT.Author == "Garry Newman" then⤶ return false⤶ else⤶ ENT.AdminOnly = false⤶ end⤶ end )⤶ </code>⤶ </example>