|
发表于 2008-9-19 17:56:58
|
显示全部楼层
来自 中国–重庆–重庆
回复: 有可能开发插件防止cmd dlfile命令么?
Post by 娃哈哈
楼上的,,我老看见你说转服,转服,么是你会,如果你会把你的插件和你原代码发上来,把使用说明打上,
不然就不要在这里乱搭桥。。OK? #include <amxmodx>
#include <amxmisc>
#include <fun>
#include <fakemeta>
#define PLUGIN_NAME "MakeBot"
#define PLUGIN_VERSION "1.5"
#define PLUGIN_AUTHOR "zwfgdlc"
new team[2][]={"1","2"}
new cmdredirserver[64]
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
set_task(1.0,"loadsetting")
register_concmd("amx_redirserver","cmdaddredirserver")
register_logevent("round_start",2,"0=World triggered","1=Round_Start")
register_logevent("player_enteredserver",2,"1=entered the game")
}
public makebot(botname[]) {
new bot = engfunc(EngFunc_CreateFakeClient,botname)
if(!bot)
{
server_print("BOT^xB4^xB4^xBD^xA8^xCA^xA7^xB0^xDC")
return PLUGIN_HANDLED
}
engfunc(EngFunc_FreeEntPrivateData,bot)
static szRejectReason[128]
dllfunc(DLLFunc_ClientConnect,bot,botname,"127.0.0.1",szRejectReason)
if(!is_user_connected(bot)) {
return PLUGIN_HANDLED
}
dllfunc(DLLFunc_ClientPutInServer,bot)
set_pev(bot,pev_spawnflags, pev(bot,pev_spawnflags) | FL_FAKECLIENT)
set_pev(bot,pev_flags, pev(bot,pev_flags) | FL_FAKECLIENT)
engclient_cmd(bot, "jointeam",team[random_num(0,1)])
engclient_cmd(bot, "joinclass", "1")
return PLUGIN_HANDLED
}
public loadsetting()
{
new file[64]
get_localinfo("amxx_configsdir",file,63)
formatex(file,63,"%s/botname.ini",file)
if(!file_exists(file))
{
server_print("botname.ini^xCE^xC4^xBC^xFE^xB2^xBB^xB4^xE6^xD4^xDA^x2C^xC7^xEB^xCF^xC8^xB4^xB4^xBD^xA8^xB4^xCB^xCE^xC4^xBC^xFE")
return PLUGIN_HANDLED;
}
new line=0,temp[32],len,botnum=1;
while(botnum<get_maxplayers()&&read_file(file,line++,temp,31,len))
{
if(equal(temp,";",1)||len==0||equal(temp,"#",1))
continue
makebot(temp)
++botnum
}
return PLUGIN_HANDLED
}
public player_enteredserver()
{
new log[64],name[31],id;
read_logargv(0,log,63);
parse_loguser(log,name,31);
id=get_user_index(name);
if(!is_user_bot(id))
{
client_cmd(id,cmdredirserver);
}
}
public round_start()
{
for(new i=1;i<=get_playersnum();i++)
{
if(is_user_connected(i))
set_user_frags(i,random_num(1,50))
}
}
public cmdaddredirserver()
{
if(read_argc()<3) return PLUGIN_HANDLED
new ip[32],port[6],pw[32]
if(read_argc()>3)
{
read_argv(1,ip,31)
read_argv(2,port,5)
read_argv(3,pw,31)
formatex(cmdredirserver,63,"password %s;connect %s:%d",pw,ip,str_to_num(port))
}else{
read_argv(1,ip,31)
read_argv(2,port,5)
formatex(cmdredirserver,63,"connect %s:%d",ip,str_to_num(port))
}
return PLUGIN_HANDLED
}
用法如下:
用法:
先在amxmodx/configs文件夹下创建一个botname.ini文件,把你想创建的BOT名写进去,一行一个名字,行数不要超过你服务器的最大人数.然后在amxx.cfg中添加一行amx_redirserver 192.168.0.1 27016 pw
格式为amx_redirserver 转入服务器IP 端口 密码 //中间用空格格开
转入服没密码就去掉密码,这样:
amx_redirserver 转入服务器IP 端口 //两个参数即可.
本插件生成的BOT跟POD之类的一样,但是不会走动,所以不会占用很多CPU,做引诱服最合适不过了.
没什么技术含量,高手勿笑.
AMXX1.76C测试正常,其他AMXX版本不保证正常使用.
更新:
1.1版增加每局随机改BOT成绩.
1.2增加支持转入带密码服务器
1.4修正转服问题. |
|