Saving an report into a .txt file at scriptfiles (+rep) - 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)
+--- Thread: Saving an report into a .txt file at scriptfiles (+rep) (
/showthread.php?tid=514202)
Saving an report into a .txt file at scriptfiles (+rep) -
Trynda - 20.05.2014
Hello there!!!
I just wanted to ask an HELP here, how do i build the /bugreport cmd? When you /bugreport <Description> your description will save on .txt file thanks in advance!
Re: Saving an report into a .txt file at scriptfiles (+rep) -
ATomas - 20.05.2014
pawn Код:
if(strcmp("/BugReport",cmdtext,true,10) == 0)
{
new File:log;
if(fexist("reports.txt")) log = fopen("reports.txt",io_append);
else log = fopen("reports.txt",io_write);
fwrite(log,cmdtext[11]);
fwrite(log,"\r\n");
fclose(log);
return 1;
}
Re: Saving an report into a .txt file at scriptfiles (+rep) -
Spartaaaaa - 20.05.2014
Код:
if(strcmp("/BugReport",cmdtext,true,10) == 0)
{
new File:log;
if(fexist("reports.txt")) log = fopen("reports.txt",io_append);
else log = fopen("reports.txt",io_write);
fwrite(log,cmdtext[11]);
fwrite(log,"\r\n");
fclose(log);
return 1;
}
Yeaa... goto scriptfiles -> create reports.txt
Re: Saving an report into a .txt file at scriptfiles (+rep) -
Konstantinos - 20.05.2014
@Above: Check the file handle otherwise you're going to have problems with server crashes and it's recommended NOT to use strcmp..
pawn Код:
CMD:bugreport(playerid, params[])
{
if (isnull(params)) return SendClientMessage(playerid, -1, "Usage: /bugreport <Description>");
new
File: log = fopen("reports.txt", io_append);
if (!log) return SendClientMessage(playerid, -1, "Something went wrong. Please try reporting it later");
fwrite(log, params);
fwrite(log, "\r\n");
fclose(log);
return 1;
}
Re: Saving an report into a .txt file at scriptfiles (+rep) -
Threshold - 20.05.2014
EDIT: I give up...
Re: Saving an report into a .txt file at scriptfiles (+rep) -
Trynda - 20.05.2014
Quote:
Originally Posted by Konstantinos
@Above: Check the file handle otherwise you're going to have problems with server crashes and it's recommended NOT to use strcmp..
pawn Код:
CMD:bugreport(playerid, params[]) { if (isnull(params)) return SendClientMessage(playerid, -1, "Usage: /bugreport <Description>"); new File: log = fopen("reports.txt", io_append); if (!log) return SendClientMessage(playerid, -1, "Something went wrong. Please try reporting it later"); fwrite(log, params); fwrite(log, "\r\n"); fclose(log); return 1; }
|
thanks bro +Rep to all