Gamemode.PlayerLoadout

From GMod Wiki

Revision as of 15:18, 17 February 2011 by BlackVoid (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Event Hook
Hook NamePlayerLoadout
SyntaxGM:PlayerLoadout( Player Player )
DescriptionCalled to give players the default set of weapons.
ReturnsNil
Lua StateNewerServer.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.PlayerLoadout]Gamemode.PlayerLoadout [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionGives players only the shotgun and gravity gun at spawn.
Used onNewerServer.png
Code
function Loadout( ply )
	ply:GiveAmmo(30,"buckshot",true)
	ply:Give("weapon_shotgun")
 
	ply:Give("weapon_physcannon")
 
	ply:SelectWeapon("weapon_physcannon")
 
	return true -- this prevents the gamemode's default PlayerLoadout from getting called
--(this only applies when you're not coding the gamemode itself)
end
 
hook.Add( "PlayerLoadout", "gravAndShot", Loadout)
OutputN/A


Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox