rendered paste body
ChatCommands = { }
function AddChatCommand( Command, Help, Callback )
if ( ChatCommands[ Command ] ) then
-- Shit happens.
print( "Command: " .. Command .. " already exists." )
return
end
-- Yarr
ChatCommands[ Command ] = { }
ChatCommands[ Command ].Help = Help
ChatCommands[ Command ].Callback = Callback
end
AddChatCommand( "/job", "Sets your job. Usage: /job <job>.", SetJobFuncKThxBai )
function DoChatCommands( Player, Text, TeamOnly )
local t = string.Explode( " ", Text )
local Command = t[ 1 ]
if ( ChatCommands[ Command ] ) then
table.remove( t, 1 )
Text = table.concat( t, " " )
if ( #t == 1 ) then
Player:ChatPrint( Command.. " -> " .. ChatCommands[ Command ].Help )
else
ChatCommands[ Command ].CallBack( Player, Text, TeamOnly )
end
return ""
else
return Text
end
end
function GM:PlayerSay( Player, Text, TeamOnly )
return DoChatCommands( Player, Text, TeamOnly )
end