exod182

Reportsystem

Jun 1st, 2013
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.81 KB | None | 0 0
  1. ////////////////////////////////////////////////////////////////////////////////
  2. // Ihr dürft mit dem Filterscript alles machen, was ihr //
  3. // wollt, außer, es als euers auszugeben oder //
  4. // zu Releasen //
  5. // Viel Spaß mit dem FS //
  6. // Wünscht euch Exod_Martinez //
  7. ////////////////////////////////////////////////////////////////////////////////
  8. #include <a_samp>
  9. #include <ocmd>
  10.  
  11. new insupport[MAX_PLAYERS] = -1,
  12. supportklient[MAX_PLAYERS] = -1,
  13. supportanfrage[MAX_PLAYERS] = -1;
  14.  
  15. #define DIALOG_SUPPORT 4258
  16. #define DIALOG_SUPPORT_SUP 4259
  17. #define DIALOG_SUPPORT_BUG 4260
  18. #define DIALOG_SUPPORT_CHEATER 4261
  19. #define DIALOG_SUPPORT_CHEATER2 4262
  20.  
  21. public OnFilterScriptInit()
  22. {
  23. print("\n--------------------------------------");
  24. print(" Kleines Supportsystem [by Exod_Martinez]");
  25. print("--------------------------------------\n");
  26. return 1;
  27. }
  28.  
  29. public OnFilterScriptExit()
  30. {
  31. return 1;
  32. }
  33.  
  34. public OnPlayerRequestClass(playerid, classid)
  35. {
  36. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  37. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  38. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  39. return 1;
  40. }
  41.  
  42. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  43. {
  44. new string[128];
  45. if(dialogid == DIALOG_SUPPORT)
  46. {
  47. if(response)
  48. {
  49. if(listitem == 0)
  50. {
  51. ShowPlayerDialog(playerid,DIALOG_SUPPORT_SUP,DIALOG_STYLE_INPUT,"Support - Seite 2 (Support Anfrage)","Bitte schreibe dein Anliegen in die Box","Ok","Abbrechen");
  52. }
  53. if(listitem == 1)
  54. {
  55. ShowPlayerDialog(playerid,DIALOG_SUPPORT_BUG,DIALOG_STYLE_INPUT,"Support - Seite 2 (Bug)", "Bitte beschreibe den Bug in der Box kurz","Ok","Abbrechen");
  56. }
  57. if(listitem == 2)
  58. {
  59. ShowPlayerDialog(playerid,DIALOG_SUPPORT_CHEATER, DIALOG_STYLE_INPUT,"Support - Seite 2 (Cheater/Hacker)","Bitte schreibe die ID oder den Namen des Cheaters oder Hackers in die Box", "Ok", "Abbrechen");
  60. }
  61. }
  62. }
  63. if(dialogid == DIALOG_SUPPORT_SUP)
  64. {
  65. if(response)
  66. {
  67. SendClientMessage(playerid, -1, "Deine Support Anfrage wurde an alle Admins gesendet");
  68. supportanfrage[playerid] = 1;
  69. for(new i=0;i<MAX_PLAYERS;i++)
  70. {
  71. if(IsPlayerAdmin(i))
  72. {
  73. format(string, sizeof(string),"%s hat folgende Supportanfrage gesendet: %s",spielername(playerid),inputtext);
  74. SendClientMessage(i,-1,string);
  75. SendClientMessage(i, -1, "Benutze '/ar' um den Report anzunehmen");
  76. }
  77. }
  78. }
  79. }
  80. if(dialogid == DIALOG_SUPPORT_BUG)
  81. {
  82. if(response)
  83. {
  84. SendClientMessage(playerid, -1, "Deine Bugreport wurde an alle Admins gesendet");
  85. supportanfrage[playerid] = 1;
  86. for(new i=0;i<MAX_PLAYERS;i++)
  87. {
  88. if(IsPlayerAdmin(i))
  89. {
  90. format(string, sizeof(string),"%s hat folgenden Bugreport gesendet: %s",spielername(playerid),inputtext);
  91. SendClientMessage(i,-1,string);
  92. SendClientMessage(i, -1, "Benutze '/ar' um den Report anzunehmen");
  93. }
  94. }
  95. }
  96. }
  97. if(dialogid == DIALOG_SUPPORT_CHEATER)
  98. {
  99. if(response)
  100. {
  101. SetPVarString(playerid,"Cheaterid",inputtext);
  102. ShowPlayerDialog(playerid,DIALOG_SUPPORT_CHEATER2,DIALOG_STYLE_INPUT,"Support - Seite 3 (Cheater)","Bitte beschreibe nun den Cheat/Hack des Spielers","Ok","Abbrechen");
  103. }
  104. }
  105. if(dialogid == DIALOG_SUPPORT_CHEATER2)
  106. {
  107. new cheater[20];
  108. if(response)
  109. {
  110. SendClientMessage(playerid, -1, "Dein Cheaterreport wurde an alle Admins gesendet");
  111. supportanfrage[playerid] = 1;
  112. for(new i=0;i<MAX_PLAYERS;i++)
  113. {
  114. if(IsPlayerAdmin(i))
  115. {
  116. GetPVarString(playerid, "Cheaterid", cheater, 128);
  117. format(string, sizeof(string),"%s hat folgenden Cheater gemeldet: %s || Hack: %s",spielername(playerid), cheater, inputtext);
  118. SendClientMessage(i,-1,string);
  119. SendClientMessage(i, -1, "Benutze '/ar' um den Report anzunehmen");
  120. }
  121. }
  122. }
  123. }
  124. return 1;
  125. }
  126.  
  127. ocmd:support(playerid, params[])
  128. {
  129. new text[128];
  130. new id = supportklient[playerid];
  131. if(insupport[playerid] != -1)
  132. {
  133. if(sscanf(params,"s",text))return SendClientMessage(playerid, -1, "Du bist in einem Support! ('/sup [text]')");
  134. SendClientMessage(id, -1, text);
  135. }
  136. else ShowPlayerDialog(playerid, DIALOG_SUPPORT,DIALOG_STYLE_LIST,"Support - Seite 1","Support Anfrage\nBugs melden\nCheater/Hacker melden", "Ok","Abbrechen");
  137. return 1;
  138. }
  139.  
  140. ocmd:cr(playerid, params[])
  141. {
  142. new string[128];
  143. new id = supportklient[playerid];
  144.  
  145. format(string, sizeof(string), "%s hat deinen Support geschlossen");
  146. SendClientMessage(id, -1, string);
  147.  
  148. insupport[id] = -1;
  149. insupport[playerid] = -1;
  150.  
  151. supportklient[id] = -1;
  152. supportklient[playerid] = -1;
  153. }
  154.  
  155. ocmd:sup(playerid, params[])
  156. {
  157. return ocmd_sup(playerid, params);
  158. }
  159.  
  160. ocmd:ar(playerid, params[])
  161. {
  162. new id, string[128];
  163. if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, -1, "Du bist kein Admin");
  164. if(sscanf(params,"u",id))return SendClientMessage(playerid, -1, "Benutzung: '/ar [Name/ID]");
  165. if(supportanfrage[id] == -1)return SendClientMessage(playerid, -1, "Der User hat keine Reportanfrage gestellt");
  166. format(string, sizeof(string),"%s hat deinen Report angenommen, du kannst jetzt mit '/sup' direkt mit ihm schreiben");
  167. SendClientMessage(id, -1, string);
  168. format(string, sizeof(string),"Du hast den Report von %s angenommen, schreibe nun mit '/sup' mit ihm");
  169. SendClientMessage(playerid, -1 ,string);
  170. supportanfrage[id] = -1;
  171. insupport[playerid] = 1;
  172. insupport[id] = 1;
  173. supportklient[playerid] = id;
  174. supportklient[id] = playerid;
  175. return 1;
  176. }
  177.  
  178. stock spielername(playerid)
  179. {
  180. new fname[MAX_PLAYER_NAME];
  181. GetPlayerName(playerid,fname,sizeof fname);
  182. return fname;
  183. }
  184.  
  185. stock sscanf(string[], format[], {Float,_}:...)
  186. {
  187. #if defined isnull
  188. if (isnull(string))
  189. #else
  190. if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
  191. #endif
  192. {
  193. return format[0];
  194. }
  195. #pragma tabsize 4
  196. new
  197. formatPos = 0,
  198. stringPos = 0,
  199. paramPos = 2,
  200. paramCount = numargs(),
  201. delim = ' ';
  202. while (string[stringPos] && string[stringPos] <= ' ')
  203. {
  204. stringPos++;
  205. }
  206. while (paramPos < paramCount && string[stringPos])
  207. {
  208. switch (format[formatPos++])
  209. {
  210. case '\0':
  211. {
  212. return 0;
  213. }
  214. case 'i', 'd':
  215. {
  216. new
  217. neg = 1,
  218. num = 0,
  219. ch = string[stringPos];
  220. if (ch == '-')
  221. {
  222. neg = -1;
  223. ch = string[++stringPos];
  224. }
  225. do
  226. {
  227. stringPos++;
  228. if ('0' <= ch <= '9')
  229. {
  230. num = (num * 10) + (ch - '0');
  231. }
  232. else
  233. {
  234. return -1;
  235. }
  236. }
  237. while ((ch = string[stringPos]) > ' ' && ch != delim);
  238. setarg(paramPos, 0, num * neg);
  239. }
  240. case 'h', 'x':
  241. {
  242. new
  243. num = 0,
  244. ch = string[stringPos];
  245. do
  246. {
  247. stringPos++;
  248. switch (ch)
  249. {
  250. case 'x', 'X':
  251. {
  252. num = 0;
  253. continue;
  254. }
  255. case '0' .. '9':
  256. {
  257. num = (num << 4) | (ch - '0');
  258. }
  259. case 'a' .. 'f':
  260. {
  261. num = (num << 4) | (ch - ('a' - 10));
  262. }
  263. case 'A' .. 'F':
  264. {
  265. num = (num << 4) | (ch - ('A' - 10));
  266. }
  267. default:
  268. {
  269. return -1;
  270. }
  271. }
  272. }
  273. while ((ch = string[stringPos]) > ' ' && ch != delim);
  274. setarg(paramPos, 0, num);
  275. }
  276. case 'c':
  277. {
  278. setarg(paramPos, 0, string[stringPos++]);
  279. }
  280. case 'f':
  281. {
  282.  
  283. new changestr[16], changepos = 0, strpos = stringPos;
  284. while(changepos < 16 && string[strpos] && string[strpos] != delim)
  285. {
  286. changestr[changepos++] = string[strpos++];
  287. }
  288. changestr[changepos] = '\0';
  289. setarg(paramPos,0,_:floatstr(changestr));
  290. }
  291. case 'p':
  292. {
  293. delim = format[formatPos++];
  294. continue;
  295. }
  296. case '\'':
  297. {
  298. new
  299. end = formatPos - 1,
  300. ch;
  301. while ((ch = format[++end]) && ch != '\'') {}
  302. if (!ch)
  303. {
  304. return -1;
  305. }
  306. format[end] = '\0';
  307. if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
  308. {
  309. if (format[end + 1])
  310. {
  311. return -1;
  312. }
  313. return 0;
  314. }
  315. format[end] = '\'';
  316. stringPos = ch + (end - formatPos);
  317. formatPos = end + 1;
  318. }
  319. case 'u':
  320. {
  321. new
  322. end = stringPos - 1,
  323. id = 0,
  324. bool:num = true,
  325. ch;
  326. while ((ch = string[++end]) && ch != delim)
  327. {
  328. if (num)
  329. {
  330. if ('0' <= ch <= '9')
  331. {
  332. id = (id * 10) + (ch - '0');
  333. }
  334. else
  335. {
  336. num = false;
  337. }
  338. }
  339. }
  340. if (num && IsPlayerConnected(id))
  341. {
  342. setarg(paramPos, 0, id);
  343. }
  344. else
  345. {
  346. #if !defined foreach
  347. #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
  348. #define __SSCANF_FOREACH__
  349. #endif
  350. string[end] = '\0';
  351. num = false;
  352. new
  353. name[MAX_PLAYER_NAME];
  354. id = end - stringPos;
  355. for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
  356. {
  357. GetPlayerName(playerid, name, sizeof (name));
  358. if (!strcmp(name, string[stringPos], true, id))
  359. {
  360. setarg(paramPos, 0, playerid);
  361. num = true;
  362. break;
  363. }
  364. }
  365. if (!num)
  366. {
  367. setarg(paramPos, 0, INVALID_PLAYER_ID);
  368. }
  369. string[end] = ch;
  370. #if defined __SSCANF_FOREACH__
  371. #undef foreach
  372. #undef __SSCANF_FOREACH__
  373. #endif
  374. }
  375. stringPos = end;
  376. }
  377. case 's', 'z':
  378. {
  379. new
  380. i = 0,
  381. ch;
  382. if (format[formatPos])
  383. {
  384. while ((ch = string[stringPos++]) && ch != delim)
  385. {
  386. setarg(paramPos, i++, ch);
  387. }
  388. if (!i)
  389. {
  390. return -1;
  391. }
  392. }
  393. else
  394. {
  395. while ((ch = string[stringPos++]))
  396. {
  397. setarg(paramPos, i++, ch);
  398. }
  399. }
  400. stringPos--;
  401. setarg(paramPos, i, '\0');
  402. }
  403. default:
  404. {
  405. continue;
  406. }
  407. }
  408. while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
  409. {
  410. stringPos++;
  411. }
  412. while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
  413. {
  414. stringPos++;
  415. }
  416. paramPos++;
  417. }
  418. do
  419. {
  420. if ((delim = format[formatPos++]) > ' ')
  421. {
  422. if (delim == '\'')
  423. {
  424. while ((delim = format[formatPos++]) && delim != '\'') {}
  425. }
  426. else if (delim != 'z')
  427. {
  428. return delim;
  429. }
  430. }
  431. }
  432. while (delim > ' ');
  433. return 0;
  434. }
Advertisement
Add Comment
Please, Sign In to add comment