搜索
查看: 2147|回复: 0

谁能帮这个忙,........十分感谢.......

[复制链接]
发表于 2008-6-21 00:01:32 | 显示全部楼层 |阅读模式 来自 中国–广西–百色
这个原码俺想修改成:

1.会员进服踢出"得分最差的玩家"即可

2.请帮精减最短的代码....那些踢PING高的不留..因为踢高PING的插件已有.

我做了一个下午不成功.....希望有人援手...............

#include <amxmodx>
#include <amxmisc>

public plugin_init()
{
register_plugin("Slots Reservation","1.0","KuaiLn")
register_cvar("amx_kickmode","1")
register_cvar("amx_reservation","2")
register_cvar("amx_netbarip","192.168")
register_cvar("amx_netbarip1","192.168.0.1")
register_cvar("amx_netbarip2","192.168.0.2")
register_cvar("amx_netbarip3","192.168.0.3")
register_cvar("amx_netbarip4","192.168.0.4")
register_cvar("amx_netbarip5","192.168.0.5")

}
public client_authorized(id) {
new userip[17]
new ips[8]
new ips2[16]
new name[33]
new g_amx_netbarip[8]
new g_amx_netbarip1[16]
new g_amx_netbarip2[16]
new g_amx_netbarip3[16]
new g_amx_netbarip4[16]
new g_amx_netbarip5[16]
get_user_ip(id,userip,16,1)
copy(ips,7,userip)
copy(ips2,16,userip)
get_cvar_string("amx_netbarip",g_amx_netbarip,7)
get_cvar_string("amx_netbarip1",g_amx_netbarip1,16)
get_cvar_string("amx_netbarip2",g_amx_netbarip2,16)
get_cvar_string("amx_netbarip3",g_amx_netbarip3,16)
get_cvar_string("amx_netbarip4",g_amx_netbarip4,16)
get_cvar_string("amx_netbarip5",g_amx_netbarip5,16)
get_user_name(id,name,32)
new maxplayers = get_maxplayers()
new players = get_playersnum( 1 )
new limit = maxplayers - get_cvar_num("amx_reservation")
new resType = get_cvar_num( "amx_kickmode" )
new who
if ( players > limit ){
if ( get_user_flags(id) & ADMIN_RESERVATION || (equali(ips,g_amx_netbarip)) || (equali(ips2,g_amx_netbarip1)) || (equali(ips2,g_amx_netbarip2)) || (equali(ips2,g_amx_netbarip3)) || (equali(ips2,g_amx_netbarip4)) || (equali(ips2,g_amx_netbarip5))){
set_user_flags(id,read_flags("b"))
switch(resType){

case 1:
who = kickFresh()

case 2:
who = kickLag()
}
if(who){
//new name[32]
get_user_name( who, name , 31 )
client_cmd(id,"echo ^"* %s was kicked to free this slot^"" ,name )
}
return PLUGIN_CONTINUE
}

if ( is_user_bot(id) )
server_cmd("kick #%d 服务器人满! 请稍后再进入。", get_user_userid(id) )
else
server_cmd("kick #%d 服务器人满! 请稍后再进入。", get_user_userid(id) )
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}

kickLag() {
new who = 0, ping, loss, worst = -1
new maxplayers = get_maxplayers()
for(new i = 1; i <= maxplayers; ++i) {
if ( !is_user_connected(i) && !is_user_connecting(i) )
continue // not used slot
if (get_user_flags(i)&ADMIN_RESERVATION)
continue // has reservation, skip him
get_user_ping(i,ping,loss) // get ping
if ( ping > worst ) {
worst = ping
who = i
}
}
if(who)
if ( is_user_bot(who) )
server_cmd("kick #%d [OP通道] 服务器踢高ping! 请稍后再进入。" , get_user_userid(who) )
else
server_cmd("kick #%d [OP通道] 服务器踢高ping! 请稍后再进入。" , get_user_userid(who) )
return who
}
kickFresh() {
new who = 0, itime, shortest = 0x7fffffff
new maxplayers = get_maxplayers()
for(new i = 1; i <= maxplayers; ++i){
if ( !is_user_connected(i) && !is_user_connecting(i) )
continue // not used slot
if (get_user_flags(i)&ADMIN_RESERVATION)
continue // has reservation, skip him
itime = get_user_time(i) // get user playing time with connection duration
if ( shortest > itime ) {
shortest = itime
who = i
}
}
if(who)
if ( is_user_bot(who) )
server_cmd("kick #%d [OP通道] 服务器预留OP通道! 请稍后再进入。", get_user_userid(who) )
else
server_cmd("kick #%d [OP通道] 服务器预留OP通道! 请稍后再进入。", get_user_userid(who) )
return who
}
游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表