Jump to content

JAVAAA

Members
  • Posts

    14
  • Joined

  • Last visited

Details

  • Gang
    COK
  • Location
    Egypt

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

JAVAAA's Achievements

Square

Square (6/54)

0

Reputation

  1. Doesn't work nvm, fixed
  2. I didn't understand you actually.
  3. Hey, I am asking how to write a new string before the original string that is existed in the file. Example: txt file contains "100" then I want to write a string before "100" My Code: function addUpdate(content) local file = "UpdatesLog.txt" local openFile = fileOpen(file) if not openFile then outputChatBox("Error loading file") return false end local date, time = getTimeDate() fileSetPos(openFile, fileGetPos(openFile)) if (fileGetSize(openFile) == 0) then fileWrite(openFile, "["..date.."]", content) else fileSetPos(openFile, fileGetSize(openFile)) fileWrite(openFile, "\r\n["..date.."]", content) end outputChatBox("#D16C00NEW UPDATES GOT ADDED!", getRootElement(), 255, 255, 255, true) outputChatBox("#D16C00- "..content, getRootElement(), 255, 255, 255, true) fileClose(openFile) end addEvent("COKupdates.addUpdate", true) addEventHandler("COKupdates.addUpdate", root, addUpdate) Now it writes a string after the original one.
  4. Worked, thanks. I wonder how it didn't work with me while your code is completely similar to my previous code ^^
  5. 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) ....
  6. 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"
  7. Now, the memo box's showing "F1" only while there is no text called "F1" in my .txt file.
  8. Hello, I am asking about how to read a file in the server and get the data from it into client? I tried a lot of times but nothing happens at all. Server : function getUpdates() local updates local file = "UpdatesLog.txt" local size = fileGetSize(file) local openFile = fileOpen(file) if openFile then while not fileIsEOF(openFile) do updates = fileRead(openFile, size) end fileClose(openFile) end triggerClientEvent(client, "getUpdates", client, updates) end Client : 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(updates) if not guiGetVisible(updatesPanel) then guiSetVisible(updatesPanel, true) showCursor(true) guiSetText(updatesMemo, updates) else guiSetVisible(updatesPanel, false) showCursor(false) end end bindKey(key, "down", showAndCloseWindow) addEvent("getUpdates", true) addEventHandler("getUpdates", root, showAndCloseWindow)
  9. Thanks everyone who answered! I appreciate it.
  10. Alright, thanks! Another question if you don't mind to answer it, how can I use "isObjectInACLGroup" function in client side?
  11. Nvm, worked. Can't I use event handler "onResourceStart"? Since event handler "onPlayerJoin" isn't suitable for me
  12. Hey, how to get player's account name in client script? I used triggerServerEvent but doesn't work. Also, I want it returns as a string so I could use it in different ways, thanks.
×
×
  • Create New...