BulletRja

Updated BR Bug Report System

Dec 27th, 2017
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.65 KB | None | 0 0
  1. /*
  2. ////////////////////// ///////////////////
  3. // // // //
  4. // // // //
  5. // // // //
  6. // // // //
  7. // // // //////
  8. ///////////////////// ////////////
  9. // // // //
  10. // // // //
  11. // // // //
  12. // // // //
  13. // // // //
  14. ///////////////////// // //
  15. BULLET RAJA PRESENTS BUG REPORT SYSTEM
  16. */
  17. #define FILTERSCRIPT
  18.  
  19. /****** INCLUDES *****/
  20. #include <a_samp>
  21. #include <sscanf2>
  22. #include <zcmd>
  23. #include <dini>
  24.  
  25. #define COLOR_YELLOW 0xFFFF00FF
  26.  
  27. new BRREPORT[MAX_PLAYERS][MAX_PLAYERS];
  28.  
  29. public OnFilterScriptInit()
  30. {
  31. print("\n--------------------------------------");
  32. print(" Bug Report System By BulletRaja");
  33. print("--------------------------------------\n");
  34. return 1;
  35. }
  36.  
  37. public OnFilterScriptExit()
  38. {
  39. return 1;
  40. }
  41.  
  42. CMD:acceptreport(playerid, params[])
  43. {
  44. new tmp[256], id, name[MAX_PLAYER_NAME];
  45. if(IsPlayerAdmin(playerid)) return 0;
  46. if(sscanf(params, "d", id)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /acceptreport [playerid]");
  47. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_YELLOW, "Error: Invalid player id.");
  48. GetPlayerName(playerid, name, sizeof(name));
  49. if(BRREPORT[id][playerid]==0) return SendClientMessage(playerid, COLOR_YELLOW, "Error: That player didnt created bug report.");
  50. BRREPORT[id][playerid]=0;
  51. format(tmp, sizeof(tmp), "*%s has accepted your bug report", name);
  52. SendClientMessage(id, COLOR_YELLOW, tmp);
  53. GetPlayerName(id, name, sizeof(name));
  54. format(tmp, sizeof(tmp), "*You have accepted %s's bug report", name);
  55. SendClientMessage(playerid, COLOR_YELLOW, tmp);
  56. return 1;
  57. }
  58.  
  59. CMD:closereport(playerid, params[])
  60. {
  61. new tmp[256], id, Float:x, Float:y, Float:z, name[MAX_PLAYER_NAME];
  62. if(IsPlayerAdmin(playerid)) return 0;
  63. if(sscanf(params, "d", id)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /closereport [playerid]");
  64. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_YELLOW, "Error: Invalid player id.");
  65. GetPlayerPos(id, x, y, z);
  66. GetPlayerName(playerid, name, sizeof(name));
  67. if(!IsPlayerInRangeOfPoint(playerid, 2.0, x, y, z)) return SendClientMessage(playerid, COLOR_YELLOW, "Error: You must be at that player to close bug report.");
  68. if(BRREPORT[id][playerid]==0) return SendClientMessage(playerid, COLOR_YELLOW, "Error: That player didnt created bug report.");
  69. BRREPORT[id][playerid]=0;
  70. format(tmp, sizeof(tmp), "*%s has closed your bug report", name);
  71. SendClientMessage(id, COLOR_YELLOW, tmp);
  72. GetPlayerName(id, name, sizeof(name));
  73. format(tmp, sizeof(tmp), "*You have closed %s's bug report", name);
  74. SendClientMessage(playerid, COLOR_YELLOW, tmp);
  75. return 1;
  76. }
  77.  
  78. CMD:reportbug2(playerid, params[])
  79. {
  80. new tmp[256], id, name[MAX_PLAYER_NAME], reason[128], sstring[256], playername[25], str[256];
  81. if(sscanf(params, "ds[128]", id, reason)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /reportbug2 [playerid] [reason]");
  82. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_YELLOW, "Error: Invalid player id.");
  83. GetPlayerName(playerid, name, sizeof(name));
  84. BRREPORT[playerid][id]=1;
  85. format(tmp, sizeof(tmp), "* %s has reported an bug.(/acceptreport or /closereport)", name);
  86. SendClientMessage(id, COLOR_YELLOW, tmp);
  87. GetPlayerName(id, name, sizeof(name));
  88. format(tmp, sizeof(tmp), "* You have reported to %s ", name);
  89. SendClientMessage(playerid, COLOR_YELLOW, tmp);
  90.  
  91. GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
  92. format(str, sizeof(str), "You Have Reported: %s", reason);
  93. SendClientMessage(playerid, COLOR_YELLOW, str);
  94. format(sstring, sizeof(sstring), "%s has reported bug - %s.\r\n", playername, reason);
  95. format(str, sizeof(str), "Bug Log: %s has reported bug - %s.", playername, reason);
  96. SendClientMessageToAll(COLOR_YELLOW, str);
  97. printf("[ReportBug] %s has reported bug - %s.", playername, reason);
  98. new File: file = fopen("bugreport.cfg", io_append);
  99. fwrite(file, sstring);
  100. fclose(file);
  101. return 1;
  102. }
  103.  
  104. CMD:checkbugs(playerid, params[])
  105. {
  106. if(IsPlayerAdmin(playerid)) return 0;
  107. new strings[128], File: file = fopen("bugreport.cfg", io_read), idxx=1;
  108. SendClientMessage(playerid, COLOR_YELLOW, "[BugReports]:");
  109. while(fread(file, strings))
  110. {
  111. format(strings, sizeof(strings), "%d) %s", idxx, strings);
  112. SendClientMessage(playerid, COLOR_YELLOW, strings);
  113. idxx ++;
  114. }
  115. fclose(file);
  116. return 1;
  117. }
Add Comment
Please, Sign In to add comment