Report Fail.

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • Hey ;D
    Komme bei dem ReporttSys immer wenn ich /report -> Grund (Hack,etc) immer auf seite 3 ...
    Code :

    Spoiler anzeigen
    #include <JunkBuster>
    #include <a_samp>

    Spoiler anzeigen
    //#define click_used 0 // Soll ein Reportdialog kommen, wenn man per TAB auf einen Spieler klickt?
    #define used 2 // Die Zahl je nach bevorzugter Speicherart ändern. 1 = MySQL, 2 = dini, 3 = fwrite-Funktionen
    #define admin_send // Soll jedem RCON-Admin eine Nachricht bei Reports gesendet werden?
    #define dini_path "reports" // Ordner in dem die Reports gespeichert werden, wenn andere Speicherungsart als MySQL verwendet wird.
    // Falls nicht benötigt einfach ignorieren.

    Spoiler anzeigen
    #if used == 1 // Falls die folgenden Zeilen nicht benötigt werden: Einfach ignorieren.
    #define mysql_host "localhost" // MySQL Hostname
    #define mysql_name "username" // MySQL Loginname
    #define mysql_pw "password" // MySQL Passwort
    #define mysql_db "database" // MySQL Datenbankname
    #endif

    Spoiler anzeigen
    #if defined admin_send // Falls zwischen Gamemode und Filterscript NICHT kommuniziert werden soll, bei pvar_name "abcd" und bei pvar_minlvl 1 eintragen.
    #define pvar_name "abcd" // PVar-Name des Adminlevels im Gamemode.
    #define pvar_minlvl 1 // Minimales benötigtes Adminlevel.
    #endif

    Spoiler anzeigen
    #if used == 2
    #include <dini> // Name der dini-Include
    #endif
    #if used == 1
    #include <mysql> // Name eurer MySQL-Include
    #endif

    Spoiler anzeigen
    // Ab hier NICHTS mehr bearbeiten, sofern ihr die Scriptsprache PAWN nicht beherrscht oder nichts am Script ändern wollt.
    forward ReportPlayer(playerid, reportedid, reason[], description[]);
    new ID[50];

    Spoiler anzeigen
    public OnFilterScriptInit()
    {
    #if used == 1
    mysql_connect(mysql_host, mysql_name, mysql_pw, mysql_db);
    new query[256] = "CREATE TABLE [IF NOT EXISTS] `reports` (";
    strcat(query, "`id` INT NOT NULL AUTO_INCREMENT ,");
    strcat(query, "`reporter` VARCHAR( 24 ) NOT NULL ,");
    strcat(query, "`reported` VARCHAR( 24 ) NOT NULL ,");
    strcat(query, "`reason` VARCHAR( 24 ) NOT NULL ,");
    strcat(query, "`description` VARCHAR( 68 ) NOT NULL ,");
    strcat(query, "`time` VARCHAR( 24 ) NOT NULL ,");
    strcat(query, "`read` INT( 2 ) ,");
    strcat(query, "PRIMARY KEY ( `id` ))");
    mysql_query(query);
    #endif
    print("-Ø Dynamisches Report-System von Padarom Ø-");
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerText(playerid, text[])
    {
    if(GetPVarInt(playerid, "inChat") == 1)
    {
    new pName[24], msg[128];
    GetPlayerName(playerid, pName, 24);
    format(msg, 128, "[ %s: %s ]", pName, text);
    SendClientMessage(playerid, 0x2FABEDFF, msg);
    SendClientMessage(GetPVarInt(playerid,"ticketPartner"), 0x2FABEDFF, msg);
    return 0;
    }
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerConnect(playerid)
    {
    SetPVarInt(playerid, "subject", -1);
    SetPVarString(playerid, "reportreason", "");
    SetPVarInt(playerid, "ticketPartner", -1);
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerDisconnect(playerid, reason)
    {
    if(GetPVarInt(playerid, "inChat") == 1)
    {
    SendClientMessage(GetPVarInt(playerid,"ticketPartner"), 0x2FABEDFF, "[ * Dein Ticketpartner ist offline gegangen. Das Ticket wurde beendet. ]");
    SetPVarInt(GetPVarInt(playerid,"ticketPartner"),"inChat", 0);
    SetPVarInt(GetPVarInt(playerid,"ticketPartner"),"ticketPartner", -1);
    }
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerCommandText(playerid, cmdtext[])
    {
    if(!strcmp(cmdtext,"/report",false))
    {
    ShowPlayerDialog(playerid, 100, DIALOG_STYLE_LIST, "Beschwerde", "Hacken\nEinweisung\nBeleidigung\nAbwerben\nSpam\nWill nur Nerven!", "Weiter", "Abbrechen");
    return 1;
    }
    if(!strcmp(cmdtext,"/atickets",false))
    {
    ShowTicketDialog(playerid);
    return 1;
    }
    if(!strcmp(cmdtext,"/tchat"))
    {
    if(GetPVarInt(playerid,"ticketPartner") != -1 && GetPVarInt(playerid,"inChat") == 0)
    {
    SetPVarInt(playerid,"inChat",1);
    SetPVarInt(GetPVarInt(playerid,"ticketPartner"),"inChat",1);
    SendClientMessage(playerid, 0xEDB90CFF, "* Du hast den Ticketchat angenommen. Du kannst nun mit dem Admin reden.");
    SendClientMessage(GetPVarInt(playerid,"ticketPartner"), 0xEDB90CFF, "* Dein Ticketchat wurde gestartet. Du kannst nun mit dem Verfasser des Tickets reden.");
    }
    else if(GetPVarInt(playerid,"inChat") == 1)
    {
    SendClientMessage(playerid, 0xEDB90CFF, "* Du hast den Ticketchat beendet.");
    SendClientMessage(GetPVarInt(playerid,"ticketPartner"), 0xEDB90CFF, "* Dein aktiver Ticketchat wurde beendet.");
    SetPVarInt(playerid,"inChat",0);
    SetPVarInt(GetPVarInt(playerid,"ticketPartner"),"inChat",0);
    SetPVarInt(GetPVarInt(playerid,"ticketPartner"),"ticketPartner",-1);
    SetPVarInt(playerid,"ticketPartner",-1);
    }
    else SendClientMessage(playerid, 0xEDB90CFF, "* Du hast aktuell keinen Ticketchat am Laufen.");
    return 1;
    }
    return 0;
    }

    Spoiler anzeigen
    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    if(dialogid == 100 && response)
    {
    switch(listitem)
    {
    case 0: SetPVarString(playerid, "reason", "Hacken");
    case 1: SetPVarString(playerid, "reason", "Einweisung");
    case 2: SetPVarString(playerid, "reason", "Beleidigung");
    case 3: SetPVarString(playerid, "reason", "Abwerben");
    case 4: SetPVarString(playerid, "reason", "Spam");
    case 5: return SendClientMessage(playerid, 0xEDB90CFF, "* Wenigstens bist du ehrlich ;)");
    }
    if(GetPVarInt(playerid, "subject") == -1) ShowPlayerDialog(playerid, 101, DIALOG_STYLE_INPUT, "Beschwerde - Seite 2", "Bitte gib nun den Namen oder die ID des Spielers an.", "Weiter", "Zurück");
    else ShowPlayerDialog(playerid, 102, DIALOG_STYLE_INPUT, "Beschwerde - Seite 3", "Bitte gib nun eine kurze Beschreibung zu deiner Beschwerde/Anfrage an.", "Weiter", "Zurück");
    }
    else if(dialogid == 101)
    {
    if(response)
    {
    new sName[24];
    if(!IsNumeric(inputtext))
    {
    for(new i=0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    GetPlayerName(i, sName, 24);
    if(!strcmp(inputtext, sName, true))
    {
    SetPVarInt(playerid, "subject", i);
    break;
    }
    }
    }
    if(GetPVarInt(playerid,"subject") == -1) return ShowPlayerDialog(playerid, 101, DIALOG_STYLE_INPUT, "Beschwerde - Seite 2", "Bitte gib nun den Namen oder die ID des zu meldenden Spielers an.", "Weiter", "Zurück");
    }
    else
    {
    if(!IsPlayerConnected(strval(inputtext)) || !strlen(inputtext)) return ShowPlayerDialog(playerid, 101, DIALOG_STYLE_INPUT, "Beschwerde - Seite 2", "Bitte gib nun den Namen oder die ID des zu meldenden Spielers an.", "Weiter", "Zurück");
    else SetPVarInt(playerid, "subject", strval(inputtext));
    }
    ShowPlayerDialog(playerid, 102, DIALOG_STYLE_INPUT, "Beschwerde - Seite 3", "Bitte gib nun eine kurze Beschreibung zu deiner Beschwerde an.", "Weiter", "Zurück");
    }
    else return ShowPlayerDialog(playerid, 101, DIALOG_STYLE_INPUT, "Beschwerde - Seite 2", "Bitte gib nun den Namen oder die ID des zu meldenden Spielers an.", "Weiter", "Zurück");
    }
    else if(dialogid == 102)
    {
    if(response)
    {
    if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 102, DIALOG_STYLE_INPUT, "Beschwerde - Seite 3", "Bitte gib nun eine kurze Beschreibung zu deiner Beschwerde an.", "Weiter", "Zurück");
    else
    {
    new text[256], sName[24], reason[24], description[128];
    SetPVarString(playerid, "description", inputtext);
    GetPlayerName(GetPVarInt(playerid, "subject"), sName, 24);
    GetPVarString(playerid, "reason", reason, 24);
    GetPVarString(playerid, "description", description, 128);
    format(text, 256, "{ff00ff}Spieler: {FFFFFF}%s (ID: %i)\n{ff00ff}Grund: {FFFFFF}%s\n{ff00ff}Beschreibung: {FFFFFF}%s\n\nWenn diese Beschwerde korrekt ist, klicke bitte auf Absenden. Ansonsten auf Abbrechen.", sName, GetPVarInt(playerid, "subject"), reason, description);
    ShowPlayerDialog(playerid, 103, DIALOG_STYLE_MSGBOX, "Beschwerde - Abschluss", text, "Absenden", "Abbrechen");
    }
    }
    else return ShowPlayerDialog(playerid, 101, DIALOG_STYLE_INPUT, "Beschwerde - Seite 2", "Bitte gib nun den Namen oder die ID des zu meldenden Spielers an.", "Weiter", "Zurück");
    }
    else if(dialogid == 103)
    {
    if(!response) return SetPVarInt(playerid, "subject", -1);
    new reason[24], description[64];
    GetPVarString(playerid, "reason", reason, 24);
    GetPVarString(playerid, "description", description, 64);
    ReportPlayer(playerid, GetPVarInt(playerid, "subject"), reason, description);
    SendClientMessage(playerid, 0xEDB90CFF, "* Deine Beschwerde wurde erfolgreich eingereicht.");
    }
    else if(dialogid == 104)
    {
    if(!response) return 1;
    new autor[256], subject[256], description[256], reason[256], time[256];
    new path[68], text[500], string[128];
    #if used == 1
    #pragma unused string
    format(path, 68, "SELECT * FROM reports WHERE id = %i", ID[listitem]);
    mysql_query(path);
    mysql_store_result();
    mysql_fetch_field("reason", reason);
    mysql_fetch_field("time", time);
    mysql_fetch_field("subject", subject);
    mysql_fetch_field("description", description);
    mysql_fetch_field("reporter", autor);
    mysql_free_result();
    format(path, 68, "UPDATE reports SET read = 1 WHERE id = %i", ID[listitem]);
    mysql_query(path);
    #endif
    #if used == 2
    #pragma unused string
    format(path, 68, "/%s/%i.ini", dini_path, ID[listitem]);
    autor = dini_Get(path, "reporter");
    subject = dini_Get(path, "subject");
    description = dini_Get(path, "description");
    reason = dini_Get(path, "reason");
    time = dini_Get(path, "time");
    dini_IntSet(path, "read", 1);
    SetPVarInt(playerid,"sTicket",ID[listitem]);
    #endif
    #if used == 3
    format(path, 68, "/%s/%i.txt", dini_path, ID[listitem]);
    new File:report = fopen(path, io_read);
    while(fread(report, string))
    {
    string[strlen(string)-1] = '\0';
    if(strfind(string, "subject", true) != -1) { strdel(string, 0, 8); subject = string; }
    if(strfind(string, "time", true) != -1) { strdel(string, 0, 5); time = string; }
    if(strfind(string, "reason", true) != -1) { strdel(string, 0, 7); reason = string; }
    if(strfind(string, "description", true) != -1) { strdel(string, 0, 12); description = string; }
    if(strfind(string, "reporter", true) != -1) { strdel(string, 0, 9); autor = string; }
    }
    fclose(report);
    fremove(path);
    report = fopen(path, io_readwrite);
    format(text, 256, "reporter=%s\r\nsubject=%s\r\nreason=%s\r\ndescription=%s\r\ntime=%s\r\nread=1", autor, subject, reason, description, time);
    fwrite(report, text);
    fclose(report);
    SetPVarInt(playerid,"sTicket",ID[listitem]);
    #endif
    new bool:online, pName[24];
    for(new i=0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    GetPlayerName(i, pName, 24);
    if(!strcmp(pName, autor, true, strlen(pName)))
    {
    online = true;
    SetPVarInt(playerid,"ticketReady",1);
    SetPVarInt(playerid,"ticketPartner",i);
    break;
    }
    }
    }
    if(online == true) format(text, 500, "{ff00ff}Beschwerde verfasst (am %s Uhr) von {FFFFFF}%s\n{ff00ff}Spieler: {FFFFFF}%s\n{ff00ff}Grund: {FFFFFF}%s\n{ff00ff}Beschreibung: {FFFFFF}%s\n\nDer Autor des Tickets ist aktuell online. Um dich mit ihm zu unterhalten, klicke auf den rechten Button.", time, autor, subject, reason, description);
    else format(text, 500, "{ff00ff}Beschwerde verfasst (am %s Uhr) von {FFFFFF}%s\n{ff00ff}Spieler: {FFFFFF}%s\n{ED9E15}Grund: {FFFFFF}%s\n{ff00ff}Beschreibung: {FFFFFF}%s\n\nDer Autor des Tickets ist aktuell offline. Wenn du dich mit ihm unterhalten willst, musst du dich noch ein bisschen gedulden.", time, autor, subject, reason, description);
    if(online == true) ShowPlayerDialog(playerid, 105, DIALOG_STYLE_MSGBOX, "Beschwerde", text, "Zurück", "Chat");
    else ShowPlayerDialog(playerid, 105, DIALOG_STYLE_MSGBOX, "Beschwerde", text, "Zurück", "Zurück");

    }
    else if(dialogid == 105)
    {
    if(!response && GetPVarInt(playerid,"ticketReady") == 0) { ShowTicketDialog(playerid); SetPVarInt(playerid,"sTicket",-1); }
    else if(!response && GetPVarInt(playerid,"ticketReady") == 1)
    {
    new msg[128], pName[24];
    SetPVarInt(GetPVarInt(playerid,"ticketPartner"),"ticketPartner",playerid);
    SetPVarInt(playerid, "ticketReady", 0);
    GetPlayerName(playerid, pName, 24);
    format(msg, 128, "* Der Admin %s möchte gerne bezüglich deiner Beschwerde mit dir sprechen. Tippe /tchat, sobald du Zeit hast.", pName);
    SendClientMessage(GetPVarInt(playerid,"ticketPartner"), 0xEDB90CFF, msg);
    GetPlayerName(GetPVarInt(playerid,"ticketPartner"), pName, 24);
    format(msg, 128, "* Eine Ticketchat-Anfrage wurde an %s verschickt. Bitte warte, bis er sie akzeptiert.", pName);
    SendClientMessage(playerid, 0xEDB90CFF, msg);
    }
    else if(response)
    {
    SetPVarInt(playerid, "ticketPartner", 0);
    SetPVarInt(playerid, "ticketReady", 0);
    ShowPlayerDialog(playerid, 106, DIALOG_STYLE_MSGBOX, "Löschen der Beschwerde", "Du hast die Beschwerde nun eingesehen.\nWillst du sie löschen?", "Ja", "Nein");
    }
    }
    else if(dialogid == 106)
    {
    if(response)
    {
    new path[68];
    #if used == 1
    format(path, 68, "DELETE FROM reports WHERE id = %i", GetPVarInt(playerid,"sTicket"));
    mysql_query(path);
    #endif
    #if used == 2
    format(path, 68, "/%s/%i.ini", dini_path, GetPVarInt(playerid,"sTicket"));
    dini_Remove(path);
    #endif
    #if used == 3
    format(path, 68, "/%s/%i.txt", dini_path, GetPVarInt(playerid,"sTicket"));
    fremove(path);
    #endif
    ShowTicketDialog(playerid);
    SendClientMessage(playerid, 0xEDB90CFF, "* Das Ticket wurde erfolgreich gelöscht.");
    SetPVarInt(playerid, "sTicket", 0);
    }
    else ShowTicketDialog(playerid);
    }
    return 1;
    }

    Spoiler anzeigen
    ShowTicketDialog(playerid)
    {
    new i=0, count=0, path[68], msg[1028] = "", cat[128], bool:exists;
    new reason[256], date[256], subject[256], read[256], string[82];
    #if used == 1
    #pragma unused string
    do
    {
    i++;
    format(path, 68, "SELECT * FROM reports WHERE id = %i", i);
    mysql_query(path);
    mysql_store_result();
    if(mysql_num_rows())
    {
    ID[count] = i;
    count++;
    exists = true;
    mysql_fetch_field("reason", reason);
    mysql_fetch_field("time", date);
    mysql_fetch_field("subject", subject);
    mysql_fetch_field("read", read);
    if(strval(read)) format(cat, 68, "{ED9E15}%s {FFFFFF}%s: %s\n", date, subject, reason);
    else format(cat, 68,"{ED9E15}%s {ED1515}%s: %s\n", date, subject, reason);
    strcat(msg, cat);
    mysql_free_result();
    }
    else mysql_free_result();
    }
    while(i<50);
    if(!exists) return ShowPlayerDialog(playerid, 107, DIALOG_STYLE_MSGBOX, "Beschwerden", "Es sind aktuell keine Beschwerden eingetragen.", "Okay", "Nicht okay");
    ShowPlayerDialog(playerid, 104, DIALOG_STYLE_LIST, "Beschwerden", msg, "Auswählen", "Abbrechen");
    #endif
    #if used == 2
    #pragma unused string
    do
    {
    i++;
    format(path, 68, "/%s/%i.ini", dini_path, i);
    if(dini_Exists(path))
    {
    ID[count] = i;
    count++;
    exists = true;
    reason = dini_Get(path, "reason");
    date = dini_Get(path, "time");
    subject = dini_Get(path, "subject");
    read = dini_Get(path, "read");
    if(strval(read)) format(cat, 68, "{ff00ff}%s {FFFFFF}%s: %s\n", date, subject, reason);
    else format(cat, 68,"{ED9E15}%s {ff00ff}%s: %s\n", date, subject, reason);
    strcat(msg, cat);
    }
    }
    while(i<50);
    if(!exists) return ShowPlayerDialog(playerid, 107, DIALOG_STYLE_MSGBOX, "Beschwerden", "Es sind aktuell keine Beschwerden eingetragen.", "Okay", "Nicht okay");
    ShowPlayerDialog(playerid, 104, DIALOG_STYLE_LIST, "Beschwerden", msg, "Auswählen", "Abbrechen");
    #endif
    #if used == 3
    do
    {
    i++;
    format(path, 68, "/%s/%i.txt", dini_path, i);
    if(fexist(path))
    {
    ID[count] = i;
    count++;
    exists = true;
    new File:report = fopen(path, io_read);
    while(fread(report, string))
    {
    if(strfind(string, "subject", true) != -1) { string[strlen(string)-1] = '\0'; strdel(string, 0, 8); subject = string; }
    if(strfind(string, "time", true) != -1) { string[strlen(string)-1] = '\0'; strdel(string, 0, 5);date = string; }
    if(strfind(string, "reason", true) != -1) { string[strlen(string)-1] = '\0'; strdel(string, 0, 7); reason = string; }
    if(strfind(string, "read", true) != -1) { strdel(string, 0, 5); read = string; }
    }
    if(strval(read)) format(cat, 68, "{ff00ff}%s {FFFFFF}%s: %s\n", date, subject, reason);
    else format(cat, 68,"{ED9E15}%s {ff00ff}%s: %s\n", date, subject, reason);
    strcat(msg, cat);
    fclose(report);
    }
    }
    while(i<50);
    if(!exists) return ShowPlayerDialog(playerid, 107, DIALOG_STYLE_MSGBOX, "Beschwerden", "Es sind aktuell keine Beschwerden eingetragen.", "Okay", "Nicht okay");
    ShowPlayerDialog(playerid, 104, DIALOG_STYLE_LIST, "Beschwerden", msg, "Auswählen", "Abbrechen");
    #endif
    return 1;
    }

    Spoiler anzeigen
    stock IsNumeric(const string[])
    {
    new length=strlen(string);
    if(length==0)
    {
    return 0;
    }
    for (new i=0; i<length; i++)
    {
    if (!((string[i] <= '9' && string[i] >= '0') || (i==0 && (string[i]=='-' || string[i]=='+'))))
    {
    return false;
    }
    }
    return 1;
    }

    Spoiler anzeigen
    public ReportPlayer(playerid, reportedid, reason[], description[])
    {
    new path[256], i=0, pName[24], sName[24], msg[128], date[24];
    GetPlayerName(playerid, pName, 24);
    GetPlayerName(reportedid, sName, 24);
    new y, m, d, h, minu;
    getdate(y, m, d);
    gettime(h, minu);
    format(date, 24, "%02i.%02i.%i %02i:%02i", d, m, y, h, minu);
    #if used == 1
    #pragma unused i
    mysql_real_escape_string(pName, pName);
    mysql_real_escape_string(sName, sName);
    mysql_real_escape_string(description, description);
    format(path, 128, "INSERT INTO reports (reporter, subject, reason, description, time) VALUES (%s, %s, %s, %s, %s)", pName, sName, reason, description, date);
    mysql_query(path);
    #endif
    #if used == 2
    do {
    i++;
    format(path, 68, "/%s/%i.ini", dini_path, i);
    }
    while(dini_Exists(path));
    dini_Create(path);
    dini_Set(path, "reporter", pName);
    dini_Set(path, "subject", sName);
    dini_Set(path, "reason", reason);
    dini_Set(path, "description", description);
    dini_Set(path, "time", date);
    #endif
    #if used == 3
    new text[256];
    do {
    i++;
    format(path, 68, "/%s/%i.txt", dini_path, i);
    }
    while(fexist(path));
    new File:report = fopen(path, io_readwrite);
    format(text, 256, "reporter=%s\r\nsubject=%s\r\nreason=%s\r\ndescription=%s\r\ntime=%s\r\nread=0", pName, sName, reason, description, date);
    fwrite(report, text);
    fclose(report);
    #endif
    #if defined admin_send
    for(new a=0; a<MAX_PLAYERS; a++)
    {
    if(IsPlayerConnected(a) && (IsPlayerAdmin(a) || GetPVarInt(a, pvar_name)>pvar_minlvl))
    {
    format(msg, 128, "* %s (ID: %i) hat %s (ID: %i) gemeldet. Nutze /tickets um das Ticket zu überprüfen.", pName, playerid, sName, reportedid);
    SendClientMessage(a, 0xEDB90CFF, msg);
    }
    }
    #endif
    return 1;
    }