Tekken Posted August 4, 2017 Posted August 4, 2017 Hi there, I am trying to make a script that loads text from a *.txt file but I keep getting this error, why? addEventHandler("log", getRootElement(), function(message) local f = fileOpen("logs.txt"); fileSetPos(f, fileGetSize(f)); fileWrite(f, time().." "..message:gsub("#%x%x%x%x%x%x", "").."\r"); fileFlush(f); fileClose(f); end); This one works. But when I try like this addCommandHandler("readlog", function(player) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) then local f1 = fileOpen("logs.txt"); if f1 then text1 = fileRead(f1, fileGetSize(f1)); fileClose(f1); end triggerClientEvent(player, "show:LOGS", player, text1); end end); It doesn't and I get this warnings fileOpen: unable to load file Bad argument @ 'fileGetSize' [Expected scriptfile at argument 1, got boolean] Bad argument @ 'fileRead' [Expected scriptfile at argument 1, got boolean] Bad argument @ 'fileClose' [Expected scriptfile at argument 1, got boolean] Hmm, if I set the readOnly propriety to fileOpen I only get the unable to load file warning. Resources I made: attachToBones - A newer bone_attach. Simple Level system - Just a simple level system. Do not PM me for help with leaked scripts! I WILL NOT HELP YOU!
MTA Team Lpsd Posted August 4, 2017 MTA Team Posted August 4, 2017 (edited) what are the contents of logs.txt? Edited August 4, 2017 by LopSided_
Tekken Posted August 4, 2017 Author Posted August 4, 2017 Text lines Date Time and chat outputs. Does it need to be lua script? Resources I made: attachToBones - A newer bone_attach. Simple Level system - Just a simple level system. Do not PM me for help with leaked scripts! I WILL NOT HELP YOU!
Tekken Posted August 4, 2017 Author Posted August 4, 2017 Like this [28-7-2017|9:6] (GLOBAL) Tekken: dsdsdsd [28-7-2017|9:7] (StaffChat) Tekken : dsds [28-7-2017|9:7] (GLOBAL) Tekken: dsd [28-7-2017|9:7] (StaffChat) Tekken : xcx [28-7-2017|9:8] (GLOBAL) Tekken: dsd [28-7-2017|9:59] (GLOBAL) [Tz]Marius5: salut [28-7-2017|10:6] (GLOBAL) [Tz]Marius5: Salut Resources I made: attachToBones - A newer bone_attach. Simple Level system - Just a simple level system. Do not PM me for help with leaked scripts! I WILL NOT HELP YOU!
Tekken Posted August 4, 2017 Author Posted August 4, 2017 I have found the problem I just misspelled the filepath. 2 Resources I made: attachToBones - A newer bone_attach. Simple Level system - Just a simple level system. Do not PM me for help with leaked scripts! I WILL NOT HELP YOU!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now