All Data Structures Namespaces Files Functions Variables Pages
antiAFKmng.php
Go to the documentation of this file.
<?php
if(!defined('IN_ADMIN')) {
exit('Access Denied');
}
require_once GAME_ROOT.'./include/system.func.php';
$antiAFKintv = 3;
if($command == 'kill'){
kill_all_AFKer($timelimit);
}
function kill_all_AFKer($timelimit=1){
global $now,$db,$tablepre,$antiAFKertime,$alivenum,$deathnum,$antiAFKintv,$cmd_info;
$cmd_info = '';
if (!is_numeric($timelimit)){
$cmd_info .= '时间间隔错误！<br>';
return;
} elseif($timelimit < $antiAFKintv) {
$cmd_info .= '时间间隔太短，可能波及正常玩家。';
return;
}
$cmd_info .= '将杀死： '.$timelimit.' 分钟内没有任何行动的玩家。<br>';
$timelimit *= 60;
$deadline=$now-$timelimit;
$result = $db->query("SELECT * FROM {$tablepre}players WHERE type=0 AND endtime < '$deadline' AND hp>'0' AND state<'10'");
while($al = $db->fetch_array($result)) {
$afkerlist[$al['pid']]=Array('name' => $al['name'] ,'pls' => $al['pls']);
}
if(!$afkerlist){$cmd_info .= '没有符合条件的角色。';return;}
foreach($afkerlist as $kid => $kcontent){
$db->query("UPDATE {$tablepre}players SET hp='0',state='32' WHERE pid='$kid' AND type='0' AND hp>'0' AND state<'10'");
if($db->affected_rows()){
adminlog('killafker',$kid);
$cmd_info .= '角色 '.$kcontent['name'].' 被杀死。<br>';
addnews($now,'death32',$kcontent['name'],'',$kcontent['pls']);
$alivenum--;
$deathnum++;
} else {
$cmd_info .= '无法杀死角色 '.$kcontent['name'].' 。<br>';
}
}
save_gameinfo();
return;
}
//kill_all_AFKer(10);
echo <<<EOT
<form method="post" name="antiAFKmng" onsubmit="admin.php">
<input type="hidden" name="mode" value="antiAFKmng">
<input type="hidden" name="command" value="kill">
杀死<input type="text" name="timelimit" value="$antiAFKintv" size="4" maxlength="4">分钟内没有行动的玩家。<br>
<input type="submit" value="挂机党都去死吧！"><br>
</form>
EOT;
?>
$cmd_info
while($gm=$db->fetch_array($result)) $cmd_info
Definition: gmlist.php:10
$tablepre
$tablepre
Definition: config.inc.php:58
kill_all_AFKer
if($command== 'kill') kill_all_AFKer($timelimit=1)
Definition: antiAFKmng.php:12
addnews
addnews($t=0, $n= '', $a='', $b='', $c= '', $d= '', $e= '')
Definition: global.func.php:228
$antiAFKertime
$antiAFKertime
Definition: gamecfg_1.php:24
$db
$db
Definition: clear.php:32
$deathnum
$deathnum
Definition: gameinfo.php:15
elseif
【生存者数：<?php echo $alivenum?> 人】< input type="button"value="显示全部幸存者"onClick="$('alivemode').value='all';$('gbmode').value='none';postCmd('alive','alive.php');"></p > if($gamblingon &&$gamestate >=20) elseif($gamblingon &&$gamestate<=10)
Definition: 1_alive.tpl.php:18
GAME_ROOT
const GAME_ROOT
Definition: clear.php:6
$alivenum
$alivenum
Definition: gameinfo.php:14
$now
$now
Definition: clear.php:23
value
value
Definition: 1_alive.tpl.php:10
$antiAFKintv
$antiAFKintv
Definition: antiAFKmng.php:7
$result
if(!$cuser||!$cpass) $result
Definition: admin.php:25
adminlog
adminlog($op, $an1='', $an2='', $an3='')
Definition: admin.php:58
save_gameinfo
save_gameinfo()
Definition: global.func.php:304