// Never do you have to deal with round ending again!
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#define PLUGIN "boty"
#define VERSION "1"
#define AUTHOR "Opracowane przez dav3k "
#define TASK_BOT 4325
new botteam[3];
static const botnames[3][] = {
"NULL",
"Terrorist", //Change Terrorist Bot Name
"Counter-Terrorist" //Change CT Bot name
}
new g_MaxPlayers;
new cvar_min_player;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);
register_event("TextMsg", "RozpocznijGre", "a", "2&#Game_C");
register_event("HLTV", "StartRound", "a", "1=0", "2=0");
cvar_min_player = register_cvar("dm_fakebot_min_player", "8");
g_MaxPlayers = get_maxplayers();
}
public RozpocznijGre() {
//check_player();
if(!task_exists(TASK_BOT)) set_task(6.0, "check_player", TASK_BOT, _, _, "b");
}
public StartRound() {
for(new x=1; x<3; x++) {
set_task(0.5, "set_invisible", botteam[x]);
}
}
public check_player() {
if(get_playersnum(1) < g_MaxPlayers-1 && get_teamplayersnum() < get_pcvar_num(cvar_min_player)) {
createBots();
}
else {
for(new x=1; x<3; x++) {
if(botteam[x]) {
server_cmd("kick #%d", get_user_userid(botteam[x]));
botteam[x] = 0;
}
}
}
}
public set_invisible(id) {
if(id) {
set_pev(id, pev_effects, (pev(id, pev_effects) | 128)); //set invisible
set_pev(id, pev_solid, 0); //Not Solid
}
}
createBots() {
new bot, x;
for(x=1; x<3; x++) {
//is bot in server already?
bot = find_player("bli", botnames[x]);
if(bot) {
botteam[x] = bot;
continue;
}
//bot not in server, create them.
bot = engfunc(EngFunc_CreateFakeClient, botnames[x]);
if(pev_valid(bot)) {
botteam[x] = bot;
new ptr[128];
dllfunc(DLLFunc_ClientConnect, bot, botnames[x], "127.0.0.1", ptr);
dllfunc(DLLFunc_ClientPutInServer, bot);
select_model(bot, x);
dllfunc(DLLFunc_Spawn, bot);
dllfunc(DLLFunc_Think, bot);
set_task(0.5, "set_invisible", bot);
}
}
}
select_model(id, team) {
switch(team) {
case 1: cs_set_user_team(id, CS_TEAM_T, CS_T_TERROR);
case 2: cs_set_user_team(id, CS_TEAM_CT, CS_CT_URBAN);
}
}
stock get_teamplayersnum() {
new playerCnt, i;
for(i=1; i<=g_MaxPlayers; i++) {
if(!is_user_connected(i) || is_user_bot(i) || is_user_hltv(i))
continue;
if(cs_get_user_team(i) == CS_TEAM_T || cs_get_user_team(i) == CS_TEAM_CT)
playerCnt++;
}
return playerCnt;
}
\Dostałem takie sma i skompilowałem bez problemu ale nie działa
I dodałem crav
Cvar dm_fakebot_min_player "1" // poniżej ilu graczy ma być na serwerze, aby boty się dodały
Zrobi mi ktoś baze danych mysql
Do podbotow
Użytkownik CheQ edytował ten post 18.11.2012 11:28


Dodatki SourceMod













