|
发表于 2006-11-16 10:40:41
|
显示全部楼层
|阅读模式
来自 中国–山东–烟台
AMXX 1.60编译时出现:
slots.sma(1) : error 010: invalid function or declaration
1 Error.
Could not locate output file slots.amx (compile failed).
/* AMX Mod X script.
*
* (c) 2006, OLO
* This file is provided as is (no warranties).
*
* Set you server max_players to 1 above the desirered value (ie. 21 or 33).
* Query programs will see max_players -1 as max. Admins with reservation
* can connect when there is 20/20 and player with worst ping or least play time
* will be kicked.
*
* 如果OP通道插件未启用,本插件奖自动设置amx_reservation为 1 ,即保留一个通道。
*
* 使用方法:
*
* 在amxx.cfg里加入
* amx_kickmode <参数>
* 参数为 <1> 或者 <2> 。
*
* 1 表示 - 当服务器人满时,有OP或者VIP登陆时则踢掉一个在线时间最短的玩家。
* 2 表示 - 当服务器人满时,有OP或者VIP登陆时则踢掉一个ping值最高的玩家。
*
* 内网IP地址设置方法:
* amx_netbarip "IP地址的前面7位"
* 例: amx_netbarip "192.168"
*
* IP联盟地址设置方法:
* amx_netbarip1 "IP地址"
* amx_netbarip2 "IP地址"
* amx_netbarip3 "IP地址"
* amx_netbarip4 "IP地址"
* amx_netbarip5 "IP地址"
* 例:
* amx_netbarip1 "192.168.0.1"
* amx_netbarip2 "222.218.124.96"
* amx_netbarip3 "125.83.0.45"
* amx_netbarip4 "221.127.245.22"
* amx_netbarip5 "222.83.176.68"
*
*
*/
#include <amxmodx>
#include <amxmisc>
public plugin_init()
{
register_plugin("Slots Reservation","1.0","KuaiLn")
register_cvar("amx_kickmode","2")
register_cvar("amx_reservation","1")
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 ) //21/20
{
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 被踢出以空出ViP预留通道^"" ,name )
}
return PLUGIN_CONTINUE
}
if ( is_user_bot(id) )
server_cmd("kick #%d ^"您无权进入ViP通道.购买请联系QQ^"", get_user_userid(id) )
else
server_cmd("kick #%d ^"您无权进入ViP通道.购买请联系QQ^"", get_user_userid(id) )
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
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 ^"ViP会员进入预留通道,服务器自动踢出在线时间最短者!请稍后再进入^"", get_user_userid(who) )
else
server_cmd("kick #%d ^"ViP会员进入预留通道,服务器自动踢出在线时间最短者!请稍后再进入^"", get_user_userid(who) )
return who
}
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 ^"ViP会员进入预留通道,服务器自动踢出高ping者!请稍后再进入^"" , get_user_userid(who) )
else
server_cmd("kick #%d ^"ViP会员进入预留通道,服务器自动踢出高ping者!请稍后再进入^"" , get_user_userid(who) )
return who
} |
|