[Help] /report - crashes the server
#1

Код:
//----------------------------------------------------------------------------//
dcmd_report(playerid,params[]){
    new tmp[256], Index; tmp = strtok(params,Index);
    if(!strlen(tmp)){
	  if(Lingua[playerid]==1)SendClientMessage(playerid, ROSSO, "UTILIZZA /report [id] [motivo]");else
	  if(Lingua[playerid]==2)SendClientMessage(playerid, ROSSO, "USAGE /report [id] [reason]");
	  return 0;}
    new File:Reported = fopen("Zuc_Logs/Reported.txt",io_append);player = strval(tmp);
    GetPlayerName(playerid, adminname, sizeof(adminname)); GetPlayerName(player, incriminato, sizeof(incriminato));
	format(string, sizeof(string), "|| NEW REPORT ||: '%s' reported %s (id: %i) [reason: %s] \r\n", adminname, incriminato, player, params[2]);
	if(Lingua[playerid]==1)SendClientMessage(playerid,VERDE_CHIARO, "Il tuo REPORT и stato mandato agli admins in linea!");else
	if(Lingua[playerid]==2)SendClientMessage(playerid,VERDE_CHIARO, "Your report has been sent to online admins!");
	fwrite(Reported, string);
	fclose(Reported);
	MessageToAdmins(COLOR_ZADMINBLUE,string);
    printf("|| NEW REPORT ||: '%s' reported %s (id: %d) [reason: %s] \r\n", adminname, incriminato, player, params[2]);
    return 1;}
//----------------------------------------------------------------------------//
dcmd_reports(playerid,params[]){
  #pragma unused params
  if(Account[playerid][pAdminlevel]>=1){
    new File:Reported = fopen("System/Reported.txt",io_read);
    fread(Reported, string);
    if(Lingua[playerid]==1)format(string, sizeof(string), "ULTIMO REPORT: \"%s\"", string),SendClientMessage(playerid,COLOR_ZADMINBLUE,string);else
    if(Lingua[playerid]==2)format(string, sizeof(string), "LAST REPORT: \"%s\"", string),SendClientMessage(playerid,COLOR_ZADMINBLUE,string);
    fclose(Reported);}
  return 1;}
//----------------------------------------------------------------------------//
I don't see why it's crashing the server, I hope someone can help.

It's in Italian and English by the way.
Reply
#2

Also if possible would it be possible if you could add an /accept report which sends a player message saying "Your report has been accepted and is being reviewed"
Reply
#3

Make sure both the folder and file exists that you are writing to. That is the only reason I see for a full server crash.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)