Gamemode.CanPlayerSuicide

From GMod Wiki

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