Gamemode.PlayerSpawnSWEP
From GMod Wiki
| Event Hook | |
| Hook Name | PlayerSpawnSWEP |
| Syntax | GM:PlayerSpawnSWEP( Player ply, String classname, Table weapon table ) |
| Description | Called when a player wants to spawn a SWEP |
| Returns | Boolean |
| Lua State | |
| BBCode | [b][url=wiki.garrysmod.com/?title=Gamemode.PlayerSpawnSWEP]Gamemode.PlayerSpawnSWEP [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
| Description | Stops players spawning SWEPs. |
|---|---|
| Used on | |
| Code | function GM:PlayerSpawnSWEP( ply, class, wep ) return false; end |
| Output | N/A |
| Description | Only allows admins to spawn SWEPs. |
|---|---|
| Used on | |
| Code | hook.Add("PlayerSpawnSWEP", "AdminOnlySWEPs", function( ply, class, wep ) return ply:IsAdmin() end) |
| Output | N/A |
Additional Notes
- Return false to prevent spawning of the SWEP.