1LoL1 Posted January 26, 2016 Share Posted January 26, 2016 (edited) Hello, i created script (logs) but not work idk why. Can anyone help me please? 0 Errors 0 Warning File Exist. Files it's added in meta.xml addEventHandler("onClientPlayerChangeNick", getRootElement(), function(oldNick, newNick) outputChatBox(""..oldNick.." --> "..newNick.."", 255, 100, 100, true) local logFile = fileOpen("logs/logs.log") if logFile then local size = fileGetSize(logFile) fileSetPos(logFile, size) fileWrite(logFile, ""..oldNick.." --> "..newNick.."") fileClose(logFile) end end) Edited February 2, 2016 by Guest Link to comment
tosfera Posted January 26, 2016 Share Posted January 26, 2016 is the outputChatBox working? Add a new one after: if logFile then outputChatBox("test") Link to comment
KariiiM Posted January 26, 2016 Share Posted January 26, 2016 (edited) Make it server sided better addEventHandler("onPlayerChangeNick", getRootElement(), function(oldNick, newNick) if (newNick) then outputChatBox(""..oldNick.." --> "..newNick.."",getRootElement(), 255, 100, 100, true) if (not fileExists("logs/logs.log")) then local logFile = fileOpen("logs/logs.log") if (logFile) then local size = fileGetSize(logFile) fileSetPos(logFile, size) fileWrite(logFile, ""..oldNick.." --> "..newNick.."") fileClose(logFile) end end end end) Edited January 26, 2016 by Guest Link to comment
tosfera Posted January 26, 2016 Share Posted January 26, 2016 That'll create the log on the server's filesystem and I think he wants to make them available for the client. Else I have no clue why he would've done it client-sided. Link to comment
1LoL1 Posted January 26, 2016 Author Share Posted January 26, 2016 That'll create the log on the server's filesystem and I think he wants to make them available for the client. Else I have no clue why he would've done it client-sided. You are right this i want. And outputChatBox working. and --> if logFile then outputChatBox("test") working too but it's not added in txt file. Link to comment
1LoL1 Posted January 26, 2016 Author Share Posted January 26, 2016 Anyone can help me please? Link to comment
cheez3d Posted January 26, 2016 Share Posted January 26, 2016 addEventHandler("onPlayerChangeNick", getRootElement(), function(oldNick, newNick) if (newNick) then outputChatBox(""..oldNick.." --> "..newNick.."",getRootElement(), 255, 100, 100, true) local logFile = fileExists("logs/logs.log") and fileOpen("logs/logs.log") or fileCreate("logs/logs.log") if (logFile) then local size = fileGetSize(logFile) fileSetPos(logFile, size) fileWrite(logFile, ""..oldNick.." --> "..newNick.."") fileClose(logFile) end end end) Link to comment
1LoL1 Posted January 26, 2016 Author Share Posted January 26, 2016 addEventHandler("onPlayerChangeNick", getRootElement(), function(oldNick, newNick) if (newNick) then outputChatBox(""..oldNick.." --> "..newNick.."",getRootElement(), 255, 100, 100, true) local logFile = fileExists("logs/logs.log") and fileOpen("logs/logs.log") or fileCreate("logs/logs.log") if (logFile) then local size = fileGetSize(logFile) fileSetPos(logFile, size) fileWrite(logFile, ""..oldNick.." --> "..newNick.."") fileClose(logFile) end end end) Thanks but not work outputChatBox is but it's not writen Link to comment
1LoL1 Posted January 28, 2016 Author Share Posted January 28, 2016 Please anyone can help me? Link to comment
ALw7sH Posted January 28, 2016 Share Posted January 28, 2016 addEventHandler("onClientPlayerChangeNick", getRootElement(), function(oldNick, newNick) outputChatBox(""..oldNick.." --> "..newNick.."", 255, 100, 100, true) local logFile = fileOpen("logs/logs.log") or fileCreate("logs/logs.log") if logFile then local size = fileGetSize(logFile) fileSetPos(logFile, size) fileWrite(logFile, ""..oldNick.." --> "..newNick.."") fileClose(logFile) end end) This is your code plus "or fileCreate" and it's working perfectly but maybe you're checking the resource file you'll find the file in "C:\Program Files (x86)\MTA San Andreas 1.5\mods\deathmatch\resources\RESOURCENAME\logs" Link to comment
1LoL1 Posted January 28, 2016 Author Share Posted January 28, 2016 addEventHandler("onClientPlayerChangeNick", getRootElement(), function(oldNick, newNick) outputChatBox(""..oldNick.." --> "..newNick.."", 255, 100, 100, true) local logFile = fileOpen("logs/logs.log") or fileCreate("logs/logs.log") if logFile then local size = fileGetSize(logFile) fileSetPos(logFile, size) fileWrite(logFile, ""..oldNick.." --> "..newNick.."") fileClose(logFile) end end) This is your code plus "or fileCreate" and it's working perfectly but maybe you're checking the resource file you'll find the file in "C:\Program Files (x86)\MTA San Andreas 1.5\mods\deathmatch\resources\RESOURCENAME\logs" I have resource "NAME" and in this i have folder "logs" so "logs/logs.log". But when i have logs.log only in "NAME" and used "logs.log" again not work Link to comment
1LoL1 Posted February 2, 2016 Author Share Posted February 2, 2016 Please anyone help? Link to comment
Bonus Posted February 2, 2016 Share Posted February 2, 2016 You didnt add the log file in the meta right? If you did it, remove it. Link to comment
1LoL1 Posted February 2, 2016 Author Share Posted February 2, 2016 You didnt add the log file in the meta right?If you did it, remove it. Not it's not added. Link to comment
Bonus Posted February 2, 2016 Share Posted February 2, 2016 You changed your nick and looked into MTA -> mods -> deathmatch -> resources -> [TheResourceName] -> logs -> logs.log But there is no file? Or is the file empty? Link to comment
1LoL1 Posted February 2, 2016 Author Share Posted February 2, 2016 You changed your nick and looked into MTA -> mods -> deathmatch -> resources -> [TheResourceName] -> logs -> logs.logBut there is no file? Or is the file empty? Yes MTA -> mods -> deathmatch -> resources -> [gamemodes] -> TEST -> logs -> logs.log And yes it's empty. Link to comment
Bonus Posted February 2, 2016 Share Posted February 2, 2016 No, not [gamemodes] Your local mta folder, not server folder. Mine would be: C:\Program Files (x86)\MTA San Andreas 1.4\mods\deathmatch\resources\TDS\logs\logs.log Its clientsided, thats why you get the file in your local resources folder, not where your serverfiles are. Link to comment
1LoL1 Posted February 2, 2016 Author Share Posted February 2, 2016 No, not [gamemodes]Your local mta folder, not server folder. Mine would be: C:\Program Files (x86)\MTA San Andreas 1.4\mods\deathmatch\resources\TDS\logs\logs.log Its clientsided, thats why you get the file in your local resources folder, not where your serverfiles are. No must be [TDS] Because i have there others files. WARNING: Bad usage @ 'fileOpen' [unable to load file 'logs.log'] It's MTA -> server -> deathmath -> resources -> [TDS] -> SCRIPT -> logs -> logs.log Link to comment
Bonus Posted February 2, 2016 Share Posted February 2, 2016 No, there is no [] You want help? Then do what I tell you. Look in your local resources folder, not where your serversided files are. You have to look there where the clientsided files are getting downloaded. Mine would be: C:\Program Files (x86)\MTA San Andreas 1.4\mods\deathmatch\resources\TDS\logs\logs.log Its NOT server! I never wrote server! TDS is the name of MY resource. Your resource should be something else. Link to comment
1LoL1 Posted February 2, 2016 Author Share Posted February 2, 2016 No, there is no []You want help? Then do what I tell you. Look in your local resources folder, not where your serversided files are. You have to look there where the clientsided files are getting downloaded. Mine would be: C:\Program Files (x86)\MTA San Andreas 1.4\mods\deathmatch\resources\TDS\logs\logs.log Its NOT server! I never wrote server! TDS is the name of MY resource. Your resource should be something else. not server? server is there automatically.. and it's not working i know TDS is only test and i have without [] and not work. Link to comment
Bonus Posted February 2, 2016 Share Posted February 2, 2016 Are you trolling? Dont change your serversided files! Look: If you are a player, who has NO ACCESS TO THE SCRIPT, then you can still get the logs. Cause they are clientsided, not serversided! They are there where your clientsided files are saved. If I join my server then the file is here: C:\Program Files (x86)\MTA San Andreas 1.4\mods\deathmatch\resources\TDS\logs\logs.log Don't change serversided things, its not where your server is! Link to comment
1LoL1 Posted February 2, 2016 Author Share Posted February 2, 2016 Are you trolling?Dont change your serversided files! Look: If you are a player, who has NO ACCESS TO THE SCRIPT, then you can still get the logs. Cause they are clientsided, not serversided! They are there where your clientsided files are saved. If I join my server then the file is here: C:\Program Files (x86)\MTA San Andreas 1.4\mods\deathmatch\resources\TDS\logs\logs.log Don't change serversided things, its not where your server is! So i must this in server-side? Link to comment
Bonus Posted February 2, 2016 Share Posted February 2, 2016 Clientsided: Only the player can see his own nickchanges Serversided: Only the players who can look in the serversided files can see every nickchange Link to comment
1LoL1 Posted February 2, 2016 Author Share Posted February 2, 2016 Clientsided:Only the player can see his own nickchanges Serversided: Only the players who can look in the serversided files can see every nickchange I really don't understand what do you mean Link to comment
KariiiM Posted February 2, 2016 Share Posted February 2, 2016 Clientsided:Only the player can see his own nickchanges Serversided: Only the players who can look in the serversided files can see every nickchange I really don't understand what do you mean He means, in server sided script you can look at all changed nickname In client sided you can see only your own changed nickname not all 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