Here is the kick ban log plugin............
I wanna also add player IP in kickban.log , so help is needed :smile:
PHP
<?php
$logkickbans_filehandle = fopen(LOGDIR . "/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) {
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 BANNED for reason: $reason\n";
}
else {
$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