TorNix~|nR Posted August 5, 2017 Share Posted August 5, 2017 Hello guys, I'm using a admin panel from the community https://community.multitheftauto.com/index.php?p=resources&s=details&id=8770 and I want to make logs for the players who owns the panel, for example when giving weapons, skins.. etc help please? Link to comment
NeXuS™ Posted August 5, 2017 Share Posted August 5, 2017 Search for each function in your script and just use the File functions for it. Link to comment
Tekken Posted August 6, 2017 Share Posted August 6, 2017 Here you go function time() local time = getRealTime(); return "["..(time.monthday).."-"..(time.month+1).."-"..(time.year+1900).."|"..time.hour..":"..time.minute.."]"; end function log(text) local f = fileOpen("logs.txt"); if not f then f = fileCreate("logs.txt"); end fileSetPos(f, fileGetSize(f)); fileWrite(f, time().." "..text:gsub("#%x%x%x%x%x%x", "").."\r"); fileFlush(f); fileClose(f); end log("SOMETHING"); You can also create a event to trigger it from another resource. 1 Link to comment
TorNix~|nR Posted August 6, 2017 Author Share Posted August 6, 2017 @Tekken, Thank you so much, you really saved my day Link to comment
itHyperoX Posted August 6, 2017 Share Posted August 6, 2017 (edited) you can create a export for @Tekken script. Simple add these to meta: <export function="log" type="shared" /> and call it like exports["resourceName"]:log("message") If its not working i'll send you mine with export functions. Edited August 6, 2017 by TheMOG Link to comment
TorNix~|nR Posted August 6, 2017 Author Share Posted August 6, 2017 @TheMOG thank you , the code of @Tekken is worked fine, ty Link to comment
Rockyz Posted August 6, 2017 Share Posted August 6, 2017 (edited) 6 hours ago, Tekken said: Here you go function time() local time = getRealTime(); return "["..(time.monthday).."-"..(time.month+1).."-"..(time.year+1900).."|"..time.hour..":"..time.minute.."]"; end function log(text) local f = fileOpen("logs.txt"); if not f then f = fileCreate("logs.txt"); end fileSetPos(f, fileGetSize(f)); fileWrite(f, time().." "..text:gsub("#%x%x%x%x%x%x", "")..""); fileFlush(f); fileClose(f); end log("SOMETHING"); You can also create a event to trigger it from another resource. i know its solved but line 12 should be like this : fileWrite(f, time()..":"..text:gsub("#%x%x%x%x%x%x", "").."\r\n"); Edited August 6, 2017 by #,+( _xiRoc[K]; > 1 Link to comment
NeXuS™ Posted August 6, 2017 Share Posted August 6, 2017 @#,+( _xiRoc[K]; > it's just formating, and it shouldn't generate any errors whichever version you use. 1 Link to comment
Tekken Posted August 6, 2017 Share Posted August 6, 2017 5 hours ago, #,+( _xiRoc[K]; > said: i know its solved but line 12 should be like this : fileWrite(f, time()..":"..text:gsub("#%x%x%x%x%x%x", "")..""); Nope! Output [4-8-2017|13:43] Tekken just did something. It's just a preference. Greetings. 1 Link to comment
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