|
楼主 |
发表于 2004-8-7 21:39:20
|
显示全部楼层
来自 中国–浙江–宁波–余姚市
源码
+++++++++++++++++++++++++++++++++++++++++++
/* AMX Mod script.
*
* 当服务器人满时,在换下一幅地图前一分钟KICK掉打的最
* 差(frags - deaths)的两个player.
*
* (c) 2003, .o0
*
* This file is provided as is (no warranties).
*
*/
#include <amxmod>
#define maxnum 20
new g_logFile[] = "AutoKick.log"
public AutoKickWorstPlayer() {
new username[maxnum][20]
new grade[maxnum] = {0, ...}
new userid[maxnum] = {0, ...}
new i, tmp, strtmp[20]
new players[32], inum
get_players(players,inum)
if ( get_playersnum() >= maxnum ) {
for ( i = 0; i < maxnum; i++ ) {
grade = get_user_frags(players) - get_user_deaths(players)
get_user_name(players, username,20)
userid = get_user_userid(players)
}
for ( i = 1; i < maxnum; i++) {
if ( grade[0] > grade ) {
tmp = grade[0]
grade[0] = grade
grade = tmp
strtmp = username[0]
username[0] = username
username = strtmp
tmp = userid[0]
userid[0] = userid
userid = tmp
tmp = players[0]
players[0] = players
players = tmp
}
}
for (i = 2; i < maxnum; i++) {
if ( grade[1] > grade ) {
tmp = grade[1]
grade[1] = grade
grade = tmp
strtmp = username[1]
username[1] = username
username = strtmp
tmp = userid[1]
userid[1] = userid
userid = tmp
tmp = players[1]
players[1] = players
players = tmp
}
}
client_print(0,print_chat,"^"%s^" , ^"%s^" are too bad and will be auto kicked!", username[0],username[1])
client_print(0,print_chat,"^"%s^" , ^"%s^" are too bad and will be auto kicked!", username[0],username[1])
client_cmd(players[0],"echo u are too bad and auto kicked by server !")
client_cmd(players[0],"echo u are too bad and auto kicked by server !")
log_to_file(g_logFile," ^"%s^" is kicked , frags = %d , deaths = %d , C = %d",username[0],get_user_frags(players[0]),get_user_deaths(players[0]),grade[0])
server_cmd("kick #%d", userid[0])
client_cmd(players[1],"echo u are too bad and auto kicked by server !")
client_cmd(players[1],"echo u are too bad and auto kicked by server !")
log_to_file(g_logFile," ^"%s^" is kicked , frags = %d , deaths = %d , C = %d",username[1],get_user_frags(players[1]),get_user_deaths(players[1]),grade[1])
server_cmd("kick #%d", userid[1])
}
else if ( inum > 0 ) {
log_to_file(g_logFile," Total : %d players",inum)
}
}
public plugin_init(){
register_plugin("Kick The Worst", "0.2", ".o0")
set_task(30.0,"AutoKickWorstPlayer", 0, "", 0, "d")
return PLUGIN_CONTINUE
}
两行E文自己动手一下吧 :] 我还在测试。。。 |
|