Garry's Mod Wiki

Revision Difference

SANDBOX:PlayerSpawnSENT#512838

<function name="PlayerSpawnSENT" parent="SANDBOX" type="hook">⤶ <ishook>yes</ishook>⤶ <description>Called when a player attempts to spawn an Entity from the Q menu.</description>⤶ <realm>Server</realm>⤶ <args>⤶ <arg name="ply" type="Player">The player who attempted to spawn the entity.</arg>⤶ <arg name="class" type="string">Class name of the entity the player tried to spawn.</arg>⤶ </args>⤶ <rets>⤶ <ret name="" type="boolean">can_spawn</ret>⤶ </rets>⤶ </function>⤶ ⤶ <example>⤶ <description>Stops non-admins from spawning entities.</description>⤶ <code>⤶ function GM:PlayerSpawnSENT( ply, class )⤶ if not ply:IsAdmin() then⤶ return false⤶ end⤶ end⤶ </code>⤶ ⤶ </example>