Advertisement
Guest User

Untitled

a guest
Oct 11th, 2021
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.59 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <fakemeta>
  3. #include <amxmisc>
  4.  
  5. #define PLUGIN "Bot-Fake"
  6. #define VERSION "1.0"
  7. #define AUTHOR "Author"
  8.  
  9. new g_pEnable;
  10. new g_pBotName, g_pBotName2, g_pBotName3
  11. new bool:bot_on, bot_on2, bot_on3;
  12. new g_pMaxPlayers;
  13.  
  14. public plugin_init()
  15. {
  16. register_plugin(PLUGIN, VERSION, AUTHOR);
  17.  
  18. g_pEnable = register_cvar("bs_enable", "1"); // activeaza / dezactiveaza plugin-ul
  19. g_pBotName = register_cvar("bs_botname", "RESPAWN.OLDGODS.RO (dns)"); // nick bot1
  20. g_pBotName2 = register_cvar("bs_botname2", "89.40.233.100:27015 (IP)"); // nick bot2
  21. g_pBotName3 = register_cvar("bs_botname3", "forum: oldgods.ro/forum"); // nick bot3
  22. 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.
  23.  
  24. bot_on=false;
  25. bot_on2=false;
  26. bot_on3=false;
  27. //pentru a verifica daca botii sunt pe server sau nu
  28.  
  29. if( get_pcvar_num(g_pEnable) )
  30. {
  31. set_task( 5.0, "CreateBots");
  32. set_task( 60.0, "CreateBots", 0, _, _, "b");
  33. }
  34. // conectarea botilor la schimbarea hartii / cand nr. de jucatori este sub maxim. - de preferat sa nu modificati daca nu stiti ce faceti.
  35. }
  36.  
  37. public client_connect(id) // kick botilor cand trec sau este egal cu nr. maxim
  38. {
  39. if(get_playersnum() >= (g_pMaxPlayers + 1))
  40. {
  41. new szBotName[33];
  42. get_pcvar_string(g_pBotName, szBotName, 32);
  43. server_cmd("kick ^"%s^"", szBotName);
  44. bot_on = false;
  45. new szBotName2[33];
  46. get_pcvar_string(g_pBotName2, szBotName2, 32);
  47. server_cmd("kick ^"%s^"", szBotName2);
  48. bot_on2 = false;
  49. new szBotName3[33];
  50. get_pcvar_string(g_pBotName3, szBotName3, 32);
  51. server_cmd("kick ^"%s^"", szBotName3);
  52. bot_on3 = false;
  53. }
  54. }
  55.  
  56. public CreateBots() // executa pornirea botilor daca acestia nu sunt pe server si nr. jucatori este sub nr. max
  57. {
  58. if(get_playersnum() < (g_pMaxPlayers) && !bot_on) {
  59. CreateBot()
  60. if(get_playersnum() < (g_pMaxPlayers) && !bot_on2) {
  61. CreateBot2()
  62. if(get_playersnum() < (g_pMaxPlayers) && !bot_on3) {
  63. CreateBot3()
  64. }
  65. }
  66. }
  67. }
  68.  
  69. // crearea botilor
  70. public CreateBot()
  71. {
  72. new szBotName[33];
  73. get_pcvar_string(g_pBotName, szBotName, 32);
  74.  
  75. new id = engfunc(EngFunc_CreateFakeClient, szBotName);
  76. engfunc(EngFunc_FreeEntPrivateData, id);
  77. set_pev(id, pev_flags, pev( id, pev_flags ) | FL_FAKECLIENT);
  78.  
  79. new szMsg[128];
  80. dllfunc(DLLFunc_ClientConnect, id, szBotName, "127.0.0.1", szMsg);
  81. dllfunc(DLLFunc_ClientPutInServer, id);
  82.  
  83. bot_on = true;
  84. }
  85.  
  86. public CreateBot2()
  87. {
  88. new szBotName2[33];
  89. get_pcvar_string(g_pBotName2, szBotName2, 32);
  90.  
  91. new id = engfunc(EngFunc_CreateFakeClient, szBotName2);
  92. engfunc(EngFunc_FreeEntPrivateData, id);
  93. set_pev(id, pev_flags, pev( id, pev_flags ) | FL_FAKECLIENT);
  94.  
  95. new szMsg[128];
  96. dllfunc(DLLFunc_ClientConnect, id, szBotName2, "127.0.0.1", szMsg);
  97. dllfunc(DLLFunc_ClientPutInServer, id);
  98.  
  99. bot_on2 = true;
  100. }
  101.  
  102. public CreateBot3()
  103. {
  104. new szBotName3[33];
  105. get_pcvar_string(g_pBotName3, szBotName3, 32);
  106.  
  107. new id = engfunc(EngFunc_CreateFakeClient, szBotName3);
  108. engfunc(EngFunc_FreeEntPrivateData, id);
  109. set_pev(id, pev_flags, pev( id, pev_flags ) | FL_FAKECLIENT);
  110.  
  111. new szMsg[128];
  112. dllfunc(DLLFunc_ClientConnect, id, szBotName3, "127.0.0.1", szMsg);
  113. dllfunc(DLLFunc_ClientPutInServer, id);
  114.  
  115. bot_on3 = true;
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement