Thread: (Released) Game Rules
View Single Post
Old 07-21-2015, 11:33 PM   #29
R00Kie
Kawaii! ルーキー
Lua Team
Wiki Team
Fortress Forever Staff
 
R00Kie's Avatar
 
Join Date: Jan 2008
Location: Nowhere, Kansas
Class/Position: Random
Gametype: CTF
Affiliations: BiG, Kawaii!, MustacheBrigade, GoodFellas
Posts Rated Helpful 82 Times
You can make Chat commands with the player_onchat function
Here's a basic example.

Code:
function player_onchat( player, chatstring )
	
	local player = CastToPlayer( player )
	
	-- string.gsub call removes all control characters (newlines, return carriages, etc)
	-- string.sub call removes the playername: part of the string, leaving just the message
	local message = string.sub( string.gsub( chatstring, "%c", "" ), string.len(player:GetName())+3 )
	
        if Message == "/Hello" then
		ChatToAll("HELLO!")
		return false  -- Doesnt actually send the message to chat but still uses the command.
	end

	return true -- Allows players to still chat normally
end
And here is the (almost nothing) Wiki: http://www.fortress-forever.com/wiki...=Player_onchat
__________________
Released: [ Island ] [ Rookie ] [ Limbo ] [ Sonic ] [ Tomb ] [ Skydive2 ] [ Bunkerwars ]
Beta: [ Argon ] [ Reflection ] [ Urbantag ]
Lua: [ game_rules ]

Last edited by R00Kie; 07-21-2015 at 11:35 PM.
R00Kie is offline   Reply With Quote


1 members found this post helpful.