2012-01-26 17:44:37 -05:00
|
|
|
function HandleMOTDCommand( Split, Player )
|
|
|
|
ShowMOTDTo( Player )
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
2013-07-05 15:56:32 -04:00
|
|
|
function LoadMotd()
|
|
|
|
local File = io.open("motd.txt", "r")
|
|
|
|
if not File then
|
|
|
|
CreateFile = io.open("motd.txt", "w")
|
|
|
|
CreateFile:write("@6Welcome to the MCServer test server!\n@6http://www.mc-server.org/\n@6Type /help for all commands")
|
|
|
|
CreateFile:close()
|
|
|
|
else
|
|
|
|
File:close()
|
|
|
|
end
|
|
|
|
for line in io.lines("motd.txt") do
|
2013-07-06 07:13:29 -04:00
|
|
|
local TempMessage = line
|
|
|
|
for I=1, string.len(TempMessage) do
|
|
|
|
if string.sub(TempMessage, I, I) == "@" then
|
|
|
|
local Color, Char = ReturnColor(TempMessage, I + 1)
|
|
|
|
if (Color ~= "") then
|
|
|
|
TempMessage = string.gsub(TempMessage, "@" .. Char, Color)
|
2013-07-05 15:56:32 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
Messages[#Messages + 1] = TempMessage
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-01-26 17:44:37 -05:00
|
|
|
function ShowMOTDTo( Player )
|
2013-07-05 15:56:32 -04:00
|
|
|
for I=1, #Messages do
|
|
|
|
Player:SendMessage(Messages[I])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function ReturnColor( Split, char )
|
2013-07-06 07:13:29 -04:00
|
|
|
if string.sub( Split, char, char ) == "0" then
|
2013-07-05 15:56:32 -04:00
|
|
|
return cChatColor.Black, 0
|
2013-07-06 07:13:29 -04:00
|
|
|
elseif string.sub( Split, char, char ) == "1" then
|
2013-07-05 15:56:32 -04:00
|
|
|
return cChatColor.Navy, 1
|
2013-07-06 07:13:29 -04:00
|
|
|
elseif string.sub( Split, char, char ) == "2" then
|
2013-07-05 15:56:32 -04:00
|
|
|
return cChatColor.Green, 2
|
2013-07-06 07:13:29 -04:00
|
|
|
elseif string.sub( Split, char, char ) == "3" then
|
2013-07-05 15:56:32 -04:00
|
|
|
return cChatColor.Blue, 3
|
2013-07-06 07:13:29 -04:00
|
|
|
elseif string.sub( Split, char, char ) == "4" then
|
2013-07-05 15:56:32 -04:00
|
|
|
return cChatColor.Red, 4
|
2013-07-06 07:13:29 -04:00
|
|
|
elseif string.sub( Split, char, char ) == "5" then
|
2013-07-05 15:56:32 -04:00
|
|
|
return cChatColor.Purple, 5
|
2013-07-06 07:13:29 -04:00
|
|
|
elseif string.sub( Split, char, char ) == "6" then
|
2013-07-05 15:56:32 -04:00
|
|
|
return cChatColor.Gold, 6
|
2013-07-06 07:13:29 -04:00
|
|
|
elseif string.sub( Split, char, char ) == "7" then
|
2013-07-05 15:56:32 -04:00
|
|
|
return cChatColor.LightGray, 7
|
2013-07-06 07:13:29 -04:00
|
|
|
elseif string.sub( Split, char, char ) == "8" then
|
2013-07-05 15:56:32 -04:00
|
|
|
return cChatColor.Gray, 8
|
2013-07-06 07:13:29 -04:00
|
|
|
elseif string.sub( Split, char, char ) == "9" then
|
2013-07-05 15:56:32 -04:00
|
|
|
return cChatColor.DarkPurple, 9
|
2013-07-06 07:13:29 -04:00
|
|
|
elseif string.sub( Split, char, char ) == "a" then
|
2013-07-05 15:56:32 -04:00
|
|
|
return cChatColor.LightGreen, "a"
|
2013-07-06 07:13:29 -04:00
|
|
|
elseif string.sub( Split, char, char ) == "b" then
|
2013-07-05 15:56:32 -04:00
|
|
|
return cChatColor.LightBlue, "b"
|
2013-07-06 07:13:29 -04:00
|
|
|
elseif string.sub( Split, char, char ) == "c" then
|
2013-07-05 15:56:32 -04:00
|
|
|
return cChatColor.Rose, "c"
|
2013-07-06 07:13:29 -04:00
|
|
|
elseif string.sub( Split, char, char ) == "d" then
|
2013-07-05 15:56:32 -04:00
|
|
|
return cChatColor.LightPurple, "d"
|
2013-07-06 07:13:29 -04:00
|
|
|
elseif string.sub( Split, char, char ) == "e" then
|
2013-07-05 15:56:32 -04:00
|
|
|
return cChatColor.Yellow, "e"
|
2013-07-06 07:13:29 -04:00
|
|
|
elseif string.sub( Split, char, char ) == "f" then
|
2013-07-05 15:56:32 -04:00
|
|
|
return cChatColor.White, "f"
|
|
|
|
else
|
|
|
|
return ""
|
|
|
|
end
|
2012-01-26 17:44:37 -05:00
|
|
|
end
|