Gamemode.PlayerJoinTeam

From GMod Wiki

Jump to: navigation, search
Event Hook
Hook NamePlayerJoinTeam
SyntaxGM:PlayerJoinTeam( Player ply, Integer Team Index )
DescriptionCalled when a player joins a team.
ReturnsNil
Lua StateNewerServer.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.PlayerJoinTeam]Gamemode.PlayerJoinTeam [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


DescriptionSpectators can only join the team TEAM_GUEST.
Used onNewerServer.png
Code
function GM:PlayerJoinTeam( ply, teamid )
	if ply:Team() == TEAM_SPECTATOR and teamid == TEAM_GUEST -- If the player's team is spectator and the team they are wanting to join is guest
		return true
	else
		return false
	end
end
OutputN/A


Additional Notes

See Also


Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox