SA-MP Forums Archive
[Help] /report - crashes the server - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] /report - crashes the server (/showthread.php?tid=194313)



[Help] /report - crashes the server - Darklom - 29.11.2010

Код:
//----------------------------------------------------------------------------//
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.


Re: [Help] /report - crashes the server - Darklom - 29.11.2010

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"


Re: [Help] /report - crashes the server - JaTochNietDan - 29.11.2010

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.