TorNix~|nR Posted August 5, 2017 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?
NeXuS™ Posted August 5, 2017 Posted August 5, 2017 Search for each function in your script and just use the File functions for it.
Tekken Posted August 6, 2017 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
TorNix~|nR Posted August 6, 2017 Author Posted August 6, 2017 @Tekken, Thank you so much, you really saved my day
itHyperoX Posted August 6, 2017 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
TorNix~|nR Posted August 6, 2017 Author Posted August 6, 2017 @TheMOG thank you , the code of @Tekken is worked fine, ty
Rockyz Posted August 6, 2017 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
NeXuS™ Posted August 6, 2017 Posted August 6, 2017 @#,+( _xiRoc[K]; > it's just formating, and it shouldn't generate any errors whichever version you use. 1
Tekken Posted August 6, 2017 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
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