Gamemode.CanPlayerSuicide

From GMod Wiki

Revision as of 15:12, 17 February 2011 by BlackVoid (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Event Hook
Hook NameCanPlayerSuicide
SyntaxGM:CanPlayerSuicide( Player )
DescriptionCalled when a client wants to use the kill command in the console.
ReturnsBoolean
Lua StateNewerServer.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.CanPlayerSuicide]Gamemode.CanPlayerSuicide [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionDetermine whether or not a player can suicide.
Used onNewerServer.png
Code
 
	function GM:CanPlayerSuicide( ply )
		ply:PrintMessage(HUD_PRINTTALK, "You can't suicide!")
		return false
	end
 
OutputThe player is disallowed from suicideing, and is sent a message if he tries to.
DescriptionIf the player is an admin allow, other wise don't allow suicide.
Used onNewerServer.png
Code
 
	function GM:CanPlayerSuicide( ply )
		if ply:IsAdmin() then
			ply:PrintMessage(HUD_PRINTTALK, "You commited suicide!")
			return true
		end
		ply:PrintMessage(HUD_PRINTTALK, "You can't suicide!")
		return false
	end
 
OutputN/A


Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox