Advertisement
eXsses

yReportFS v0.2.0 BETA by #PWN & Dantesy

Jun 2nd, 2013
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 19.95 KB | None | 0 0
  1. /*
  2. Diese Report-FS wurde von Dantesy & #PWN gescriptet.
  3. Es ist nicht erlaubt diesen Hinweis zu entfernen.
  4.  
  5. Bei Fragen:
  6. Skype: patrick.style45
  7.  
  8. */
  9.  
  10. #define FILTERSCRIPT
  11.  
  12. #define DIALOG_REPORT       1 // Die DialogID auf dein Script anpassen!
  13. #define DIALOG_FRAGE        2 // Die DialogID auf dein Script anpassen!
  14. #define DIALOG_BUG          3 // Die DialogID auf dein Script anpassen!
  15. #define DIALOG_BESCHWERDE   4 // Die DialogID auf dein Script anpassen!
  16. #define DIALOG_CHEATER      5 // Die DialogID auf dein Script anpassen!
  17.  
  18. #define COLOR_WEIß  0xF1F1F1FF
  19. #define COLOR_GRUEN 0x00C885FF
  20. #define COLOR_ROT   0xFF0000FF
  21.  
  22. #include <a_samp>
  23. #include <ocmd>
  24. #include <dini>
  25.  
  26. #if defined FILTERSCRIPT
  27.  
  28. public OnFilterScriptInit()
  29. {
  30.     print("\n--------------------------------------");
  31.     print(" yReportFS v0.2.0 BETA by #PWN & Dantesy");
  32.     print("--------------------------------------\n");
  33.     return 1;
  34. }
  35.  
  36. #endif
  37.  
  38. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  39. {
  40.     if(dialogid == DIALOG_REPORT)
  41.     {
  42.         if(response == 1)
  43.         {
  44.             if(listitem == 0)
  45.             {
  46.                 ShowPlayerDialog(playerid, DIALOG_FRAGE, DIALOG_STYLE_INPUT, "Report - Fragen", "Gebe hier deine Fragen ein\nDiese wird an einen Administrator gesendet", "Absenden", "Abbrechen");
  47.             }
  48.             else if(listitem == 1)
  49.             {
  50.                 ShowPlayerDialog(playerid, DIALOG_BESCHWERDE, DIALOG_STYLE_INPUT, "Report - Fragen", "Gebe hier deine Beschwerde ein\nDiese wird an einen Administrator gesendet", "Absenden", "Abbrechen");
  51.             }
  52.             else if(listitem == 2)
  53.             {
  54.                 ShowPlayerDialog(playerid, DIALOG_BUG, DIALOG_STYLE_INPUT, "Report - Fragen", "Gebe hier den Bug ein den du gefunden hast\nDieser wird an einen Administrator gesendet", "Absenden", "Abbrechen");
  55.             }
  56.             else if(listitem == 3)
  57.             {
  58.                 ShowPlayerDialog(playerid, DIALOG_CHEATER, DIALOG_STYLE_INPUT, "Report - Fragen", "Gebe hier den Spieler ein der angeblich Cheatet\nDieser wird an einen Administrator gesendet", "Absenden", "Abbrechen");
  59.             }
  60.         }
  61.         else
  62.         {
  63.             SendClientMessage(playerid, COLOR_GRUEN, "Du hast das Report-System beendet");
  64.         }
  65.     }
  66.     if(dialogid == DIALOG_FRAGE)
  67.     {
  68.         if(response == 1)
  69.         {
  70.             new string[128];
  71.             SendClientMessage(playerid,COLOR_GRUEN,"Du hast deine Frage an die Admins geschickt. Sie wird so schnell wie möglich bearbeitet.");
  72.             format(string,sizeof(string),"[REPORT-FRAGE]: Der Spieler %s hat eine Frage eingesendet: %s ",PlayerName(playerid),inputtext);
  73.             SendRconAdminMessage(COLOR_ROT,string);
  74.             SetPVarInt(playerid,"Ticket",1);
  75.             format(string,sizeof(string),"[OFFENER-REPORT]: Es liegt ein offenes Ticket von %s vor: %s ",PlayerName(playerid),inputtext);
  76.             SetPVarString(playerid, "TicketText", string);
  77.         }
  78.         else
  79.         {
  80.             SendClientMessage(playerid, COLOR_GRUEN, "Du hast das Report-System beendet");
  81.         }
  82.     }
  83.     if(dialogid == DIALOG_BESCHWERDE)
  84.     {
  85.         if(response == 1)
  86.         {
  87.             new string[128];
  88.             SendClientMessage(playerid,COLOR_GRUEN,"Du hast deine Beschwerde an die Admins geschickt. Sie wird so schnell wie möglich bearbeitet.");
  89.             format(string,sizeof(string),"[REPORT-BESCHWERDe]: Der Spieler %s hat eine Beschwerde eingesendet: %s ",PlayerName(playerid),inputtext);
  90.             SendRconAdminMessage(COLOR_ROT,string);
  91.             SetPVarInt(playerid,"Ticket",1);
  92.             format(string,sizeof(string),"[OFFENER-REPORT]: Es liegt ein offenes Ticket von %s vor: %s ",PlayerName(playerid),inputtext);
  93.             SetPVarString(playerid, "TicketText", string);
  94.         }
  95.         else
  96.         {
  97.             SendClientMessage(playerid, COLOR_GRUEN, "Du hast das Report-System beendet");
  98.         }
  99.     }
  100.     if(dialogid == DIALOG_BUG)
  101.     {
  102.         if(response == 1)
  103.         {
  104.             new string[128];
  105.             SendClientMessage(playerid,COLOR_GRUEN,"Du hast deine Bug-Meldung an die Admins geschickt. Sie wird so schnell wie möglich bearbeitet.");
  106.             format(string,sizeof(string),"[REPORT-BUG]: Der Spieler %s hat eine Bug-Meldung eingesendet: %s ",PlayerName(playerid),inputtext);
  107.             SendRconAdminMessage(COLOR_ROT,string);
  108.             SetPVarInt(playerid,"Ticket",1);
  109.             format(string,sizeof(string),"[OFFENER-REPORT]: Es liegt ein offenes Ticket von %s vor: %s ",PlayerName(playerid),inputtext);
  110.             SetPVarString(playerid, "TicketText", string);
  111.         }
  112.         else
  113.         {
  114.             SendClientMessage(playerid, COLOR_GRUEN, "Du hast das Report-System beendet");
  115.         }
  116.     }
  117.     if(dialogid == DIALOG_CHEATER)
  118.     {
  119.         if(response == 1)
  120.         {
  121.             new string[128];
  122.             SendClientMessage(playerid,COLOR_GRUEN,"Du hast deine Cheater-Meldung an die Admins geschickt. Sie wird so schnell wie möglich bearbeitet.");
  123.             format(string,sizeof(string),"[REPORT-CHEATER]: Der Spieler %s hat eine Cheater-Meldung eingesendet: %s ",PlayerName(playerid),inputtext);
  124.             SendRconAdminMessage(COLOR_ROT,string);
  125.             SetPVarInt(playerid,"Ticket",1);
  126.             format(string,sizeof(string),"[OFFENER-REPORT]: Es liegt ein offenes Ticket von %s vor: %s ",PlayerName(playerid),inputtext);
  127.             SetPVarString(playerid, "TicketText", string);
  128.         }
  129.         else
  130.         {
  131.             SendClientMessage(playerid, COLOR_GRUEN, "Du hast das Report-System beendet");
  132.         }
  133.     }
  134.     return 1;
  135. }
  136.  
  137. ocmd:report(playerid, params[])
  138. {
  139.     ShowPlayerDialog(playerid, DIALOG_REPORT, DIALOG_STYLE_LIST, "Report", "Fragen\nBeschwerden\nBugs\nCheater-Meldung", "Bestätigen", "Abbrechen");
  140.     return 1;
  141. }
  142.  
  143. ocmd:openreport(playerid, params[])
  144. {
  145.     new pID, string[128];
  146.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_WEIß, "Du bist kein Admin!");
  147.     if(sscanf(params, "u", pID)) return SendClientMessage(playerid, COLOR_WEIß, "Benutze: /openreport [playerid]");
  148.     format(string, sizeof(string), "Der Administrator %s(%d) hat dein Ticket geöffnet und bearbeitet es nun", PlayerName(playerid), playerid);
  149.     SendClientMessage(pID, COLOR_ROT, string);
  150.     SendClientMessage(pID, COLOR_ROT, "Du kannst mit dem Administrator reden indem du /rc benutzt");
  151.     SendClientMessage(pID, COLOR_ROT, "Du hast das Ticket von %s(%d) geöffnet du kannst nun mit /rc mit ihm schreiben");
  152.     SetPVarInt(pID, "Chat", 1);
  153.     SetPVarInt(playerid, "Chat", 1);
  154.     SetPVarInt(pID, "Report", 0);
  155.     SetPVarInt(playerid, "ChatPartner", pID);
  156.     SetPVarInt(pID, "ChatPartner", playerid);
  157.     return 1;
  158. }
  159.  
  160. ocmd:closereport(playerid, params[])
  161. {
  162.     new pID;
  163.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_WEIß, "Du bist kein Admin!");
  164.     if(sscanf(params, "u", pID)) return SendClientMessage(playerid, COLOR_WEIß, "Benutze: /closereport [playerid]");
  165.     SendClientMessage(pID, COLOR_ROT, "Der Administrator hat das Ticket geschlossen. Du kannst nichtmehr mit ihm reden.");
  166.     SendClientMessage(pID, COLOR_ROT, "Du hast das Ticket von %s(%d) geschlossen du kannst nun nichtmehr mit ihm reden.");
  167.     SetPVarInt(pID, "Chat", 0);
  168.     SetPVarInt(playerid, "Chat", 0);
  169.     DeletePVar(playerid, "ChatPartner");
  170.     DeletePVar(pID, "ChatPartner");
  171.     return 1;
  172. }
  173.  
  174. ocmd:delreport(playerid, params[])
  175. {
  176.     new pID;
  177.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_WEIß, "Du bist kein Admin!");
  178.     if(sscanf(params, "u", pID)) return SendClientMessage(playerid, COLOR_WEIß, "Benutze: /delreport [playerid]");
  179.     SendClientMessage(pID, COLOR_ROT, "Ein Administrator hat dein Ticket gelöscht.");
  180.     SendClientMessage(pID, COLOR_ROT, "Du hast das Ticket von %s(%d) gelöscht.");
  181.     DeletePVar(pID, "Ticket");
  182.     return 1;
  183. }
  184.  
  185. ocmd:rc(playerid, params[])
  186. {
  187.     new text, string[128];
  188.     if(GetPVarInt(playerid, "Chat") != 1) return SendClientMessage(playerid, COLOR_WEIß, "Du befindest dich nicht im Report-Chat");
  189.     if(sscanf(params, "s", text)) return SendClientMessage(playerid, COLOR_WEIß, "Benutze: /rc [Text]");
  190.     format(string, sizeof(string), "[REPORT-CHAT]: %s(%d): %s", PlayerName(playerid), playerid, text);
  191.     SendClientMessage(GetPVarInt(playerid, "ChatPartner"), COLOR_ROT, string);
  192.     format(string, sizeof(string), "[REPORT-CHAT]: %s(%d): %s", PlayerName(playerid), playerid, text);
  193.     SendClientMessage(playerid, COLOR_ROT, string);
  194.     return 1;
  195. }
  196.  
  197. ocmd:reporthelp(playerid, params[])
  198. {
  199.     SendClientMessage(playerid, COLOR_WEIß, "Report-Help[USERS]: /report /rc (/reportchat)");
  200.     if(IsPlayerAdmin(playerid))
  201.     {
  202.         //SendClientMessage(playerid, COLOR_WEIß, "Report-Help[USERS]: /report /rc (/reportchat)");
  203.         SendClientMessage(playerid, COLOR_WEIß, "Report-HELP[ADMIN]: /openreport /closereport /delreport /reports");
  204.     }
  205.     return 1;
  206. }
  207.  
  208. ocmd:reports(playerid, params[])
  209. {
  210.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_WEIß, "Du bist kein Admin!");
  211.     for(new i = 0; i < MAX_PLAYERS; i++)
  212.     {
  213.         if(IsPlayerConnected(playerid) && GetPVarInt(i, "Ticket") == 1)
  214.         {
  215.             new Ticket[128];
  216.             GetPVarString(i, "TicketText", Ticket, sizeof(Ticket));
  217.             SendClientMessage(playerid, COLOR_GRUEN, Ticket);
  218.         }
  219.     }
  220.     return 1;
  221. }
  222.  
  223. stock SendRconAdminMessage(color, msg[])
  224. {
  225.     for(new i = 0; i < MAX_PLAYERS; i++)
  226.     {
  227.         if(IsPlayerConnected(i) && IsPlayerAdmin(i))
  228.         {
  229.             SendClientMessage(i, color, msg);
  230.         }
  231.     }
  232. }
  233.  
  234. stock PlayerName(playerid)
  235. {
  236.     new Name[MAX_PLAYER_NAME];
  237.     GetPlayerName(playerid, Name, sizeof(Name));
  238.     return Name;
  239. }
  240.  
  241. stock sscanf(string[], format[], {Float,_}:...)
  242. {
  243.     #if defined isnull
  244.             if (isnull(string))
  245.     #else
  246.             if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
  247.     #endif
  248.             {
  249.                     return format[0];
  250.             }
  251.     #pragma tabsize 4
  252.     new
  253.             formatPos = 0,
  254.             stringPos = 0,
  255.             paramPos = 2,
  256.             paramCount = numargs(),
  257.             delim = ' ';
  258.     while (string[stringPos] && string[stringPos] <= ' ')
  259.     {
  260.             stringPos++;
  261.     }
  262.     while (paramPos < paramCount && string[stringPos])
  263.     {
  264.             switch (format[formatPos++])
  265.             {
  266.                     case '\0':
  267.                     {
  268.                             return 0;
  269.                     }
  270.                     case 'i', 'd':
  271.                     {
  272.                             new
  273.                                     neg = 1,
  274.                                     num = 0,
  275.                                     ch = string[stringPos];
  276.                             if (ch == '-')
  277.                             {
  278.                                     neg = -1;
  279.                                     ch = string[++stringPos];
  280.                             }
  281.                             do
  282.                             {
  283.                                     stringPos++;
  284.                                     if ('0' <= ch <= '9')
  285.                                     {
  286.                                             num = (num * 10) + (ch - '0');
  287.                                     }
  288.                                     else
  289.                                     {
  290.                                             return -1;
  291.                                     }
  292.                             }
  293.                             while ((ch = string[stringPos]) > ' ' && ch != delim);
  294.                             setarg(paramPos, 0, num * neg);
  295.                     }
  296.                     case 'h', 'x':
  297.                     {
  298.                             new
  299.                                     num = 0,
  300.                                     ch = string[stringPos];
  301.                             do
  302.                             {
  303.                                     stringPos++;
  304.                                     switch (ch)
  305.                                     {
  306.                                             case 'x', 'X':
  307.                                             {
  308.                                                     num = 0;
  309.                                                     continue;
  310.                                             }
  311.                                             case '0' .. '9':
  312.                                             {
  313.                                                     num = (num << 4) | (ch - '0');
  314.                                             }
  315.                                             case 'a' .. 'f':
  316.                                             {
  317.                                                     num = (num << 4) | (ch - ('a' - 10));
  318.                                             }
  319.                                             case 'A' .. 'F':
  320.                                             {
  321.                                                     num = (num << 4) | (ch - ('A' - 10));
  322.                                             }
  323.                                             default:
  324.                                             {
  325.                                                     return -1;
  326.                                             }
  327.                                     }
  328.                             }
  329.                             while ((ch = string[stringPos]) > ' ' && ch != delim);
  330.                             setarg(paramPos, 0, num);
  331.                     }
  332.                     case 'c':
  333.                     {
  334.                             setarg(paramPos, 0, string[stringPos++]);
  335.                     }
  336.                     case 'f':
  337.                     {
  338.  
  339.                             new changestr[16], changepos = 0, strpos = stringPos;
  340.                             while(changepos < 16 && string[strpos] && string[strpos] != delim)
  341.                             {
  342.                                     changestr[changepos++] = string[strpos++];
  343.                             }
  344.                             changestr[changepos] = '\0';
  345.                             setarg(paramPos,0,_:floatstr(changestr));
  346.                     }
  347.                     case 'p':
  348.                     {
  349.                             delim = format[formatPos++];
  350.                             continue;
  351.                     }
  352.                     case '\'':
  353.                     {
  354.                             new
  355.                                     end = formatPos - 1,
  356.                                     ch;
  357.                             while ((ch = format[++end]) && ch != '\'') {}
  358.                             if (!ch)
  359.                             {
  360.                                     return -1;
  361.                             }
  362.                             format[end] = '\0';
  363.                             if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
  364.                             {
  365.                                     if (format[end + 1])
  366.                                     {
  367.                                             return -1;
  368.                                     }
  369.                                     return 0;
  370.                             }
  371.                             format[end] = '\'';
  372.                             stringPos = ch + (end - formatPos);
  373.                             formatPos = end + 1;
  374.                     }
  375.                     case 'u':
  376.                     {
  377.                             new
  378.                                     end = stringPos - 1,
  379.                                     id = 0,
  380.                                     bool:num = true,
  381.                                     ch;
  382.                             while ((ch = string[++end]) && ch != delim)
  383.                             {
  384.                                     if (num)
  385.                                     {
  386.                                             if ('0' <= ch <= '9')
  387.                                             {
  388.                                                     id = (id * 10) + (ch - '0');
  389.                                             }
  390.                                             else
  391.                                             {
  392.                                                     num = false;
  393.                                             }
  394.                                     }
  395.                             }
  396.                             if (num && IsPlayerConnected(id))
  397.                             {
  398.                                     setarg(paramPos, 0, id);
  399.                             }
  400.                             else
  401.                             {
  402.                                     #if !defined foreach
  403.                                             #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
  404.                                             #define __SSCANF_FOREACH__
  405.                                     #endif
  406.                                     string[end] = '\0';
  407.                                     num = false;
  408.                                     new
  409.                                             name[MAX_PLAYER_NAME];
  410.                                     id = end - stringPos;
  411.                                     foreach (Player, playerid)
  412.                                     {
  413.                                             GetPlayerName(playerid, name, sizeof (name));
  414.                                             if (!strcmp(name, string[stringPos], true, id))
  415.                                             {
  416.                                                     setarg(paramPos, 0, playerid);
  417.                                                     num = true;
  418.                                                     break;
  419.                                             }
  420.                                     }
  421.                                     if (!num)
  422.                                     {
  423.                                             setarg(paramPos, 0, INVALID_PLAYER_ID);
  424.                                     }
  425.                                     string[end] = ch;
  426.                                     #if defined __SSCANF_FOREACH__
  427.                                             #undef foreach
  428.                                             #undef __SSCANF_FOREACH__
  429.                                     #endif
  430.                             }
  431.                             stringPos = end;
  432.                     }
  433.                     case 's', 'z':
  434.                     {
  435.                             new
  436.                                     i = 0,
  437.                                     ch;
  438.                             if (format[formatPos])
  439.                             {
  440.                                     while ((ch = string[stringPos++]) && ch != delim)
  441.                                     {
  442.                                             setarg(paramPos, i++, ch);
  443.                                     }
  444.                                     if (!i)
  445.                                     {
  446.                                             return -1;
  447.                                     }
  448.                             }
  449.                             else
  450.                             {
  451.                                     while ((ch = string[stringPos++]))
  452.                                     {
  453.                                             setarg(paramPos, i++, ch);
  454.                                     }
  455.                             }
  456.                             stringPos--;
  457.                             setarg(paramPos, i, '\0');
  458.                     }
  459.                     default:
  460.                     {
  461.                             continue;
  462.                     }
  463.             }
  464.             while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
  465.             {
  466.                     stringPos++;
  467.             }
  468.             while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
  469.             {
  470.                     stringPos++;
  471.             }
  472.             paramPos++;
  473.     }
  474.     do
  475.     {
  476.             if ((delim = format[formatPos++]) > ' ')
  477.             {
  478.                     if (delim == '\'')
  479.                     {
  480.                             while ((delim = format[formatPos++]) && delim != '\'') {}
  481.                     }
  482.                     else if (delim != 'z')
  483.                     {
  484.                             return delim;
  485.                     }
  486.             }
  487.     }
  488.     while (delim > ' ');
  489.     return 0;
  490. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement