Garry's Mod Wiki

Revision Difference

SANDBOX:PlayerSpawnSENT#529632

<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>⤶ <ret name="" type="boolean">Should the player be able to spawn the prop or not.</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>