Advertisement
nVidiaX

Compaints Systém 1.0

Jun 17th, 2012
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.43 KB | None | 0 0
  1. ////////////////////////////////////////////////////////////////////////////////
  2. /*
  3.  
  4. Complaint Systém by nVidiaX.
  5. Version: 1.0
  6. Last Update: 17.6.2012 v 18:22
  7.  
  8. */
  9. ////////////////////////////////////////////////////////////////////////////////
  10. #include <a_samp>
  11. ////////////////////////////////////////////////////////////////////////////////
  12. #define COLOR_WHITE "{FFFFFF}"
  13. #define COLOR_RED "{F81414}"
  14. #define COLOR_GREEN "{00FF22}"
  15. ////////////////////////////////////////////////////////////////////////////////
  16. #define DIALOG_COMPLAINTS_INPUT 990
  17. #define DIALOG_COMPLAINTS_ADMIN_MENU 991
  18. #define DIALOG_COMPLAINTS_LIST 992
  19. ////////////////////////////////////////////////////////////////////////////////
  20. public OnPlayerCommandText(playerid,cmdtext[])
  21. {
  22. if(strcmp(cmdtext, "/report", true, 7) == 0)
  23. {
  24. ShowPlayerDialog(playerid, DIALOG_COMPLAINTS_INPUT, DIALOG_STYLE_INPUT, ""COLOR_WHITE"Complaint", ""COLOR_WHITE"Write Your Complaint.", "Send", "Close");
  25. return 1;
  26. }
  27. if(strcmp(cmdtext, "/admin", true, 6) == 0)
  28. {
  29. if(!IsPlayerAdmin(playerid)) return 0;
  30. ShowPlayerDialog(playerid, DIALOG_COMPLAINTS_ADMIN_MENU, DIALOG_STYLE_LIST, ""COLOR_WHITE"Complaint Administration", ""COLOR_WHITE"Complaints List", "Select", "Close");
  31. return 1;
  32. }
  33. if(strcmp(cmdtext, "/about", true, 7) == 0)
  34. {
  35. ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, ""COLOR_WHITE"About Complaints System", ""COLOR_WHITE"Complaints System v1.0 by "COLOR_GREEN"nVidiaX"COLOR_WHITE".\n\nCommand: /report , /admin , /about.\n\nWhat Have This System:\n - Administration\n - Easy Writing Complaint\n\nThank You For Using My System!\n\n"COLOR_GREEN"nVidiaX"COLOR_WHITE".", "Close", "");
  36. return 1;
  37. }
  38. return 0;
  39. }
  40. ////////////////////////////////////////////////////////////////////////////////
  41. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  42. {
  43. //Nahlášení problému.
  44. if(dialogid == DIALOG_COMPLAINTS_INPUT && response)
  45. {
  46. if(strlen(inputtext) < 3) return ShowPlayerDialog(playerid, DIALOG_COMPLAINTS_INPUT, DIALOG_STYLE_INPUT, ""COLOR_WHITE"Complaint", ""COLOR_RED"You Don't Writed Your Complaint.","Send","Close");
  47. new Year, Month, Day, Hour, Minute, Second;
  48. getdate(Year,Month,Day); gettime(Hour,Minute,Second);
  49. new String[128];
  50. format(String,sizeof(String),"[%d/%d/%d v %02d:%02d] %s: %s\r\n",Day,Month,Year,Hour,Minute,Jmeno(playerid),inputtext);
  51. for(new f = 0; f < 20; f++)
  52. {
  53. new Filec[25];
  54. format(Filec, sizeof(Filec), "/Complaints/%d.txt", f);
  55. if(fexist(Filec)) continue;
  56. if(!fexist(Filec))
  57. {
  58. fcreate(Filec);
  59. new File:FileC = fopen(Filec, io_write);
  60. fwrite(FileC, String);
  61. fclose(FileC);
  62. break;
  63. }
  64. }
  65. ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, ""COLOR_WHITE"Complaint", ""COLOR_GREEN"Thank You For Report a Complaint.", "Close", "");
  66. }
  67. //Administrace problémů.
  68. if(dialogid == DIALOG_COMPLAINTS_ADMIN_MENU && response)
  69. {
  70. if(listitem == 0)
  71. {
  72. new String[1200];
  73. new StringF[256];
  74. new Files = 0;
  75. for(new f = 0; f < 20; f++)
  76. {
  77. new Filec[25];
  78. format(Filec, sizeof(Filec), "/Complaints/%d.txt", f);
  79. if(fexist(Filec))
  80. {
  81. Files ++;
  82. new File:ReadF = fopen(Filec, io_read);
  83. fread(ReadF, StringF);
  84. format(String, sizeof(String), "%s\n%s", String, StringF);
  85. fclose(ReadF);
  86. }
  87. }
  88. if(Files > 0)
  89. {
  90. ShowPlayerDialog(playerid, DIALOG_COMPLAINTS_LIST, DIALOG_STYLE_LIST, ""COLOR_WHITE"Complaints Administration", String, "Select", "Close");
  91. }else{
  92. ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, ""COLOR_WHITE"Complaints Administration", "Any Files Not Exist.", "Close", "");
  93. }
  94. }
  95. }
  96. return 1;
  97. }
  98. ////////////////////////////////////////////////////////////////////////////////
  99. stock Jmeno(playerid)
  100. {
  101. new name[MAX_PLAYER_NAME];
  102. GetPlayerName(playerid,name,sizeof(name));
  103. return name;
  104. }
  105. ////////////////////////////////////////////////////////////////////////////////
  106. stock fcreate(file[])
  107. {
  108. if(fexist(file)) return false;
  109. new File:cFile = fopen(file,io_write);
  110. return fclose(cFile);
  111. }
  112. ////////////////////////////////////////////////////////////////////////////////
  113. /*
  114.  
  115. (c)2012 by nVidiaX & Complaint Systém.
  116.  
  117. */
  118. ////////////////////////////////////////////////////////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement