Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.77 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <colorchat>
  3. #include <api_gtrsboost>
  4.  
  5. #define TASK_REFRESH 2048
  6.  
  7. new g_pInfo;
  8. new g_iBoosted = false;
  9. new const szCountries[][] =
  10. {
  11. "Srbija", "Bosna", "Crna Gora", "Hrvatska", "Macedonia",
  12. "Slovenia", "Norway", "Bulgaria", "Czech Republic", "Estonia",
  13. "Finland", "Romania", "Kosovo", "Albania", "Austria",
  14. "France", "Germany", "Switzerland", "Poland", "Sweden",
  15. "Italy", "Argentina", "Brazil", "Peru", "Greece", "India"
  16. };
  17.  
  18. new szServerIp[24];
  19.  
  20.  
  21. public plugin_init()
  22. {
  23. register_plugin("How to boost server", "3.0", "Ikac");
  24.  
  25. register_clcmd("say /boost", "clcmd_Boost");
  26. register_clcmd("say_team /boost", "clcmd_Boost");
  27.  
  28. g_pInfo = register_cvar("htbs_info", "300");
  29. set_task(get_pcvar_float(g_pInfo), "Info" , _ , _ , _ , "b");
  30.  
  31. get_user_ip(0, szServerIp, charsmax(szServerIp));
  32.  
  33. new BoostError: iError;
  34. if(!Boost_Initialize())
  35. {
  36. iError = Boost_GetLastError();
  37. log_amx("Boost_Initialize() failed with error code #%d: %s", iError, ERRORS[iError]);
  38.  
  39. return;
  40. }
  41.  
  42. funcRefreshList();
  43. }
  44.  
  45. public funcRefreshList()
  46. {
  47. if(!Boost_RefreshList())
  48. {
  49. new BoostError: iError = Boost_GetLastError();
  50. log_amx("Boost_RefreshList() failed with error code #%d: %s", iError, ERRORS[iError]);
  51.  
  52. set_task(120.0, "funcRefreshList", TASK_REFRESH);
  53. g_iBoosted = false;
  54. }
  55. }
  56.  
  57. public Boost_QueryResponse()
  58. {
  59. set_task(120.0, "funcRefreshList", TASK_REFRESH);
  60.  
  61. new BoostError: iError = Boost_GetLastError();
  62. if(iError != BERR_NONE)
  63. {
  64. log_amx("Boost_QueryResponse() error #%d: %s", iError, ERRORS[iError]);
  65. g_iBoosted = false;
  66.  
  67. return;
  68. }
  69.  
  70. if(Boost_ServerExists(szServerIp))
  71. g_iBoosted = true;
  72. else
  73. g_iBoosted = false;
  74. }
  75.  
  76. public plugin_end()
  77. {
  78. Boost_Cleanup();
  79. }
  80.  
  81.  
  82.  
  83. public clcmd_Boost(id)
  84. {
  85. if(g_iBoosted)
  86. {
  87. ColorChat(id, GREEN, "^4[Boost]^1 Sorry, our server is already boosted. Please, try again later.");
  88. ColorChat(id, GREEN, "^4[Boost]^1 Nazalost, server je vec bustovan. Molimo vas, pokusajte kasnije.");
  89. }
  90. else
  91. set_task(1.0, "taskMenu", id);
  92. }
  93.  
  94. public taskMenu(id)
  95. {
  96. new iMenu = menu_create("\rIzaberi Drzavu:", "hndBoostMenu");
  97.  
  98. for(new i=0; i < sizeof(szCountries); i++)
  99. menu_additem(iMenu, szCountries[i]);
  100.  
  101. menu_display(id, iMenu);
  102. }
  103.  
  104. public hndBoostMenu(id, iMenu, iItem)
  105. {
  106. if(iItem == MENU_EXIT)
  107. {
  108. menu_destroy(iMenu);
  109. return PLUGIN_HANDLED;
  110. }
  111.  
  112. new szMotd[64];
  113. switch(iItem)
  114. {
  115. case 0:
  116. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/srb.html");
  117. case 1:
  118. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/bih.html");
  119. case 2:
  120. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/cg.html");
  121. case 3:
  122. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/hrv.html");
  123. case 4:
  124. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/mac.html");
  125. case 5:
  126. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/slo.html");
  127. case 6:
  128. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/nor.html");
  129. case 7:
  130. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/bul.html");
  131. case 8:
  132. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/cze.html");
  133. case 9:
  134. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/est.html");
  135. case 10:
  136. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/fin.html");
  137. case 11:
  138. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/ro.html");
  139. case 12:
  140. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/ko.html");
  141. case 13:
  142. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/alb.html");
  143. case 14:
  144. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/aus.html");
  145. case 15:
  146. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/slo.html");
  147. case 16:
  148. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/fra.html");
  149. case 17:
  150. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/ger.html");
  151. case 18:
  152. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/swi.html");
  153. case 19:
  154. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/pol.html");
  155. case 20:
  156. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/swe.html");
  157. case 21:
  158. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/ita.html");
  159. case 22:
  160. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/arg.html");
  161. case 23:
  162. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/bra.html");
  163. case 24:
  164. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/per.html");
  165. case 25:
  166. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/gre.html");
  167. case 26:
  168. formatex(szMotd,charsmax(szMotd),"addons/amxmodx/configs/szMotd/ind.html");
  169. }
  170.  
  171. show_motd(id, szMotd);
  172.  
  173. return PLUGIN_HANDLED;
  174. }
  175.  
  176.  
  177. public Info()
  178. {
  179. ColorChat(0, GREEN, "[APB]^1 Ako zelis da dobijes VIP-a say^3 /boost");
  180. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement