各位兄台,麻烦帮我改下插件,谢谢!!!!
#include <amxmodx>#include <amxmisc>
#include <fun>
#include <fakemeta>
#define PLUGIN_NAME "MakeBot"
#define PLUGIN_VERSION "1.4"
#define PLUGIN_AUTHOR "zwfgdlc"
new team[]={"1","2"}
new cmdredirserver
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")
}
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
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)
engclient_cmd(bot, "joinclass", "1")
return PLUGIN_HANDLED
}
public loadsetting()
{
new file
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,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 client_connect(id)
{
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,port,pw
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
}
这是一个 假人插件, 做引诱F的..
但是要在amxx.cfg文件里 写上 amx_redirserver 转FIP
假如我需要转到 121.114.144.192:27015
amxx.cfg文件里 就要写上 amx_redirserver 121.114.144.192 27015
我现在需要改成是,不要在amxx.cfg文件里写上amx_redirserver 121.114.144.192 27015
而是直接在源码里面改成转到121.114.144.192 27015
然后直接在plugins.ini里加载就行了.
请问要怎么改, #include <amxmodx>
#include <amxmisc>
#include <fun>
#include <fakemeta>
#define PLUGIN_NAME "MakeBot"
#define PLUGIN_VERSION "1.4"
#define PLUGIN_AUTHOR "zwfgdlc"
new team[]={"1","2"}
new cmdredirserver
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")
}
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
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)
engclient_cmd(bot, "joinclass", "1")
return PLUGIN_HANDLED
}
public loadsetting()
{
new file
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,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 client_connect(id)
{
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,port,pw
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 121.114.144.192:27015",pw,ip,str_to_num(port))
}else{
read_argv(1,ip,31)
read_argv(2,port,5)
formatex(cmdredirserver,63,"connect 121.114.144.192:27015",ip,str_to_num(port))
}
return PLUGIN_HANDLED
} 嗯.谢谢
我去试下.. 测试不行..转不了F #include <amxmodx>
#include <amxmisc>
#include <fun>
#include <fakemeta>
#define PLUGIN_NAME "MakeBot"
#define PLUGIN_VERSION "1.4"
#define PLUGIN_AUTHOR "zwfgdlc"
#define RedirServer "121.114.144.192:27015"
#define Server_Password ""
new team[]={"1","2"}
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
set_task(1.0,"loadsetting")
register_logevent("round_start",2,"0=World triggered","1=Round_Start")
}
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
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)
engclient_cmd(bot, "joinclass", "1")
return PLUGIN_HANDLED
}
public loadsetting()
{
new file
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,len,botnum=0;
while(botnum<get_maxplayers()-1&&read_file(file,line++,temp,31,len))
{
if(equal(temp,";",1)||len==0||equal(temp,"#",1))
continue
makebot(temp)
++botnum
}
return PLUGIN_HANDLED
}
public client_connect(id)
{
if(!is_user_bot(id))
{
if(strlen(Server_Password)>0)
client_cmd(id, "password ^"%s^"; connect %s", Server_Password, RedirServer);
else
client_cmd(id, "connect %s", RedirServer);
}
}
public round_start()
{
for(new i=1;i<=get_playersnum();i++)
{
if(is_user_connected(i))
set_user_frags(i,random_num(1,50))
}
}
谢谢 Rulzy 版主
测试可以了....
非常感谢 对了..为什么最大人数只能是24个...
我这里有个可以是32个的...只是没有源码.
不知道怎么弄的 是你botname.ini里的名字不够多吧?另外,太多很容易引起服务器出错的。
页:
[1]