Gamemode.PlayerSpawnObject
From GMod Wiki
| Event Hook | |
| Hook Name | PlayerSpawnObject |
| Syntax | GM:PlayerSpawnObject( Player ply ) |
| Description | Called when a player wants to spawn a prop, a ragdoll or an effect. |
| Returns | Boolean |
| Lua State | |
| BBCode | [b][url=wiki.garrysmod.com/?title=Gamemode.PlayerSpawnObject]Gamemode.PlayerSpawnObject [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
| Description | Blocks the spawning of objects for non admins. |
|---|---|
| Used on | |
| Code | local function AdminOnly( ply ) return ply:IsAdmin() end hook.Add( "PlayerSpawnObject", "AdminOnly", AdminOnly) |
| Output | N/A |
Additional Notes
- Return true to allow spawning the object, false for not allowing it.
- This is called before the PlayerSpawn* hooks.
- An object is a prop, a ragdoll or an effect.