Advertisement
DecaK

Untitled

Feb 2nd, 2018
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #define USING_BOOST_API
  4. #include <api_gtrsboost>
  5.  
  6. #define PLUGIN "Autoreward GTRS Boost System"
  7. #define VERSION "1.0"
  8. #define AUTHOR "DecaK & klipica"
  9.  
  10. new server_ip[24], g_iBoosted = -5, Array:aBoostList;
  11. enum _:booststatus_t
  12. {
  13. STATUS_FAILED = 0,
  14. STATUS_PENDING,
  15. STATUS_OK
  16. };
  17.  
  18. enum _:BOOST_DATA
  19. {
  20. MSGID[34],
  21. PHONE[16],
  22. NAME[64],
  23. BOOSTTIME,
  24. booststatus_t:STATUS
  25. };
  26.  
  27. public plugin_init() {
  28. register_plugin(PLUGIN, VERSION, AUTHOR)
  29. register_clcmd("say boost", "isboost")
  30. new BoostError: iError;
  31. if(!Boost_Initialize()) {
  32. iError = Boost_GetLastError();
  33. log_amx("Boost_Initialize() failed with error code #%d: %s", iError, ERRORS[iError]);
  34. }
  35. else funcRefreshList();
  36. get_user_ip(0, server_ip, charsmax(server_ip))
  37. aBoostList = ArrayCreate(24, 92)
  38. }
  39.  
  40. public plugin_end() Boost_Cleanup();
  41.  
  42. public isboost(id) {
  43. client_print(id, print_console, "********* Podaci o boostu *********")
  44. if(g_iBoosted == -5) client_print(id, print_console, "Nema podataka o boostu")
  45. else client_print(id, print_console, "Server %s boostovan.", g_iBoosted ? "je" : "nije")
  46. if(!ArraySize(aBoostList)) client_print(id, print_console, "Nema podataka o boost listi")
  47. else {
  48. new tBoost[BOOST_DATA], szTime[24];
  49. for(new i = 0; i < ArraySize(aBoostList); i++) {
  50. ArrayGetArray(aBoostList, i, tBoost);
  51. format_time(szTime, charsmax(szTime), "%d.%m.%Y / %H:%M", tBoost[BOOSTTIME]);
  52. client_print(id, print_console, "Ime: %s | Vreme: %s | Status: %d", tBoost[NAME], szTime, tBoost[STATUS]);
  53. }
  54. }
  55. client_print(id, print_console, "************************************")
  56. }
  57.  
  58. public funcRefreshList()
  59. {
  60. if(!Boost_RefreshList())
  61. {
  62. new BoostError: iError = Boost_GetLastError();
  63. log_amx("Boost_RefreshList() failed with error code #%d: %s", iError, ERRORS[iError]);
  64.  
  65. set_task(30.0, "funcRefreshList");
  66. }
  67. }
  68.  
  69. public Boost_QueryResponse()
  70. {
  71. set_task(30.0, "funcRefreshList");
  72.  
  73. new BoostError: iError = Boost_GetLastError();
  74. if(iError != BERR_NONE)
  75. {
  76. log_amx("Boost_QueryResponse() error #%d: %s", iError, ERRORS[iError]);
  77. return 0;
  78. }
  79.  
  80. if(Boost_ServerExists(server_ip))
  81. g_iBoosted = true;
  82. else
  83. g_iBoosted = false;
  84. }
  85.  
  86. public BoostList_Refreshed()
  87. {
  88. new BoostError: iError;
  89. if((iError = Boost_GetLastError()) != BERR_NONE)
  90. {
  91. log_amx("Error #%d occured: %s", iError, ERRORS[iError]);
  92. return 0;
  93. }
  94.  
  95. aBoostList = Boost_GetList();
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement