/********************************************************************************
******
*
* ***************************************************
* * Ported to AMXX by: Goshik 19.04.2006 *
* * Requested by: CFN|LordSoth *
* ***************************************************
*
* [AMX] FakeFull
* version 1.6a Date: 05/12/2004
* Author: Freecode
*
* Based on OLO's FakeFull metamod plugin. Fake clients
* connect to the server when its empty. Everytime someone
* joins and there is no more spots left for another person
* one fake client is removed. When the server is empty
* and [AMX] FakeFull is on Automatic mode it will add
* a fake client. Once the # of fake clients and real players
* equals to amx_ff_players it will stop.
*
* You need to enable VexdUM.
*
* Commands:
*
* amx_ff_players <#> - Minimal number of fake and real clients on the server.
* REQUIRED for Automatic mode.
*
* amx_ff_delay <#> - Delay between each fake client joins/leaves.
* REQUIRED for Automatic mode and regular bot add.
*
* amx_add_bot <#> - Add # of bots.
*
* amx_remove_bot <#> - Remove # of bots.
*
* amx_fakefull <1 = ON || 0 = OFF> - Turns Automatic mode on.
* amx_ff_players must be set higher then 0.
*
*
* Setup for Automatic Mode:
*
* Set amx_ff_players to the number of fake clients you want in server at max.
* Turn on amx_fakefull.
*
* Changelog
* 1.5 : Custom names and reading names from botnames.cfg
* 1.6 : Updated to VexdUM v1.0.0 by KRoTaL (Thanks T(+)rget)
* Path of the botnames.cfg file changed to addons/amx/config/botnames.cfg
* 1.6a : Added fake scores for the bots
*
********************************************************************************
*********/
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <Vexd_Utilities>
new const Plugin[] = "[AMX] FakeFull"
new const Version[] = "1.6a"
new const Author[] = "-=[DRUGZ]=-Freecode/AssKicR"
#define MAX_NAMES 32
// Bots' scores will be random numbers chosen between MIN_FRAGS and MAX_FRAGS
#define MIN_FRAGS 1
#define MAX_FRAGS 15
new g_botnamesfile[64]
new bool:botCreated = false
new bool:botKicked = false
new bool:is_user_ffbot[33]
new botcount = 0
new namesToUse[MAX_NAMES][64] =
{
"[F]Freecode",
"[F]AssKicR",
"[F]T(+)rget",
"[F]Ludwig van",
"[F]OLO",
"[F]dJeyL",
"[F]Scarzzurs",
"[F]XAD",
"[F]SpaceDude",
"[F]f117bomb",
"[F]{HOJ} Batman",
"[F]jghg",
"[F]W`CBludy",
"[F]SniperBeamer",
"[F]Manip",
"[F]Calzinger",
"[F]Sly|Neo",
"[F]Dygear",
"[F]VexD",
"[F]HnyBear",
"[F]RaK",
"[F]IceMouse",
"[F]ArtAttack",
"[F]G-[U]nit",
"[F]SirFragalot",
"[F]50Cent",
"[F]Eminem",
"[F]KRoT@L",
"[F]CEO",
"[F]Sony",
"[F]BabyBoy",
"[F]RollOrDie"
}
public plugin_init()
{
register_plugin(Plugin,Version,Author)
register_cvar("amx_ff_players","1")
register_cvar("amx_ff_delay","1")
register_concmd("amx_add_bot","botadd",ADMIN_BAN,"- #")
register_concmd("amx_remove_bot","botremove",ADMIN_BAN,"- #")
register_cvar("amx_fakefull","0")
set_task(1.0,"ServerStatus",44444,"",0,"b")
write_file("$basedir/config/botnames.cfg", g_botnamesfile, 63)
ReadNames()
}
public botadd(id, level, cid)
{
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
new arg[32]
read_argv(1,arg,31)
new botNum = str_to_num(arg)
if(botNum > 0 && botNum < get_maxplayers())
set_task(float(get_cvar_num("amx_ff_delay")),"manBotAdd",0,"",0,"a",botNum)
else
console_print(id,"amx_add_bot # - Will add # bots.")
return PLUGIN_HANDLED
}
public botremove(id, level, cid)
{
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
new arg[32]
read_argv(1,arg,31)
new botNum = str_to_num(arg)
if(botNum > 0 && botNum <= botcount)
set_task(float(get_cvar_num("amx_ff_delay")),"manBotRemove",0,"",0,"a",botNum)
else
console_print(id,"amx_remove_bot # - Will remove # bots.")
return PLUGIN_HANDLED
}
public manBotAdd()
{
botCreated = false
set_task(1.0,"createBot")
}
public manBotRemove()
{
botKicked = false
set_task(1.0,"removeBot")
}
public client_connect(id)
{
if(get_cvar_num("amx_fakefull") == 1)
ServerStatus()
}
public client_disconnect(id)
{
is_user_ffbot[id]=false
if(get_cvar_num("amx_fakefull") == 1)
ServerStatus()
}
public createBot() {
if(!botCreated) {
new BotName[33],UserName[33],bool:UseAnotherName=false
copy(BotName,32,namesToUse[random_num(0,MAX_NAMES - 1)])
new players[32], inum
get_players(players, inum)
for (new i=0;i<inum;i++)
{
get_user_name(players[i],UserName,32)
if (containi(BotName,UserName)!=-1)
{
UseAnotherName=true
}
}
if (!UseAnotherName)
{
create_entity(BotName)
new Bot = cmd_target(0, BotName, 1)
set_user_frags(Bot, random_num(MIN_FRAGS,MAX_FRAGS))
is_user_ffbot[Bot]=true
botcount +=1
botCreated = true
}
else
{
createBot()
}
}
}
public removeBot()
{
new players[32], inum
get_players(players, inum)
for (new i=0;i<inum;i++)
{
if(!botKicked)
{
if (is_user_ffbot[players[i]])
{
remove_entity(players[i])
botcount -=1
botKicked = true
}
}
}
}
public ServerStatus()
{
if(get_cvar_num("amx_fakefull") == 1)
{
new players[32],inum
get_players(players,inum)
if(get_cvar_num("amx_ff_players")>inum)
{
if(get_cvar_num("amx_ff_delay") > 0)
{
botCreated = false
set_task(float(get_cvar_num("amx_ff_delay")),"createBot",7839)
}
else
console_print(0,"Server Admin: Please set amx_ff_delay to a number higher then 0")
}
else if(get_cvar_num("amx_ff_players")<inum)
{
if(get_cvar_num("amx_ff_delay") > 0)
{
botKicked = false
set_task(float(get_cvar_num("amx_ff_delay")),"removeBot",7039)
}
else
console_print(0,"Server Admin: Please set amx_ff_delay to a number higher then 0")
}
}
}
public ReadNames()
{
if(file_exists(g_botnamesfile))
{
new line, stxtsize
new data[64]
new number = -1
while((line=read_file(g_botnamesfile,line,data,63,stxtsize))!=0)
{
if(stxtsize > 0) {
number += 1
copy(namesToUse[number],63,data)
}
}
}
}