Didn't work yet, here's my code now:
Server:
function sayUpdates()
local localTime = getRealTime(_,true)
local day = localTime.monthday
local month = localTime.month + 1
local year = localTime.year + 1900
outputChatBox("#F2D200["..year..":"..month..":"..day.."]NEW UPDATES! CHECK F1 TO SEE LATEST UPDATES!", getRootElement(), 255, 255, 255, true)
end
addEventHandler("onResourceStart", getResourceRootElement ( getThisResource() ), sayUpdates)
function getUpdates()
local file = "UpdatesLog.txt"
local openFile = fileOpen(file)
local size = fileGetSize(openFile)
if not openFile then outputChatBox("Error loading file") return false end
local updates = fileRead(openFile, size+500)
fileClose(openFile)
triggerClientEvent(client, "getUpdates", client, updates)
end
Client :
--[[-------------------------------------------------
Notes:
> This code is using a relative image filepath. This will only work as long as the location it is from always exists, and the resource it is part of is running.
To ensure it does not break, it is highly encouraged to move images into your local resource and reference them there.
--]]-------------------------------------------------
GUIEditor = {
label = {}
}
--local key = "F1"
updatesPanel = guiCreateWindow(195, 64, 986, 579, "Updates Changelog", false)
guiWindowSetSizable(updatesPanel, false)
updatesMemo = guiCreateMemo(10, 26, 966, 539, "", false, updatesPanel)
guiSetVisible(updatesPanel, false)
guiSetInputMode("no_binds_when_editing")
function showAndCloseWindow(command, state)
if not guiGetVisible(updatesPanel) then
guiSetVisible(updatesPanel, true)
showCursor(true)
getUpdates()
else
guiSetVisible(updatesPanel, false)
showCursor(false)
end
end
bindKey("F1", "down", showAndCloseWindow)
function getUpdates(updates)
guiSetText(updatesMemo, updates)
end
addEvent("getUpdates", true)
addEventHandler("getUpdates", root, getUpdates)
Gives me an error saying "Bad argument guiSetText, argument 2 expected string got nil"