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. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  • Anmelden
  • Registrieren
  • Suche
Dieses Thema
  • Alles
  • Dieses Thema
  • Dieses Forum
  • Artikel
  • Seiten
  • Dateien
  • Forum
  • Lexikon
  • Erweiterte Suche
  1. GSManager
  2. Forum
  3. Unterstützung
  4. Benutzung

PHP error please help

  • highground
  • 26. Februar 2011 um 17:50
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!
  • highground
    Anfänger
    Punkte
    80
    Beiträge
    14
    • 26. Februar 2011 um 17:50
    • #1

    Hello everyone!

    I got this in my log and program:

    Code
    0:00 [26.02.11 17:12:35] PHP-Error: Warning in :\Users\Highground\Desktop\Új mappa\adminmod\plugins\logkickbans.php:4 => fopen(logC:/Users/Highground/Desktop/Új mappa/adminmod/log/kickbans.log): failed to open stream: Invalid argument

    and this:

    Code
    48:57 [26.02.11 20:40:34] PHP-Error: Warning in :\Users\Highground\Desktop\Új mappa\adminmod\plugins\logkickbans.php:29 => fopen(logC:/Users/Highground/Desktop/Új mappa/adminmod/log/kickbans.log): failed to open stream: Invalid argument 
     	48:57 [26.02.11 20:40:34] PHP-Error: Warning in :\Users\Highground\Desktop\Új mappa\adminmod\plugins\logkickbans.php:37 => fwrite() expects parameter 1 to be resource, boolean given

    What is wrong? I don't understand PHP language :)
    here is my full "logkickbans.php":

    Spoiler anzeigen
    PHP
    <?php
    
    
    
    
    
    
    
    $logkickbans_filehandle = fopen(LOGDIR .  "C:/Users/Highground/Desktop/Új mappa/adminmod/log/kickbans.log", "a");
    
    
    
    
    $mod->registerEvent("playerKicked", "logkickbans_kick");
    $mod->registerEvent("playerBanned", "logkickbans_ban");
    $mod->registerEvent("playerTempBanned", "logkickbans_tempban");
    
    
    
    
    function logkickbans_kick($args) {
    global $logkickbans_filehandle;
    list($player, $reason, $kicker) = $args;
    $date = date("[d.m.y H:i:s]");
    $nickname = $GLOBALS['players'][$player]->getName();
    if (!$kicker) {
        $str = "$date Player \"$nickname\" ($player) got AUTO KICKED for reason: $reason\n";
    }
    else {
        $kicker = $GLOBALS['players'][$kicker]->getName();
        $str = "$date Player \"$nickname\" ($player) got KICKED by \"$kicker\" for reason: $reason\n";
    }
    fwrite($logkickbans_filehandle, $str);
    }
    function logkickbans_ban($args) {
    list($player, $reason, $kicker) = $args;
    $date = date("[d.m.y H:i:s]");
    $nickname = $GLOBALS['players'][$player]->getName();
    if (!$kicker) {
    $logkickbans_filehandle = fopen(LOGDIR . "C:/Users/Highground/Desktop/Új mappa/adminmod/log/kickbans.log", "a");
        $str = "$date Player \"$nickname\" ($player) got AUTO BANNED for reason: $reason\n";
    }
    else {
    $logkickbans_filehandle = fopen(LOGDIR . "C:/Users/Highground/Desktop/Új mappa/adminmod/log/kickbans.log", "a");
        $kicker = $GLOBALS['players'][$kicker]->getName();
        $str = "$date Player \"$nickname\" ($player) got BANNED by \"$kicker\" for reason: $reason\n";
    }
    fwrite($logkickbans_filehandle, $str);
    }
    
    
    
    
    function logkickbans_tempban($args) {
    global $logkickbans_filehandle;
    list($player, $reason, $time, $kicker) = $args;
    $date = date("[d.m.y H:i:s]");
    $nickname = $GLOBALS['players'][$player]->getName();
    if (!$kicker) {
        $str = "$date Player \"$nickname\" ($player) got AUTO TEMPBANNED ($time mins) for reason: $reason\n";
    }
    else {
        $kicker = $GLOBALS['players'][$kicker]->getName();
        $str = "$date Player \"$nickname\" ($player) got TEMPBANNED ($time mins) by \"$kicker\" for reason: $reason\n";
    }
    fwrite($logkickbans_filehandle, $str);
    }
    
    
    
    
    ?>
    Alles anzeigen

    And +1:
    How can i add a weapon to "weponrestrictions" that is not in your list of available weapons?
    Thats how my config is look like:

    Code
    [weaponrestrictions]
    enabled = 1
    weapons = "gl,m79_mp"
    warnstokick = 1
    mode = "tempban"
    kickreason = "Used a restricted weapon: <WEAPON>"

    I'm try to add "thumper" from mw2,but nothing happen if someone uses it :(

    My "weaponrestrictions.php":

    Spoiler anzeigen
    PHP
    <?php
    
    
    
    
    
    
    
    /*
    PLUGIN: Weaponrestrictions
    ================
    Kicks players automatically when they are using a restricted weapon
    
    
    
    
    CONFIG:
    -------
    [weaponrestrictions]
    enabled = 1                                   ;Enable plugin
    weapons = "gl,m79_mp"             ;restricted weapons
    warnstokick = 2                               ;Warns until players get kicked
    mode = "tempban"                              ;kick/ban/tempban
    kickreason = "Used a restricted weapon: <WEAPON>" ;Reason of the kick
    
    
    
    
    
    
    
    NAMESPACE: weaponrestrictions
    
    
    
    
    Functions:
     weaponrestrictions_main
     weaponrestrictions_playerInit
    
    
    
    
    */
    
    
    
    
    $mod->setDefaultCV("weaponrestrictions", "enabled", 0);
    $mod->setDefaultCV("weaponrestrictions", "weapons", "");
    $mod->setDefaultCV("weaponrestrictions", "warnstokick", 2);
    $mod->setDefaultCV("weaponrestrictions", "mode", "tempban");
    $mod->setDefaultCV("weaponrestrictions", "kickreason", "Used a restricted weapon: <WEAPON>");
    
    
    
    
    $mod->registerEvent("playerJoined", "weaponrestrictions_playerInit");
    $mod->registerEvent("playerKill", "weaponrestrictions_main");
    $mod->registerEvent("playerTeamKill", "weaponrestrictions_main");
    
    
    
    
    
    
    
    //Init Players because playerJoined isn't called at startup
    array_map("weaponrestrictions_playerInit", array_keys($players));
    
    
    
    
    function weaponrestrictions_main($parameters) {
    global $mod;
    global $players;
    global $logging;
    list($killer_guid, $victim_guid, $weapon) = $parameters;
    
    
    
    
    if (!$mod->getCV("weaponrestrictions", "enabled")) {
        return;
    }
    
    
    
    
    if ($players[$killer_guid]->isProtected()) {
        return;
    }
    
    
    
    
    $restricted = false;
    $weapons = explode(",", strtolower($mod->getCV("weaponrestrictions", "weapons")));
    
    
    
    
    if ($weapon[1] == "MOD_MELEE") {
        if (in_array("knife", $weapons)) {
            $restricted = true;
        }
        else {
            //Dont warn when player knived while he had a restricted weapon
            return;
        }
    }
    
    
    
    
    else {
        $weapmod = $weapon[0];
    
    
    
    
    foreach ($weapons as $value) {
    if (strpos($weapmod, $value . "_") === 0) {
    $restricted = true;
    break;
    }
    }
    }
    
    
    
    
    if (!$restricted) return;
    
    
    
    
    $players[$killer_guid]->weaponrestrictions_warns ++;
    
    
    
    
    $weaponlong = $mod->getLongWeaponName($weapon);
    
    
    
    
    if ($players[$killer_guid]->weaponrestrictions_warns >= $mod->getCV("weaponrestrictions", "warnstokick")) {
        switch ($mod->getCV("weaponrestrictions", "mode")) {
            case "tempban":
                $players[$killer_guid]->tempBan(str_replace("<WEAPON>", $weaponlong, $mod->getCV("weaponrestrictions", "kickreason")));
                break;
            case "kick":
                $players[$killer_guid]->kick(str_replace("<WEAPON>", $weaponlong, $mod->getCV("weaponrestrictions", "kickreason")));
                break;
            case "ban":
                $players[$killer_guid]->ban(str_replace("<WEAPON>", $weaponlong, $mod->getCV("weaponrestrictions", "kickreason")));
                break;
        }
    }
    else {
    $players[$killer_guid]->say($mod->getLngString("usedRestrictedWeapon", array("<WEAPON>", "<WARNS>", "<MAXWARNS>"), array($weaponlong, $players[$killer_guid]->weaponrestrictions_warns, $mod->getCV("weaponrestrictions", "warnstokick"))));
    $logging->write(MOD_NOTICE, "Player '".$players[$killer_guid]->getName()."' has been warned for using restricted weapon: $weapon, PID: ".$players[$killer_guid]->getPID().", GUID: ".$killer_guid);
    }
    }
    
    
    
    
    function weaponrestrictions_playerInit($guid) {
    $GLOBALS['players'][$guid]->weaponrestrictions_warns = 0;
    }
    
    
    
    
    ?>
    Alles anzeigen


    Thanks for your help!

    2 Mal editiert, zuletzt von highground (26. Februar 2011 um 20:45)

  • Luk
    Profi
    Punkte
    7.415
    Trophäen
    3
    Beiträge
    1.448
    • 27. Februar 2011 um 02:47
    • #2
    Zitat von highground

    And +1:
    How can i add a weapon to "weponrestrictions" that is not in your list of available weapons?

    You can't.

  • jungleGNZ
    Anfänger
    Punkte
    465
    Beiträge
    85
    • 27. Februar 2011 um 06:13
    • #3

    You should really not have your folders for admin or MW2 running through your desktop location. Transfer MW2 to c:\program files\activision\modern warfare 2\, place manu admin here as well.
    The first error check location of path for the file/folder it is intending to locate. Make sure you have the log files in right place.

    Einmal editiert, zuletzt von zacabbey (27. Februar 2011 um 06:14)

  • Dieses Thema enthält 3 weitere Beiträge, die nur für registrierte Benutzer sichtbar sind.
  1. Mitarbeiter
  2. Datenschutzerklärung
  3. Nutzungsbedingungen
  4. Impressum
  5. Kontakt
Community-Software: WoltLab Suite™