10-04-2014, 12:01 AM
Is there a way to add the function to RegisterPluginInfoCommands();? Also, I tried making things local and when I call the function on load everything works however it still shows the motd with it.
local Rules = {}
function HandleRulesCommand( Split, Player )
ShowRulesTo( Player )
return true
end
function LoadRules()
local Rules = io.open( "rules.txt", "r" )
-- Check if the file 'rules.txt' exists, else create it.
if not Rules then
CreateRule = io.open( "rules.txt", "w" )
CreateRule:write("@6It works!")
CreateRule:close()
else
Rules:close()
end
for line in io.lines( "rules.txt" ) do
local rools = line
-- Do a for loop that goes to each char in the line.
for I=1, string.len( rools ) do
-- If the char is a '@' then check if the next char represents a color.
if string.sub( rools, I, I ) == "@" then
local Char = string.sub( rools, I + 1, I + 1 )
local Color = ReturnColorFromChar( rools, Char )
-- If the next char represented a color then put the color in the string.
if Color ~= nil then
rools = string.gsub( rools, "@" .. Char, Color )
end
end
end
-- Add the message to the list of messages.
Messages[#Messages + 1] = rools
end
end
function ShowRulesTo( Player )
for I=1, #Messages do
Player:SendMessage(Messages[I])
end
end

