Ich habe probleme in mein selfmade mit log dateien.
Es stimmt irgendwas mit savetofile nicht.Das sind alles in mein script wo savetofile definiert ist:
//------------------------------------------------------------------------------
if(strcmp(cmd, "/kick", true) == 0) {
if(PlayerInfo[playerid][ALevel] >= 3) {
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, red, "=> Benutze: /kick [playerid] [Grund]");
return 1; }
new player1;
player1 = strval(tmp);
tmp = strtok(cmdtext, idx);
GetPlayerName(player1, playername12, sizeof(playername12)); GetPlayerName(playerid, adminname, sizeof(adminname));
format(string,256,"=> %s wurde von Admin ( %s ) gekickt! [Grund: %s] ",playername12,adminname,cmdtext[7]); SendClientMessageToAll(grey,string);
SaveToFile("KickLog",string); Kick(player1);
} else {
SendClientMessage(playerid,red,"=> Fehler: Dein Admin Level ist zu niedrig!"); }
return 1; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
if(strcmp(cmd, "/ban", true) == 0) {
if(PlayerInfo[playerid][ALevel] >= 4) {
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, red, "=> Benutze: /ban [playerid] [Grund]");
return 1; }
new player1;
player1 = strval(tmp);
tmp = strtok(cmdtext, idx);
GetPlayerName(player1, playername12, sizeof(playername12)); GetPlayerName(playerid, adminname, sizeof(adminname));
new year,month,day; getdate(year, month, day); new strdate[20]; format(strdate, sizeof(strdate), "%d/%d/%d",day,month,year);
format(string,256,"=> %s wurde von Admin ( %s ) gebannt! [Grund: %s] [Am: %s] ",playername12,adminname,cmdtext[6],strdate); SendClientMessageToAll(grey,string);
SaveToFile("BanLog",string); Ban(player1);
} else {
SendClientMessage(playerid,red,"=> Fehler: Dein Admin Level ist zu niedrig!"); }
return 1; }
if (strcmp(cmdtext, "/zu", true) == 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid)==PLAYER_STATE_DRIVER)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(i!=playerid)
{
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 1);
}
}
SendClientMessage(playerid, COLOR_GREY, "=> Fahrzeug abgeschlossen");
}
else
{
SendClientMessage(playerid, COLOR_GREY, "=> Du kannst nicht zu diesem Fahrzeug");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "=> Du bist in keinem Fahrzeug!");
}
return 1;
}
GetPlayerName(player1, playername12, sizeof(playername12)); GetPlayerName(playerid, adminname, sizeof(adminname));
new year,month,day; getdate(year, month, day);
if(level==1) { format(string,256,"Admin %s hat dir Moderator Rechte gegeben! [ Level %d ]",adminname,level); SendClientMessage(player1,blue,string);
} else { format(string,256,"Admin %s hat dir Admin Rechte gegeben! [ level %d ]",adminname,level); SendClientMessage(player1,blue,string); }
format(string,256,"=> %s gab %s A Rechte [Level %d] [Datum: %d/%d/%d]",adminname, playername12, level, day, month, year); SaveToFile("AdminLog",string);
if(strcmp(cmd, "/report", true) == 0) {
new reported;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return
SendClientMessage(playerid, red, "=> Benutze: /report [playerid] [Grund]");
reported = strval(tmp);
if(!IsPlayerConnected(reported) || reported == INVALID_PLAYER_ID)
return SendClientMessage(playerid,red,"=> Fehler: Spieler nicht Online!");
if(playerid == reported) return SendClientMessage(playerid,red,"=> Du kannst dich nicht selber reporten!");
tmp = strtok(cmdtext, idx);
new length = strlen(cmdtext);
if(length < 14) return SendClientMessage(playerid,red,"=> Was ist der Grund des Reportes ?");
new reportedname[MAX_PLAYER_NAME], reporter[MAX_PLAYER_NAME], str[100];
GetPlayerName(reported, reportedname, sizeof(reportedname)); GetPlayerName(playerid, reporter, sizeof(reporter));
format(str, sizeof(str), "Report: %s reportet ueber: %s Grund: %s", reporter,reportedname, cmdtext[9]);
MessageToAdmins(COLOR_WHITE,str); SaveToFile("ReportLog",str);
SendClientMessage(playerid,green, "=> Report gesendet! ");
return 1;
}
forward SaveToFile(filename[],text[]);
public SaveToFile(filename[],text[])
{
new File:LAdminfile;
new filepath[256], string[256], year,month,day, hour,minute,second;
getdate(year,month,day); gettime(hour,minute,second);
format(filepath,sizeof(filepath),"Logs/%s.txt",filename);
LAdminfile = fopen(filepath,io_append);
format(string,sizeof(string),"[%d.%d.%d %d:%d:%d] %s\r\n",year,month,day,hour,minute,second,text);
fwrite(LAdminfile,string);
fclose(LAdminfile);
return 1;
}
Wenn ich /kick mache oder /ban mache,oder adminbefehle verwende kackt server ab.Wenn ich savetofile von script lösche und /kick mache dann steht da dass ich .... gekickt habe aber der kann noch immer spielen..
Was ist da falsch,kann jemand bitte helfen????