Garry's Mod Wiki

SANDBOX:PlayerSpawnSENT

  boolean SANDBOX:PlayerSpawnSENT( Player ply, string class )

Description

Called when a player attempts to spawn an Entity from the Q menu.

Arguments

1 Player ply
The player who attempted to spawn the entity.
2 string class
Class name of the entity the player tried to spawn.

Returns

1 boolean
Should the player be able to spawn the entity or not.

Example

Stops non-admins from spawning entities.

function GM:PlayerSpawnSENT( ply, class ) if not ply:IsAdmin() then return false end end