请高人指点下这个插件的。人数设置参数是什么。
这个是自动贞测人数,换地图的插件。#include <amxmodx>
#include <amxmisc>
#include <float>
new filepath,curtime=0,staytime=0,curplayers=0,currounds=0
public plugin_init()
{
register_plugin("Empty Server","1.42","twistedeuphoria")
register_cvar("amx_staytime","600")
register_cvar("amx_nmap1","de_dust")
register_cvar("amx_nmap2","de_aztec")
register_cvar("amx_nmap3","de_inferno")
register_cvar("amx_nmap4","de_dust2")
register_cvar("amx_nmap5","de_cbble")
register_cvar("amx_idletime","5")
register_cvar("amx_smartmap","1")
register_logevent("newround",2,"1=Round_Start")
staytime = get_cvar_num("amx_staytime")
set_task(1.0,"timer",0,"curtime",0,"b",1)
new directory
get_datadir(directory,200)
format(filepath,250,"%s/emptyserver.txt",directory)
if(!file_exists(filepath))
{
new writestr
format(writestr,200,"Map - Rounds Played - Total Players")
write_file(filepath,writestr)
}
}
public newround()
{
currounds++
new players, playernum
get_players(players,playernum,"c")
curplayers += playernum
}
public plugin_end()
{
new retstr,p,a,bool:found = false
for(p=1;read_file(filepath,p,retstr,200,a) != 0;p++)
{
new smap,srounds,splayers,curmap
parse(retstr,smap,50,srounds,50,splayers,50)
get_mapname(curmap,50)
if(equali(smap,curmap))
{
new rounds = str_to_num(srounds)
new players = str_to_num(splayers)
rounds += currounds
players += curplayers
num_to_str(rounds,srounds,50)
num_to_str(players,splayers,50)
format(retstr,200,"%s %s %s",smap,srounds,splayers)
write_file(filepath,retstr,p)
found = true
}
}
if(found == false)
{
new players,map,rounds,writestr
get_mapname(map,50)
num_to_str(curplayers,players,50)
num_to_str(currounds,rounds,50)
format(writestr,200,"%s %s %s",map,rounds,players)
write_file(filepath,writestr)
}
}
public timer()
{
if(get_playersnum() == 0)
{
curtime ++
if(curtime >= staytime)
change_maps()
}
else
{
new players,i,noncounted
players = get_playersnum()
for(i=1;i<=get_maxplayers();i++)
{
if((get_user_time(i,1) >= (get_cvar_num("amx_idletime") * 216000)) || is_user_bot(i) || is_user_hltv(i))
{
noncounted++
}
}
if(players == noncounted)
{
curtime++
if(curtime >= staytime)
change_maps()
}
else
curtime = 0
}
return curtime
}
public change_maps()
{
new maps,curmap
get_mapname(curmap,50)
if(get_cvar_num("amx_smartmap") == 1)
{
new Float:curpercent = 0.0
new retstr,p,a
for(new i = 0;i<5;i++)
{
for(p=0;read_file(filepath,p,retstr,200,a) != 0;p++)
{
new sroundstr,splayerstr,smap,roundnum,playernum
parse(retstr,smap,50,sroundstr,50,splayerstr,50)
if(!equali(smap,curmap) && !equali(smap,maps) && !equali(smap,maps) && !equali(smap,maps) && !equali(smap,maps) && !equali(smap,maps))
{
roundnum = str_to_num(sroundstr)
playernum = str_to_num(splayerstr)
new Float:curperc = floatdiv(float(roundnum),float(playernum))
if(curperc > curpercent)
{
curpercent = curperc
copy(maps,50,smap)
}
}
}
curpercent = 0.0
}
}
else
{
get_cvar_string("amx_nmap1",maps,31)
get_cvar_string("amx_nmap2",maps,31)
get_cvar_string("amx_nmap3",maps,31)
get_cvar_string("amx_nmap4",maps,31)
get_cvar_string("amx_nmap5",maps,31)
}
if(strlen(maps) == 0)
get_cvar_string("amx_nmap1",maps,31)
if(strlen(maps) == 0)
get_cvar_string("amx_nmap2",maps,31)
if(strlen(maps) == 0)
get_cvar_string("amx_nmap3",maps,31)
if(strlen(maps) == 0)
get_cvar_string("amx_nmap4",maps,31)
if(strlen(maps) == 0)
get_cvar_string("amx_nmap5",maps,31)
new num = random_num(0,4)
while(equali(maps,curmap) || (strlen(maps) == 0))
{
num = random_num(0,4)
}
server_cmd("changelevel %s",maps)
return PLUGIN_HANDLED
}
回复: 请高人指点下这个插件的。人数设置参数是什么。
顺便补充下。R版主发的那个自动热门投票的插件,不知道为什么1.81AMXX上就使用无效。编译都能通过!希望知道的朋友解决下! 是啊。。。。怎么弄啊 不知道怎么改,
页:
[1]