Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Advance Report System
- // Stark.7
- #include <a_samp>
- #include <a_mysql>
- #include <sscanf2>
- #include <zcmd>
- #include <colors>
- #define MAX_REPORTS 10
- #define D_REPORT_MANAGER1 999
- #define D_REPORT_MANAGER2 888
- #define D_REPORT_READ1 1
- #define D_REPORT_DELETE1 2
- #define D_REPORT_READ2 3
- #define D_REPORT_DELETE2 4
- #define D_REPORT_READ3 5
- #define D_REPORT_DELETE3 6
- #define D_REPORT_READ4 7
- #define D_REPORT_DELETE4 8
- #define D_REPORT_READ5 9
- #define D_REPORT_DELETE5 10
- #define D_REPORT_READ6 11
- #define D_REPORT_DELETE6 12
- #define D_REPORT_READ7 13
- #define D_REPORT_DELETE7 14
- #define D_REPORT_READ8 15
- #define D_REPORT_DELETE8 16
- #define D_REPORT_READ9 17
- #define D_REPORT_DELETE9 18
- #define D_REPORT_READ10 19
- #define D_REPORT_DELETE10 20
- #define REP_VERSION "v0.1.1"
- enum rData
- {
- rID,
- rPlayer[32],
- rReport[1024],
- rStatus
- }
- // new RData[MAX_REPORTS][rData];
- /*new totalReports,;*/ new totalReports2, reportIDx, reportPlayerx[32+2], reportMessagex[1024+2], reportStatusx, cacheID;
- new iReportTick[MAX_PLAYERS], SQL = -1, query[1024], result[1030];
- #define defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n*******************************");
- print(" Advance Report system samp ! ");
- printf(" Advance Report system %s ! ", REP_VERSION);
- print("*******************************\n");
- SQL = mysql_connect("localhost", "root", "bazadedate", "", 3306);
- if(mysql_errno() != 0) printf("Error conecting to database !");
- mysql_log(LOG_DEBUG | LOG_WARNING, LOG_TYPE_HTML);
- return 1;
- }
- public OnFilterScriptExit()
- {
- mysql_close(SQL);
- return 1;
- }
- main()
- {
- print("\n--------------------------------------");
- print(" Advance Report system samp ! ");
- print("--------------------------------------\n");
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch(dialogid)
- {
- case D_REPORT_MANAGER1:
- {
- if(response)
- {
- new Name[32], str[1024];
- GetPlayerName(playerid, Name, sizeof(Name));
- mysql_format(SQL, query, sizeof(query), "INSERT INTO `reports`(`Player`, `Problem`) VALUES ('%s','%s')", Name, inputtext);
- mysql_query(SQL, query, true);
- cacheID = cache_insert_id();
- format(str, sizeof(str), "[DEBUG] New report: Player: %s | Problem: %s | ID: %d", Name, inputtext, cacheID);
- printf(str);
- SendClientMessage(playerid, COLOR_CONTROL, "Reportul dvs. a fost trimis echipei de admini !");
- return 1;
- }
- }
- case D_REPORT_MANAGER2:
- {
- if(listitem == 0)
- {
- ShowPlayerDialog(playerid, 50, DIALOG_STYLE_LIST, "Report Options", "Read\nDelete", "Select", "");
- /*
- new str[1222];
- format(str, sizeof(str), "ID: %d | Report: %s | Player: %s | Status: %d", reportIDx, reportMessagex, reportPlayerx, reportStatusx);
- SendClientMessage(playerid, COLOR_INFO, str);
- */
- }
- if(listitem == 1)
- {
- ShowPlayerDialog(playerid, 51, DIALOG_STYLE_LIST, "Report Options", "Read\nDelete", "Select", "");
- /*
- new str[1222];
- format(str, sizeof(str), "ID: %d | Report: %s | Player: %s | Status: %d", reportIDx, reportMessagex, reportPlayerx, reportStatusx);
- SendClientMessage(playerid, COLOR_INFO, str);
- */
- }
- if(listitem == 2)
- {
- ShowPlayerDialog(playerid, 52, DIALOG_STYLE_LIST, "Report Options", "Read\nDelete", "Select", "");
- /*
- new str[1222];
- format(str, sizeof(str), "ID: %d | Report: %s | Player: %s | Status: %d", reportIDx, reportMessagex, reportPlayerx, reportStatusx);
- SendClientMessage(playerid, COLOR_INFO, str);
- */
- }
- if(listitem == 3)
- {
- ShowPlayerDialog(playerid, 53, DIALOG_STYLE_LIST, "Report Options", "Read\nDelete", "Select", "");
- /*
- new str[1222];
- format(str, sizeof(str), "ID: %d | Report: %s | Player: %s | Status: %d", reportIDx, reportMessagex, reportPlayerx, reportStatusx);
- SendClientMessage(playerid, COLOR_INFO, str);
- */
- }
- if(listitem == 4)
- {
- ShowPlayerDialog(playerid, 54, DIALOG_STYLE_LIST, "Report Options", "Read\nDelete", "Select", "");
- /*
- new str[1222];
- format(str, sizeof(str), "ID: %d | Report: %s | Player: %s | Status: %d", reportIDx, reportMessagex, reportPlayerx, reportStatusx);
- SendClientMessage(playerid, COLOR_INFO, str);
- */
- }
- if(listitem == 5)
- {
- ShowPlayerDialog(playerid, 55, DIALOG_STYLE_LIST, "Report Options", "Read\nDelete", "Select", "");
- /*
- new str[1222];
- format(str, sizeof(str), "ID: %d | Report: %s | Player: %s | Status: %d", reportIDx, reportMessagex, reportPlayerx, reportStatusx);
- SendClientMessage(playerid, COLOR_INFO, str);
- */
- }
- if(listitem == 6)
- {
- ShowPlayerDialog(playerid, 56, DIALOG_STYLE_LIST, "Report Options", "Read\nDelete", "Select", "");
- /*
- new str[1222];
- format(str, sizeof(str), "ID: %d | Report: %s | Player: %s | Status: %d", reportIDx, reportMessagex, reportPlayerx, reportStatusx);
- SendClientMessage(playerid, COLOR_INFO, str);
- */
- }
- if(listitem == 7)
- {
- ShowPlayerDialog(playerid, 57, DIALOG_STYLE_LIST, "Report Options", "Read\nDelete", "Select", "");
- /*
- new str[1222];
- format(str, sizeof(str), "ID: %d | Report: %s | Player: %s | Status: %d", reportIDx, reportMessagex, reportPlayerx, reportStatusx);
- SendClientMessage(playerid, COLOR_INFO, str);
- */
- }
- if(listitem == 8)
- {
- ShowPlayerDialog(playerid, 58, DIALOG_STYLE_LIST, "Report Options", "Read\nDelete", "Select", "");
- /*
- new str[1222];
- format(str, sizeof(str), "ID: %d | Report: %s | Player: %s | Status: %d", reportIDx, reportMessagex, reportPlayerx, reportStatusx);
- SendClientMessage(playerid, COLOR_INFO, str);
- */
- }
- if(listitem == 9)
- {
- ShowPlayerDialog(playerid, 59, DIALOG_STYLE_LIST, "Report Options", "Read\nDelete", "Select", "");
- /*
- new str[1222];
- format(str, sizeof(str), "ID: %d | Report: %s | Player: %s | Status: %d", reportIDx, reportMessagex, reportPlayerx, reportStatusx);
- SendClientMessage(playerid, COLOR_INFO, str);
- */
- }
- }
- case 50, 51, 52, 53, 54, 55:
- {
- if(listitem == 0) // D_REPORT_READ1
- {
- new str[1222];
- format(str, sizeof(str), "ID: %d | Report: %s | Player: %s | Status: %d", reportIDx, reportMessagex, reportPlayerx, reportStatusx);
- ShowPlayerDialog(playerid, D_REPORT_READ1, DIALOG_STYLE_MSGBOX, "Read Report", str, "Back", "");
- }
- if(listitem == 1) // D_REPORT_DELETE1
- {
- ShowPlayerDialog(playerid, D_REPORT_DELETE1, DIALOG_STYLE_MSGBOX, "Delete Report", "Esti sigur ca vrei stergi acest report?", "Delete", "Close");
- }
- }
- case 56, 57, 58, 59:
- {
- if(listitem == 0) // D_REPORT_READ1
- {
- new str[1222];
- format(str, sizeof(str), "ID: %d | Report: %s | Player: %s | Status: %d", reportIDx, reportMessagex, reportPlayerx, reportStatusx);
- ShowPlayerDialog(playerid, D_REPORT_READ1, DIALOG_STYLE_MSGBOX, "Read Report", str, "Back", "");
- }
- if(listitem == 1) // D_REPORT_DELETE1
- {
- ShowPlayerDialog(playerid, D_REPORT_DELETE1, DIALOG_STYLE_MSGBOX, "Delete Report", "Esti sigur ca vrei stergi acest report?", "Delete", "Close");
- }
- }
- case D_REPORT_DELETE1:
- {
- mysql_format(SQL, query, sizeof(query), "DELETE FROM `reports` WHERE `ID`='%d'", reportIDx);
- mysql_query(SQL, query, true);
- }
- case D_REPORT_DELETE2:
- {
- mysql_format(SQL, query, sizeof(query), "DELETE FROM `reports` WHERE `ID`='%d'", reportIDx);
- mysql_query(SQL, query, true);
- }
- case D_REPORT_DELETE3:
- {
- mysql_format(SQL, query, sizeof(query), "DELETE FROM `reports` WHERE `ID`='%d'", reportIDx);
- mysql_query(SQL, query, true);
- }
- case D_REPORT_DELETE4:
- {
- mysql_format(SQL, query, sizeof(query), "DELETE FROM `reports` WHERE `ID`='%d'", reportIDx);
- mysql_query(SQL, query, true);
- }
- case D_REPORT_DELETE5:
- {
- mysql_format(SQL, query, sizeof(query), "DELETE FROM `reports` WHERE `ID`='%d'", reportIDx);
- mysql_query(SQL, query, true);
- }
- case D_REPORT_DELETE6, D_REPORT_DELETE7, D_REPORT_DELETE8, D_REPORT_DELETE9:
- {
- mysql_format(SQL, query, sizeof(query), "DELETE FROM `reports` WHERE `ID`='%d'", reportIDx);
- mysql_query(SQL, query, true);
- }
- }
- return 1;
- }
- CMD:report(playerid, params[])
- {
- if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_BLUE, "[SERVER ERROR]: Nu esti conectat !");
- if(IsPlayerConnected(playerid))
- {
- if((GetTickCount() - iReportTick[playerid]) < 60000) return SendClientMessage(playerid, COLOR_BLUE, "[SERVER ERROR]: Trebui sa astepti 60 secunde inainte de a folosi iar comanda.");
- ShowPlayerDialog(playerid, D_REPORT_MANAGER1, DIALOG_STYLE_INPUT, "Report Manager", "Ce problema aveti?", "Submit", "Cancel");
- iReportTick[playerid] = GetTickCount();
- }
- return 1;
- }
- CMD:reports(playerid, params[])
- {
- if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_BLUE, "[SERVER ERROR]: Nu esti conectat !");
- if(IsPlayerConnected(playerid))
- {
- new head[128], aim[1500];
- new str[48];
- new Cache:result1 = mysql_query(SQL, "SELECT * FROM `reports` ORDER BY `reports`.`ID` ASC");
- for(new i, j = cache_get_row_count(); i != j; ++i)
- {
- cache_get_field_content(i, "ID", result); reportIDx = strval(result);
- cache_get_field_content(i, "Player", result); strmid(reportPlayerx, result, 0, sizeof(result), 32);
- cache_get_field_content(i, "Problem", result); strmid(reportMessagex, result, 0, sizeof(result), 1024);
- cache_get_field_content(i, "Status", result); reportStatusx = strval(result);
- totalReports2 = cache_get_row_count();
- }
- cache_delete(result1);
- for(new xf = 1; xf < 20; xf++)
- {
- if(reportStatusx == 0) strcat(str, "Read");
- if(reportStatusx == 1) strcat(str, "Unread");
- format(aim, sizeof(aim),"[%d] %s [%d]", reportIDx, reportPlayerx, str);
- }
- if(totalReports2 >= 1)
- {
- format(head, sizeof(head), "%d New Reports", totalReports2);
- ShowPlayerDialog(playerid, D_REPORT_MANAGER2, DIALOG_STYLE_LIST, head, aim, "Select", "Close");
- SendClientMessage(playerid, COLOR_HIGHLIGHT, aim);
- } else SendClientMessage(playerid, COLOR_INFO, "Nu sunt report-uri noi !");
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment