tides
发表于 2009-9-8 21:59:11
本帖最后由 tides 于 2009-9-12 10:04 编辑
更新都放在首页
银闪闪
发表于 2009-9-8 22:20:27
插件都弄好了?为什么会打开插件后会出现错误呢?
用AMXMODMENU的暂停插件看 插件错误?
这是怎么回事?
wan482
发表于 2009-9-9 18:23:14
:D
把这帖子置顶啊
插件都是精品
tides
发表于 2009-9-12 10:03:00
10# 071284
以前更新都放在首页
shuyeshuye
发表于 2009-9-14 17:47:00
没有截图,还不知道是什么样的效果呢!
银闪闪
发表于 2009-9-16 14:29:35
请问楼主怎样把名字限制太长的从源码去掉?不要这功能! 谢谢楼主帮帮忙,跪求办法了,我不会改源码
/*
参数:
amx_reservation "1" //预留的通道数,没有权限的玩家进入此通道时会被kick
PreferenceIp "192.168" //优先IP,不包含端口号,默认内网
KickOption1 "" //筛选方式 1=PING最高者 2=得分最低者
KickOption1 "" //驱逐方式 1=踢出 2=转服
TargetIp "61.145.73.138:27016"//转服目标,必须包含端口号
amx_name_len "25"// 限制名字长度
*/
#include <amxmodx>
#include <csx>
#define PLUGIN_NAME "VIP内网优先"
#define PLUGIN_VERSION "0.1beta"
#define PLUGIN_AUTHOR "******"
new MemberPrivilege
new showple
new maxplayers
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
register_cvar("amx_reservation","1")//预留的通道数,没有权限的玩家进入此通道时会被kick
register_cvar("PreferenceIp","192.168")//优先IP,不包含端口号,默认内网
register_cvar("KickOption1","1")//筛选方式 1=PING最高者 2=负数王
register_cvar("KickOption2","2")//驱逐方式 1=踢出 2=转服
register_cvar("TargetIp","61.145.73.138:27016")//转服目标,必须包含端口号
register_cvar( "amx_name_len", "25")// 限制名字长度
register_cvar( "amx_MaxPing", "80")
register_cvar( "amx_MixPing", "30")
maxplayers = get_maxplayers()
}
public client_authorized(id)//(1)判断进服者
{
new name
new msg
get_user_name(id,name,32)
new ip1
new ip2
get_user_ip(id,ip1,15,1)
copy(ip2,7,ip1)
new barip
get_cvar_string("PreferenceIp",barip,7)
if(get_user_flags(id) & ADMIN_RESERVATION || equal(ip2,barip)){
MemberPrivilege=1
if(get_user_flags(id) & ADMIN_RESERVATION && showple == 0)
format(msg,sizeof msg - 1,"^x01【^x03VIP*^x01】^x04 %s ^x03[^x01%s^x03] ^x01正在进入...",name,ip1)
else if(showple == 0)
format(msg,sizeof msg - 1,"^x01【^x03贵宾^x01】^x04 %s ^x03[^x01%s^x03] ^x01正在进入...",name,ip1)
}
else{
MemberPrivilege=0
if(showple == 0){
format(msg,sizeof msg - 1,"^x01【^x03玩家^x01】^x04 %s ^x03[^x01%s^x03] ^x01正在连接...",name,ip1)
showple = 1
new param
param = id
set_task(5.0, "showpp", 77777+id, param, 1)
}
}
client_color(0, id, msg)
new players = get_playersnum(1) //统计人数 ,连正在连接的也算
new limit = maxplayers - get_cvar_num("amx_reservation")//服最大人数 减去预留人数
if(strlen(name) > get_cvar_num("amx_name_len")){
server_cmd( "kick #%d 名称太长!本服限名称不得长于%d位字符", get_user_userid(id), get_cvar_num("amx_name_len"))
}
else if(players>limit){
if(MemberPrivilege==1)
kickWho()
else{
new IdPing,IdLose
get_user_ping(id,IdPing,IdLose)
if(IdPing < get_cvar_num("amx_MixPing")){
new worstping,ping,lose,target
for(new i=1;i<=get_playersnum();i=i+1){
if(MemberPrivilege==0 && is_user_connected(i)){
get_user_ping(i,ping,lose)
if (ping>worstping){
target=i
worstping=ping
}
}
}
if(ping > get_cvar_num("amx_MaxPing")){
new tarname
get_user_name(target,tarname,32)
new PingKick
format(PingKick,sizeof PingKick - 1,"^x01玩家^x03%s^x01因为Ping高于^x04%s^x01,而被外网玩家^x03%s^x04(Ping<%s)^x01挤出去",tarname,get_cvar_num("amx_MaxPing"),name,get_cvar_num("amx_MixPing"))
client_color(0, target, msg)
server_cmd("kick #%d 因为你的PING高于%s,被其他玩家挤了出来", get_user_userid(target),get_cvar_num("amx_MaxPing"))
}
else
kick(id,"")
}
else
kick(id,"")
}
}
}
public kickWho()//(2)选取被踢或被转服的人
{
new TargetId
new WhyKick
switch (get_cvar_num("KickOption1"))
{//筛选方式
case 1:
{//PING最高
new worstping,ping,lose,target
for (new i=1;i<=get_playersnum();i=i+1)
{
if (MemberPrivilege==0 && is_user_connected(i))
{
get_user_ping(i,ping,lose)
if (ping>worstping)
{
target=i
worstping=ping
}
}
}
TargetId=target
format(WhyKick,sizeof WhyKick - 1,"^x03PING最高:^x04%d",worstping)
}
case 2:
{//负数王
new worstfrag,frag,target
worstfrag = 80
for (new i=1;i<=get_playersnum();i=i+1)
{
if (MemberPrivilege==0 && is_user_connected(i))
{
frag = get_user_frags(i) - get_user_deaths(i)
if (frag<worstfrag)
{
target=i
worstfrag=frag
}
}
}
TargetId=target
format(WhyKick,sizeof WhyKick - 1,"^x03是负分王:^x04得分 %d",worstfrag)
}
}
kick(TargetId,WhyKick)
}
//(3)踢人或转服
public kick(id,reasonMsg[]){
new name
new msg
new ip
get_cvar_string("TargetIp",ip,22)
get_user_name(id,name,32)
switch (get_cvar_num("KickOption2"))
{//驱逐方式
case 1:
{//踢出
if(strlen(reasonMsg) > 0){
format(msg,sizeof msg - 1,"^x04【^x03预留通道^x04】^x01为保留预留通道^x03 %s ^x01被踢出^x04::^x01因为他%s",name,reasonMsg)
client_color(0, id, msg)
server_cmd("kick #%d 不好意思啦!预留通道将你请出:因为你%s", get_user_userid(id),reasonMsg)
}
else{
client_print(0, print_console,"【预留通道】 %s 进入时被踢",name)
server_cmd("kick #%d 不好意思啦!你不能用预留通道进入", get_user_userid(id))
}
}
case 2:
{//转服
format(msg,sizeof msg - 1,"^x04【^x03通道转服^x04】^x01:为保留预留通道^x03 %s ^x01被转向^x04[^x03%s^x04]^x03::^x01因为他%s",name,ip,reasonMsg)
if(strlen(reasonMsg) > 0)
client_color(0, id, msg)
else
client_print(0, print_console,"【通道转服】 %s 进入时被转向[%s]",name,ip)
client_cmd(id,"connect %s",ip)
}
}
}
//(4)当玩家改名时重新判断
public client_infochanged(id){
new newname, oldname
get_user_info( id, "name", newname, 31)
get_user_name( id, oldname, 31)
if (!equal( oldname, newname)){
new param
param = id
set_task(1.0, "changedname", 1354+id, param, 1)
}
}
public changedname(param[]){
new id = param
client_authorized(id)
}
public showpp(param[]){
new id = param
showple = 0
}
public client_color(playerid, colorid, msg[])
{
message_begin(playerid?MSG_ONE:MSG_ALL,get_user_msgid("SayText"),_,playerid)
write_byte(colorid)
write_string(msg)
message_end()
client_print(playerid, print_console,msg)
}
tides
发表于 2009-9-16 22:05:28
本帖最后由 tides 于 2009-9-16 22:52 编辑
更新版,而且去掉了名字长不得进
不过未测试
银闪闪
发表于 2009-9-17 16:34:35
谢谢了大哥
请问能不能加个负数被提后,出现提示?比如:
kicked: 不好意思,因为你得分太低,被VIP自动挤了出来!
tides
发表于 2009-9-18 00:48:40
傻傻的,源码看一下好不好,提示都是很全的,而且不刷屏的,自己看看好再说//(3)踢人或转服
public kick(id,reasonMsg[]){
new name
new msg
new ip
get_cvar_string("TargetIp",ip,22)
get_user_name(id,name,32)
switch (get_cvar_num("KickOption2"))
{//驱逐方式
case 1://踢出
{
if(strlen(reasonMsg) > 0){
format(msg,sizeof msg - 1,"^x04〖^x03预留通道^x04〗^x03 %s ^x01被踢出^x04‖^x01原因%s",name,reasonMsg)
client_color(0, id, msg)
server_cmd("kick #%d 〖预留通道〗你被踢出^n原因%s", get_user_userid(id),reasonMsg)
}
else
server_cmd("kick #%d 〖预留通道〗你无法进入", get_user_userid(id))
}
case 2://转服
{
format(msg,sizeof msg - 1,"^x04〖^x03通道转服^x04〗^x03 %s ^x01被转向^x04[^x03%s^x04]^x03‖^x01原因%s",name,ip,reasonMsg)
if(strlen(reasonMsg) > 0)
client_color(0, id, msg)
client_cmd(id,"connect %s",ip)
}
}
}
tides
发表于 2009-9-22 23:09:10
效果图已经搞上来了
页:
1
2
3
4
[5]
6
7
8
9
10
11