14.08.2014, 21:57
Hello samp'ers,
Today I've tried to add a /reports command that let me read all the reports in the game, without checking actual reports.txt
My problem is that once I enter in-game and use /reports command, it doesn't read reports from file.
/reports command
and /report command that writes reports:
Today I've tried to add a /reports command that let me read all the reports in the game, without checking actual reports.txt
My problem is that once I enter in-game and use /reports command, it doesn't read reports from file.
/reports command
Код:
CMD:reports(playerid, params[]) { new string[1000], string2[1000]; new File: reports = fopen("reports.txt", io_append); fread(reports, string); fclose(reports); format(string2, sizeof(string2), "Reporturi existente: \n %s", string); SendClientMessage(playerid, -1, string2); return 1; }
Код:
CMD:report(playerid, params[]) { new name[MAX_PLAYER_NAME], string[250], adminsreport[250], getdata[100]; if(isnull(params)) return SendClientMessage(playerid, -1, "Syntax: "COL_GREEN"/report <message to be send>"); GetPlayerName(playerid, name, sizeof(name)); strftime("Year: %Y | Month: %B | Day: %d | Weekday: %A", getdata); format(string, sizeof(string), "Report by %s, creat in %s, mesaj: %s \r\n ", name, getdata, params); new File: fileToWrite = fopen("reports.txt", io_append); fwrite(fileToWrite, string); fclose(fileToWrite); format(adminsreport, sizeof(adminsreport), "%s a trimis un nou /report: %s", name, params); SendToAdmins(COLOR_CYAN, adminsreport); SendClientMessage(playerid, -1, "Report trimis cu succes! In cel mai scurt timp un admin te va contacta."); return 1; }