..:D&G:.. Posted August 25, 2015 Share Posted August 25, 2015 Hello guys, I am trying to monitor what commands players use the most and the least, and record the command itself and the arguments used, like (/cmdname arg1 arg2) and store them in an txt file. The thing is I don't know how to get what command and arguments the player typed... Any ideas? Thanks. Link to comment
..:D&G:.. Posted August 25, 2015 Author Share Posted August 25, 2015 I managed to do this, but it messes up at the first command, and sometimes it messes up on the second. function logPlayerCommands(cmd) local theFile = fileOpen("cmdslogs.txt") fileSetPos(theFile, 200) fileWrite(theFile, "CMD: /"..cmd.."\n") fileClose(theFile) end addEventHandler("onPlayerCommand", root, logPlayerCommands) I just want it to continue a new line for each command. something like: " CMD: /command1 CMD: /command2 " And so on... Link to comment
Mr.Loki Posted August 25, 2015 Share Posted August 25, 2015 I made a script describing what you said but i couldnt find it else i would have sent it to you . I made it so that when you did /commandlog playername a gui would popup and show you what commands they used, the time and date they used them. It would create a folder for each player with their account name and playername, I think this should work i dont quite remember it was so long ago function logPlayerCommands(cmd) local theFile = fileOpen("cmdslogs.txt") fileSetPos(theFile, fileGetSize(theFile) -- to go to the end of the file) fileWrite(theFile, "CMD: /"..cmd.."\r\n") fileClose(theFile) end addEventHandler("onPlayerCommand", root, logPlayerCommands) 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