SANDBOX:PlayerSpawnSWEP

From Garry's Mod
Jump to: navigation, search
 SANDBOX:PlayerSpawnSWEP( )

Contents

Description

Called when a player attempts to spawn a weapon from the Q menu. ( Mouse wheel clicks on an icon )

Arguments

Player ply

The player who attempted to spawn a weapon.

Arguments

string weapon

Class name of the weapon the player tried to spawn.

Arguments

table swep

Information about the weapon the player is trying to spawn, see SWEP structure

Returns

boolean

Can the SWEP be spawned

Examples

Example

Stops non-admins from spawning weapons.

hook.Add( "PlayerSpawnSWEP", "SpawnBlock", function( ply, class, info )
	if not ply:IsAdmin() then
		return false
	end
end )


Personal tools
Navigation