/* Spect Bot v1.2
My Plugins: http://skape69ta.clan.su/load/11
My Profile: http://amxmodx.su/forum/memberlist.php?mode=viewprofile&u=455
My Skype: SKAJIbnEJIb619
Light version fakefull_original
Cvars:
Имя бота
sbot_name ""
Бота не смогут кикнуть/забанить админы
sbot_immunity "1"
Автоматически убирать бота, если сервер полон
sbot_auto "1"
*/
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
new const Plugin[] = "Spect Bot"
new const Version[] = "1.2"
new const Author[] = "SKAJIbnEJIb & Bos93"
new g_BotName, g_Immunity, g_Auto
new g_Bot
public plugin_init()
{
register_plugin(Plugin, Version, Author)
g_BotName = register_cvar("sbot_name","Имя бота")
g_Auto = register_cvar("sbot_auto","1")
g_Immunity = register_cvar("sbot_immunity","1")
set_task(10.0, "ServerStatus", 777, _, _, "b")
}
public createBot()
{
new BotName[32]
get_pcvar_string(g_BotName, BotName, charsmax(BotName))
g_Bot = engfunc(EngFunc_CreateFakeClient, BotName)
if (g_Bot > 0)
{
dllfunc(MetaFunc_CallGameEntity, "player", g_Bot)
set_pev(g_Bot, pev_flags, FL_FAKECLIENT)
set_pev(g_Bot, pev_model, "")
set_pev(g_Bot, pev_viewmodel2, "")
set_pev(g_Bot, pev_modelindex, 0)
set_pev(g_Bot, pev_renderfx, kRenderFxNone)
set_pev(g_Bot, pev_rendermode, kRenderTransAlpha)
set_pev(g_Bot, pev_renderamt, 0.0)
set_team(g_Bot)
if (get_pcvar_num(g_Immunity))
set_user_flags(g_Bot, (ADMIN_IMMUNITY|ADMIN_MENU|ADMIN_LEVEL_C))
}
else
log_amx ("[Spect Bot] Error!")
return PLUGIN_CONTINUE
}
public removeBot(Bot)
{
server_cmd("kick #%d", get_user_userid(Bot))
g_Bot = 0
}
public set_team(Bot)
{
if (cstrike_running()) {
cs_set_user_team(Bot, CS_TEAM_UNASSIGNED)
}
}
public ServerStatus()
{
if (get_pcvar_num(g_Auto))
{
if(is_user_connected(g_Bot))
{
if(get_playersnum(1) > (get_maxplayers() - 2))
removeBot(g_Bot)
}
else
{
if(get_playersnum(1)+1 < get_maxplayers())
createBot()
}
}
else
{
if(is_user_connected(g_Bot))
createBot()
}
if(is_user_connected(g_Bot))
{
set_team(g_Bot)
if (get_user_team(g_Bot) > 0) {
server_cmd("kick #%d", get_user_userid(g_Bot))
createBot()
}
}
}