|
楼主 |
发表于 2009-2-28 16:35:33
|
显示全部楼层
来自 中国–广东–深圳–罗湖区
继续来一个
AMXX.CFG文件中加入:
//需要转到的服务器IP
amx_rd_server "222.83.228.102"
//服务器端口
amx_rd_serverport "27015"
//无登陆密码就留空
amx_rd_serverpw ""
插件开始:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
new msg[128]
public plugin_init() {
register_plugin("NetBar","3.0","A.MI")
register_cvar("amx_netbarip","192.168")
register_cvar("amx_rd_server","x.x.x.x") //要转向的目的服务器.
register_cvar("amx_rd_serverport","27015") //端口
register_cvar("amx_rd_serverpw","") //密码,留空为无密码
register_logevent("round_start", 2, "1=Round_Start")
return PLUGIN_CONTINUE
}
public round_start(){
new players[32],num
get_players( players, num)
for (new i = 0; i < num; i++){
new player = players[i]
if( get_user_frags(player)<=3 ){
if( get_user_frags(player)-get_user_deaths(player) <= -8 )
server_cmd("kick #%d^"请您重新进入并努力杀敌^"", get_user_userid(player))
}
}
return PLUGIN_HANDLED
}
public client_authorized(id){
new userip[17]
new ips[8]
new name[33]
new g_amx_netbarip[8]
get_user_ip(id,userip,16,1)
copy(ips,7,userip)
get_cvar_string("amx_netbarip",g_amx_netbarip,7)
get_user_name(id,name,32)
new rd_serverport = get_cvar_num("amx_rd_serverport")
new rd_server[64], rd_serverpw[32]
get_cvar_string("amx_rd_server",rd_server,63)
get_cvar_string("amx_rd_serverpw",rd_serverpw,31)
new maxplayers = get_maxplayers()
new SZplayer = get_playersnum(1)
if ( (get_user_flags(id)&ADMIN_RESERVATION) || equali(ips,g_amx_netbarip) ){
format( msg,127,"(欢迎会员):%s(%s)",name,userip);
set_hudmessage(0, 255, 255, 0.01, 0.85, 0, 3.0, 4.0, 0.1, 1.0, 8);
show_hudmessage(0, msg);
if( SZplayer >= (maxplayers-1) ){
kickFresh();
}
return PLUGIN_CONTINUE
}
if( SZplayer >= (maxplayers - 1) ){
client_cmd(id,"echo ^"Redirection - Set Password to %s^";password %s",rd_serverpw,rd_serverpw)
client_cmd(id,"echo ^"Redirection - Redirecting to %s:%d^";connect %s:%d",rd_server,rd_serverport,rd_server,rd_serverport)
return PLUGIN_CONTINUE
}
format( msg,127,"(普通玩家):%s(%s)正在连线!",name,userip)
set_hudmessage(248, 248, 255, 0.01, 0.9, 0, 3.0, 4.0, 0.1, 1.0, 8)
show_hudmessage(0, msg)
return PLUGIN_CONTINUE
}
public kickFresh() {
new name[32]
new rd_serverport = get_cvar_num("amx_rd_serverport")
new rd_server[64], rd_serverpw[32]
get_cvar_string("amx_rd_server",rd_server,63)
get_cvar_string("amx_rd_serverpw",rd_serverpw,31)
new players[32],num
get_players( players, num)
for (new i = 0; i < num; i++){
new player = players[i]
if( get_user_frags(player)<=3 ){
if( get_user_frags(player)-get_user_deaths(player) <= -7 && !access(player,ADMIN_RESERVATION)){
get_user_name( player, name , 31 );
format( msg,127,"为了保留会员通道已把 %s 转服!",name);
set_hudmessage(0, 255, 255, 0.6, 0.7, 0, 3.0, 4.0, 0.1, 1.0, 8);
show_hudmessage(0, msg);
client_cmd(player,"echo ^"Redirection - Set Password to %s^";password %s",rd_serverpw,rd_serverpw)
client_cmd(player,"echo ^"Redirection - Redirecting to %s:%d^";connect %s:%d",rd_server,rd_serverport,rd_server,rd_serverport)
return PLUGIN_CONTINUE
}
if( get_user_frags(player)-get_user_deaths(player) <= -6 && !access(player,ADMIN_RESERVATION)){
get_user_name( player, name , 31 );
format( msg,127,"为了保留会员通道已把 %s 转服!",name);
set_hudmessage(0, 255, 255, 0.6, 0.7, 0, 3.0, 4.0, 0.1, 1.0, 8);
show_hudmessage(0, msg);
client_cmd(player,"echo ^"Redirection - Set Password to %s^";password %s",rd_serverpw,rd_serverpw)
client_cmd(player,"echo ^"Redirection - Redirecting to %s:%d^";connect %s:%d",rd_server,rd_serverport,rd_server,rd_serverport)
return PLUGIN_CONTINUE
}
if( get_user_frags(player)-get_user_deaths(player) <= -5 && !access(player,ADMIN_RESERVATION)){
get_user_name( player, name , 31 );
format( msg,127,"为了保留会员通道已把 %s 转服!",name);
set_hudmessage(0, 255, 255, 0.6, 0.7, 0, 3.0, 4.0, 0.1, 1.0, 8);
show_hudmessage(0, msg);
client_cmd(player,"echo ^"Redirection - Set Password to %s^";password %s",rd_serverpw,rd_serverpw)
client_cmd(player,"echo ^"Redirection - Redirecting to %s:%d^";connect %s:%d",rd_server,rd_serverport,rd_server,rd_serverport)
return PLUGIN_CONTINUE
}
if( get_user_frags(player)-get_user_deaths(player) <= -4 && !access(player,ADMIN_RESERVATION)){
get_user_name( player, name , 31 );
format( msg,127,"为了保留会员通道已把 %s 转服!",name);
set_hudmessage(0, 255, 255, 0.6, 0.7, 0, 3.0, 4.0, 0.1, 1.0, 8);
show_hudmessage(0, msg);
client_cmd(player,"echo ^"Redirection - Set Password to %s^";password %s",rd_serverpw,rd_serverpw)
client_cmd(player,"echo ^"Redirection - Redirecting to %s:%d^";connect %s:%d",rd_server,rd_serverport,rd_server,rd_serverport)
return PLUGIN_CONTINUE
}
if( get_user_frags(player)-get_user_deaths(player) <= -3 && !access(player,ADMIN_RESERVATION)){
get_user_name( player, name , 31 );
format( msg,127,"为了保留会员通道已把 %s 转服!",name);
set_hudmessage(0, 255, 255, 0.6, 0.7, 0, 3.0, 4.0, 0.1, 1.0, 8);
show_hudmessage(0, msg);
client_cmd(player,"echo ^"Redirection - Set Password to %s^";password %s",rd_serverpw,rd_serverpw)
client_cmd(player,"echo ^"Redirection - Redirecting to %s:%d^";connect %s:%d",rd_server,rd_serverport,rd_server,rd_serverport)
return PLUGIN_CONTINUE
}
if( get_user_frags(player)-get_user_deaths(player) <= -2 && !access(player,ADMIN_RESERVATION)){
get_user_name( player, name , 31 );
format( msg,127,"为了保留会员通道已把 %s 转服!",name);
set_hudmessage(0, 255, 255, 0.6, 0.7, 0, 3.0, 4.0, 0.1, 1.0, 8);
show_hudmessage(0, msg);
client_cmd(player,"echo ^"Redirection - Set Password to %s^";password %s",rd_serverpw,rd_serverpw)
client_cmd(player,"echo ^"Redirection - Redirecting to %s:%d^";connect %s:%d",rd_server,rd_serverport,rd_server,rd_serverport)
return PLUGIN_CONTINUE
}
if( get_user_frags(player)-get_user_deaths(player) <= -1 && !access(player,ADMIN_RESERVATION)){
get_user_name( player, name , 31 );
format( msg,127,"为了保留会员通道已把 %s 转服!",name);
set_hudmessage(0, 255, 255, 0.6, 0.7, 0, 3.0, 4.0, 0.1, 1.0, 8);
show_hudmessage(0, msg);
client_cmd(player,"echo ^"Redirection - Set Password to %s^";password %s",rd_serverpw,rd_serverpw)
client_cmd(player,"echo ^"Redirection - Redirecting to %s:%d^";connect %s:%d",rd_server,rd_serverport,rd_server,rd_serverport)
return PLUGIN_CONTINUE
}
}
}
return PLUGIN_CONTINUE
} |
|