1. GSManager
    1. Funktionen
    2. Unterstützte Spiele
    3. Neuigkeiten
    4. Statistiken
    5. Serverliste
  2. Lexikon
  3. Filebase
  4. Entwicklung
  5. Forum
    1. Dashboard
    2. Unerledigte Themen
  6. Web-Interface
  7. Artikel
  8. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  • Deutsch
  • Anmelden
  • Registrieren
  • Suche
Dieses Thema
  1. GSManager
  2. Forum
  3. Allgemeines
  4. Vorschläge

Plugin GSM for the script VAS

    • Geplant
    • GSManager
  • Raiden
  • 31. Januar 2017 um 20:52
Das Projekt GSManager (vormals ManuAdminMod) wurde am 01.01.2020 eingestellt - diese Internetpräsenz bleibt verfügbar, die Software wird aber nicht länger gepflegt. Vielen Dank für eure Unterstützung in den mehr als zehn vergangenen Jahren!
1. offizieller Beitrag
  • Raiden
    Anfänger
    Reaktionen
    11
    Punkte
    296
    Trophäen
    1
    Dateien
    1
    Beiträge
    47
    • 31. Januar 2017 um 20:52
    • #1

    This plugin Vote&AdminSystem (for MW2) was written for ManuAdminMod long been one person for the convenience of voting and server administration Cod 6, the script passed plugin commands to kick, tempban and ban a plug-in to apply them in action, but now I can not and do not want to use manuadminmod when it there Game System Manager, so here is whether this plug-in can be rewritten to GSM?

    That plugin code:

    Code plugin vas
    PHP: vas.php
    <?php
    /*
    PLUGIN: VAS
    ================
    Interaction with Vote&AdminSystem for MW2
    Used to kick, ban and tempban from VAS menu
    created by Dimnik_u11
    
    */
    
        global $mod;
    
        if (!$mod->getCV("ftp", "enabled")) {
            $vasparser = new parser($mod->getCV("main", "logfile"), $success);
        }
        else {
            $vasparser = new parser_ftp($mod->getCV("main", "logfile"), $success, $mod->getCV("ftp", "host"), $mod->getCV("ftp", "user"), $mod->getCV("ftp", "password"), $mod->getCV("ftp", "port"), (bool)(int)$mod->getCV("ftp", "passive"));
        }
        if (!$success) {
            $logging->write(MOD_ERROR, "Couldn't open server's logfile: '".$mod->getCV("main", "logfile")."'");
            return;
        }
    
        $logging->write(MOD_NOTICE, "--- VAS plugin: Start processing loglines... ---");
        
        $mod->setDefaultCV("vas", "banlistfile", $mod->getConfigDir() . "/plugins/banlist.txt");
        $mod->setDefaultCV("vas", "enableban", 0);
        $mod->setDefaultCV("vas", "logging", 0);
    
        
        $banlistfile = $mod->getCV("vas", "banlistfile");
        $srvlogfile = $mod->getCV("main", "logfile");
        $logenable = $mod->getCV("vas", "logging");
    
        $mod->registerEvent("everyTime", "vas_check");
        $mod->registerEvent("playerJoined", "ban_check");
    
    
    function vas_check() {
        global $logging;
        
        $vas_command = getLine();
        if ($vas_command === false){
            return;
        }
        $action = $vas_command["action"];
        $parts = $vas_command["parts"];
        vas_execute($action,$parts); 
    
    }
    
    function getLine() {
        global $logging;
        global $vasparser;
        global $logenable;
    
        clearstatcache();
    
        $newlines = $vasparser->getNewLines();
        foreach ($newlines as $line) {
            //$logging->write(MOD_NOTICE, "VAS: New line. $line");
            $pattern_abs = '|^\s*(\d+) |';
            $pattern_rel = '|^\s*(\d+):(\d{2}) |';
    
            if (preg_match($pattern_rel, $line, $subpatterns)) {
                $timestamp = 60 * $subpatterns[1] + $subpatterns[2];
            }
            elseif (preg_match($pattern_abs, $line, $subpatterns)) {
                $timestamp = $subpatterns[1];
            }
            else {
                return false;
            }
            $line = trim(str_replace($subpatterns[0], "", $line));
            
            if (strpos($line, "VAS") === 0) {
                $line = trim(str_replace("VAS;", "", $line));
                if($logenable) $logging->write(MOD_NOTICE, "VAS: $line");
                if (strpos($line, "execute") === 0) {
                    $line = trim(str_replace("execute;", "", $line));
                    //$logging->write(MOD_NOTICE, "VAS: execute in line. $line");                
                    $vas_action = vas_getAction($line);
                    $vas_parts = vas_ParseParts($line);
                    return array(
                    "action" => $vas_action,
                    "parts" => $vas_parts,
                    );    
                }
            }
        }
        return false;
    }
    
    function vas_ParseParts($line) {
        $parts = explode(";", $line);
        array_shift($parts);
        return $parts;
    }
    
    function vas_getAction($line) {
            $vas_actions = array(
                "kick" => "kick;",
                "ban" => "ban;",
                "tempban" => "tempban;",
                "warning" => "warning;"
            );
            foreach ($vas_actions as $key => $value) {
                if (strpos($line, $value) === 0) {
                    return $key;
                }
            }
            return "unknown";
    
    }
    
    function vas_execute($action,$parts) {
        //global $players;
        global $mod;
        global $logging;
        global $banlistfile;
        $rcon = & $GLOBALS['rcon'];
    
        //list($except_guid, $except_pid, $except_name, $except_reason, $except_by) = $parts;
    
        switch ($action) {
            case "kick":
                //"VAS - guid ; name ; reason ; kickby
                list($except_guid, $except_pid, $except_name, $except_reason, $except_by, $adminname) = $parts;
                //list($kick_guid, $kick_pid, $kick_name, $kick_reason, $kickby) = $parts;
                $toclient = "kicked for reason: " . $except_reason .  " (" . $except_by . ")";
                $logging->write(MOD_NOTICE, "VAS: command kick - player '$except_name', PID: $except_pid, GUID: $except_guid, reason: $toclient");                
                $rcon->rcon("clientkick " . $except_pid . " " . $toclient );
                $mod->triggerEvent("playerKicked", array($except_guid, $except_reason));
                break;
                
            case "tempban":
                //"VAS - guid ; name ; reason ; by
                list($except_guid, $except_pid, $except_name, $except_reason, $except_by, $adminname) = $parts;
                 //list($tban_guid, $tban_pid, $tban_name, $tban_reason, $tbanby) = $parts;
                $toclient = "tempbanned for reason: " . $except_reason .  " (" . $except_by . ")";
                $logging->write(MOD_NOTICE, "VAS: command tempban - player '$except_name', PID: $except_pid, GUID: $except_guid, reason: $toclient");                
                $rcon->rcon("tempBanClient " . $except_pid . " " . $toclient);
                $mod->triggerEvent("playerTempBanned", array($except_guid, $except_reason));
                break;
    
            case "ban":
                list($except_guid, $except_pid, $except_name, $except_reason, $except_by, $adminname) = $parts;
                $toclient = "banned for reason: " . $except_reason .  " (" . $except_by . ")";
                $logging->write(MOD_NOTICE, "VAS: command ban - player '$except_name', PID: $except_pid, GUID: $except_guid, reason: $toclient");                
                $rcon->rcon("tempBanClient " . $except_pid . " " . $toclient);
                $date = date("[d.m.y H:i:s]");
                $str = "$date Player \"$except_name\" ($except_guid) got BANNED for reason: $except_reason ($except_by)\n";
                $banlistfile_filehandle = fopen($banlistfile, "a");
                fwrite($banlistfile_filehandle, $str);
                fclose($banlistfile_filehandle);
                
                $mod->triggerEvent("playerBanned", array($except_guid, $except_reason));
                break;
            
            case "warning":
                
            default:
                return;
        }
        
    }
    
    function ban_check($guid) {
    
        global $players;
        global $mod;
        global $logging;
        $rcon = & $GLOBALS['rcon'];
        global $banlistfile;
    
        
        if (!$mod->getCV("vas", "enableban")) {
            return false;
        }
    
        //$ret = false; 
        if (($cont = file_get_contents($banlistfile)) === FALSE) return false;
        $findguidpos = strpos($cont, $guid);
        if ($findguidpos !== false) {
            $endstr = strpos($cont, chr(10), $findguidpos);
            $resonestart = strpos($cont, "reason:", $findguidpos);
            //$reasone = substr($cont, $resonestart, $endstr-$resonestart);
            $reasone = str_replace("reason: ", "" ,substr($cont, $resonestart, $endstr-$resonestart));
    
            $pid = $players[$guid]->getPID();
            $rcon->rcon("tempBanClient " . $pid . " " . $reasone);
            
            //$players[$guid]->kick("Autokick! BANED for $reasone");
            $logging->write(MOD_NOTICE, "BANCHECK: Player '".$players[$guid]->getName()."' guid: ($guid) was TempBanned. Stored reasone: '$reasone'");
        }
    
    }
    
    //}
    ?>
    Alles anzeigen

    Just add the script

    Dateien

    VAS_1.2.zip 31,73 kB – 578 Downloads

    Einmal editiert, zuletzt von Raiden (1. Februar 2017 um 12:36) aus folgendem Grund: fix

  • Mirko911
    Entwickler
    Reaktionen
    165
    Punkte
    16.820
    Trophäen
    6
    Beiträge
    3.263
    Einträge
    11
    • 1. Februar 2017 um 08:25
    • #2

    afaik this plugin was used to enforce bans on cod6 servers because they don't have a built-in ban function, right?

  • Raiden
    Anfänger
    Reaktionen
    11
    Punkte
    296
    Trophäen
    1
    Dateien
    1
    Beiträge
    47
    • 1. Februar 2017 um 12:29
    • #3

    Mirko911, yes, yes exactly! So it is possible to fix whatever he was working on GSManager?

  • Dieses Thema enthält 7 weitere Beiträge, die nur für registrierte Benutzer sichtbar sind.

Benutzer online in diesem Thema

  • 1 Besucher
  1. Mitarbeiter
  2. Datenschutzerklärung
  3. Nutzungsbedingungen
  4. Impressum
  5. Kontakt
Community-Software: WoltLab Suite™
  • Alles
  • Dieses Thema
  • Dieses Forum
  • Artikel
  • Seiten
  • Dateien
  • Forum
  • Lexikon
  • Erweiterte Suche
  • Deutsch
  • English
Zitat speichern