Open it with a hexeditor, search for the line where it says theforgottenserver.exe then replace it with yourserver.exe
Ye... I already did search for that and got error saying "string not found".
ildeadfishl server
Not working :s
If you open the log file in append mode, you don't have to get the previous text to save it.@Jgarder: Yes, savePlayers() saves EVERYTHING.Code:[B]"a+":[/B] append update mode, previous data is preserved, writing is only allowed at the end of file
function onSay(cid, words, param)
local minid = 3
local restartTime = 1000*60*3
local message = "Server will restart in 3 minutes. Please stay in security area."
local messageStop = "Restart process has been stopped."
if getPlayerGroupId(cid) >= minid then
if param == "now" then
saveAndRestart(cid)
elseif param == "stop" then
broadcastMessage(messageStop, MESSAGE_STATUS_WARNING)
stopEvent(saverestart)
else
broadcastMessage(message, MESSAGE_STATUS_WARNING)
saverestart = addEvent(saveAndRestart, restartTime, cid)
end
end
end
function returnDate()
curdate = os.date("*t")
if curdate.day < 10 then
curdate.day = "0"..curdate.day
end
if curdate.month < 10 then
curdate.month = "0"..curdate.month
end
if curdate.hour < 10 then
curdate.hour = "0"..curdate.hour
end
if curdate.min < 10 then
curdate.min = "0"..curdate.min
end
return curdate
end
function saveAndRestart(cid)
file = io.open("data/logs/restarts.txt", "r")
if file == nil then
file = io.open("data/logs/restarts.txt", "w")
end
text = file:read()
if text == nil then
text = ""
end
file:close()
curdate = returnDate()
newdate = "\n["..curdate.day.."/"..curdate.month.."/"..curdate.year.." "..curdate.hour..":"..curdate.min.."]"
newtext = text..newdate.."Server restarted by "..getPlayerName(cid).."\n"
file = io.open("data/logs/restarts.txt", "w")
file:write(newtext)
file:close()
savePlayers()
io.popen("LuaRestarter.exe")
end
function onSay(cid, words, param)
local minid = 3
local restartTime = 1000*60*3
local message = "Server will be restarted in 3 minutes. Please stay in security area."
local messageStop = "Restart process has been stopped."
if getPlayerGroupId(cid) >= minid then
if param == "" then
broadcastMessage(message, MESSAGE_STATUS_WARNING)
saverestart = addEvent(saveAndRestart, restartTime, cid)
elseif param == "now" then
saveAndRestart (cid)
elseif param == "stop" then
broadcastMessage(messageStop, MESSAGE_STATUS_WARNING)
stopEvent(saverestart)
else
doPlayerSendCancel(cid, "Sorry, you made something wrong.")
end
end
end
function returnDate()
curdate = os.date("*t")
if curdate.day < 10 then
curdate.day = "0"..curdate.day
end
if curdate.month < 10 then
curdate.month = "0"..curdate.month
end
if curdate.hour < 10 then
curdate.hour = "0"..curdate.hour
end
if curdate.min < 10 then
curdate.min = "0"..curdate.min
end
return curdate
end
function saveAndRestart(cid)
file = io.open("data/logs/restarts.txt", "r")
if file == nil then
file = io.open("data/logs/restarts.txt", "w")
end
text = file:read()
if text == nil then
text = ""
end
file:close()
curdate = returnDate()
newdate = "\n["..curdate.day.."/"..curdate.month.."/"..curdate.year.." "..curdate.hour..":"..curdate.min.."]"
newtext = text..newdate.."Server restarted by "..getPlayerName(cid).."\n"
file = io.open("data/logs/restarts.txt", "w")
file:write(newtext)
file:close()
savePlayers()
io.popen("LuaRestarter.exe")
end