Server keeps closing - Can't find the path? -
Twisted_Insane - 15.02.2012
'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(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 3) {
new PID;
new reason[64];
new str[128];
new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
GetPlayerName(playerid, Adminname, sizeof(Adminname));
GetPlayerName(PID, Playername, sizeof(Playername));
if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid] [reason]");
if(!IsPlayerConnected(PID))
return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
format(str, sizeof(str), "'%s' has been kicked by administrator '%s'. Reason: %s ", Playername, Adminname, reason);
SendClientMessageToAll(COLOR_RED, str);
new File:Log = fopen(kickPATH, io_append);
new logData[128];
new fTime[6];
getdate(fTime[0], fTime[1], fTime[2]);
gettime(fTime[3], fTime[4], fTime[5]);
format(logData, sizeof 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], Adminname, Playername, reason);
fwrite(Log, logData);
fclose(Log);
Kick(PID);
}
else
{
SendClientMessage(playerid, COLOR_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
Re: Server keeps closing - Can't find the path? -
iPLEOMAX - 15.02.2012
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)
Re: Server keeps closing - Can't find the path? -
Twisted_Insane - 15.02.2012
Omg, you're a real pro-scripter! You know everything by heart, eh?
This
deserves a rep!
Re: Server keeps closing - Can't find the path? -
BleverCastard - 15.02.2012
Even a Newb could figure that out
Re: Server keeps closing - Can't find the path? -
Twisted_Insane - 15.02.2012
^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'!
Re: Server keeps closing - Can't find the path? -
fiki574 - 16.02.2012
OK! You PMed me, I suppose this is my Admin FS! So, if you solved it, what was the problem?
Re: Server keeps closing - Can't find the path? -
Twisted_Insane - 16.02.2012
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!