Jump to content

Solved


1LoL1

Recommended Posts

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 by Guest
Link to comment

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 by Guest
Link to comment
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
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
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
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
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
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?

Yes MTA -> mods -> deathmatch -> resources -> [gamemodes] -> TEST -> logs -> logs.log

And yes it's empty.

Link to comment

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
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

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
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

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!

851c534194955f72cac871b1fd162f9d.jpg

Link to comment
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!

851c534194955f72cac871b1fd162f9d.jpg

So i must this in server-side?

Link to comment
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...