Gamemode.PlayerLoadout

From GMod Wiki

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