Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <fakemeta>
- #include <amxmisc>
- #define PLUGIN "Bot-Fake"
- #define VERSION "1.0"
- #define AUTHOR "Author"
- new g_pEnable;
- new g_pBotName, g_pBotName2, g_pBotName3
- new bool:bot_on, bot_on2, bot_on3;
- new g_pMaxPlayers;
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR);
- g_pEnable = register_cvar("bs_enable", "1"); // activeaza / dezactiveaza plugin-ul
- g_pBotName = register_cvar("bs_botname", "RESPAWN.OLDGODS.RO (dns)"); // nick bot1
- g_pBotName2 = register_cvar("bs_botname2", "89.40.233.100:27015 (IP)"); // nick bot2
- g_pBotName3 = register_cvar("bs_botname3", "forum: oldgods.ro/forum"); // nick bot3
- g_pMaxPlayers = register_cvar("bs_maxplayers", "29.0"); // maxim 29 pentru a evita orice BUG, valoarea 29 va deconecta botii cand serverul este 30/32.
- bot_on=false;
- bot_on2=false;
- bot_on3=false;
- //pentru a verifica daca botii sunt pe server sau nu
- if( get_pcvar_num(g_pEnable) )
- {
- set_task( 5.0, "CreateBots");
- set_task( 60.0, "CreateBots", 0, _, _, "b");
- }
- // conectarea botilor la schimbarea hartii / cand nr. de jucatori este sub maxim. - de preferat sa nu modificati daca nu stiti ce faceti.
- }
- public client_connect(id) // kick botilor cand trec sau este egal cu nr. maxim
- {
- if(get_playersnum() >= (g_pMaxPlayers + 1))
- {
- new szBotName[33];
- get_pcvar_string(g_pBotName, szBotName, 32);
- server_cmd("kick ^"%s^"", szBotName);
- bot_on = false;
- new szBotName2[33];
- get_pcvar_string(g_pBotName2, szBotName2, 32);
- server_cmd("kick ^"%s^"", szBotName2);
- bot_on2 = false;
- new szBotName3[33];
- get_pcvar_string(g_pBotName3, szBotName3, 32);
- server_cmd("kick ^"%s^"", szBotName3);
- bot_on3 = false;
- }
- }
- public CreateBots() // executa pornirea botilor daca acestia nu sunt pe server si nr. jucatori este sub nr. max
- {
- if(get_playersnum() < (g_pMaxPlayers) && !bot_on) {
- CreateBot()
- if(get_playersnum() < (g_pMaxPlayers) && !bot_on2) {
- CreateBot2()
- if(get_playersnum() < (g_pMaxPlayers) && !bot_on3) {
- CreateBot3()
- }
- }
- }
- }
- // crearea botilor
- public CreateBot()
- {
- new szBotName[33];
- get_pcvar_string(g_pBotName, szBotName, 32);
- new id = engfunc(EngFunc_CreateFakeClient, szBotName);
- engfunc(EngFunc_FreeEntPrivateData, id);
- set_pev(id, pev_flags, pev( id, pev_flags ) | FL_FAKECLIENT);
- new szMsg[128];
- dllfunc(DLLFunc_ClientConnect, id, szBotName, "127.0.0.1", szMsg);
- dllfunc(DLLFunc_ClientPutInServer, id);
- bot_on = true;
- }
- public CreateBot2()
- {
- new szBotName2[33];
- get_pcvar_string(g_pBotName2, szBotName2, 32);
- new id = engfunc(EngFunc_CreateFakeClient, szBotName2);
- engfunc(EngFunc_FreeEntPrivateData, id);
- set_pev(id, pev_flags, pev( id, pev_flags ) | FL_FAKECLIENT);
- new szMsg[128];
- dllfunc(DLLFunc_ClientConnect, id, szBotName2, "127.0.0.1", szMsg);
- dllfunc(DLLFunc_ClientPutInServer, id);
- bot_on2 = true;
- }
- public CreateBot3()
- {
- new szBotName3[33];
- get_pcvar_string(g_pBotName3, szBotName3, 32);
- new id = engfunc(EngFunc_CreateFakeClient, szBotName3);
- engfunc(EngFunc_FreeEntPrivateData, id);
- set_pev(id, pev_flags, pev( id, pev_flags ) | FL_FAKECLIENT);
- new szMsg[128];
- dllfunc(DLLFunc_ClientConnect, id, szBotName3, "127.0.0.1", szMsg);
- dllfunc(DLLFunc_ClientPutInServer, id);
- bot_on3 = true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement