Server keeps closing - Can't find the path?
#1

'Sup y'all?

First of all, I wanna make something clear: I want, that kicks, bans, etc. will get saved in a logfile, that's why I defined these things:

PHP код:
    #define banPATH             "Logs/BanLog.txt" //directory for bans
    #define kickPATH            "Logs/KickLog.txt" //directory for kicks
    #define reportPATH          "Logs/ReportLog.txt" //directory for reports
    #define rangePATH           "Logs/RangebanLog.txt" //directory for range bans 
Okay, now I've tested these with my Kick-CMD:

PHP код:
    CMD:kick(playeridparams[])
    {
        if(
PlayerInfo[playerid][pAdmin] >= 3) {
            new 
PID;
            new 
reason[64];
            new 
str[128];
            new 
Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
            
GetPlayerName(playeridAdminnamesizeof(Adminname));
               
GetPlayerName(PIDPlayernamesizeof(Playername));
            if(
sscanf(params"us[64]"PID,reason)) return SendClientMessage(playeridCOLOR_GREY"USAGE: /kick [playerid] [reason]");
            if(!
IsPlayerConnected(PID))
                return 
SendClientMessage(playeridCOLOR_GREY"Player is not connected!");
            
format(strsizeof(str), "'%s' has been kicked by administrator '%s'. Reason: %s "PlayernameAdminnamereason);
            
SendClientMessageToAll(COLOR_REDstr);
              new 
File:Log fopen(kickPATHio_append);
            new 
logData[128];
            new 
fTime[6];
            
getdate(fTime[0], fTime[1], fTime[2]);
            
gettime(fTime[3], fTime[4], fTime[5]);
            
format(logDatasizeof logData"[%02d/%02d/%04d || %02d:%02d:%02d]%s kicked %s! (Reason: %s) \r\n"fTime[2], fTime[1], fTime[0], fTime[3], fTime[4], fTime[5], AdminnamePlayernamereason);
            
fwrite(LoglogData);
            
fclose(Log);
            
Kick(PID);
        }
        else
        {
            
SendClientMessage(playeridCOLOR_GREY"You have to be level 3 to use that command!");
        }
        return 
1;
    } 
But whenever I join my server now and I use "/kick ID REASON", suddenly, there's written: "Lost connection bla bla"!

I saw then, that my server closed itself, so I had to turn it on again! Whenever I use /kick now, this happens!
But, when I take the save-log out of my command, then everything works! Anyone knows why it's like this?


My gamemode is in the folder "gamemodes", and I've created a folder "Logs" in the same folder where my gamemode is! :O
Reply
#2

It should be scriptfiles/Logs/

There's where it'll save.

And make sure the log txt files exist (or is being created when it's not there)
Reply
#3

Omg, you're a real pro-scripter! You know everything by heart, eh?

This deserves a rep!
Reply
#4

Even a Newb could figure that out
Reply
#5

^Don't blame me, smartass!

Why didn't you answered earlier then? I've seen you reading that topic once, lol!

But whatever...Let's not start discussin'!
Reply
#6

OK! You PMed me, I suppose this is my Admin FS! So, if you solved it, what was the problem?
Reply
#7

This isn't your's! Your FS just gave me the idea to create such a path, 'cause it's useful!

I PMed you earlier, and it was fixed since 1 day now. lol!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)