Advertisement
Guest User

Untitled

a guest
Jan 31st, 2021
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 33.92 KB | None | 0 0
  1. /********************************************************************************************************************
  2. * Wersja 1.0 pierwszę wypuszczenie pluginu.                                                                            *
  3. * Wersja 1.1 Dodano nieograniczone stawki, pokazywanie % szans na wygranie pod !jackpot, możliwość anulowania        *
  4. * stawiania pieniędzy(np. wpiszesz !jackpot i wybierzesz złe stawki) wystarczy wpisać cancel                     *
  5. * Dodano wsparcie dla store by Zephyrus(wersja 1.4 używa sm_jackpotshopuse)                                            *                                   *
  6. * Wersja 1.2 Dodano możliwość ustawienia nazwy waluty przez ConVar sm_jackpotcurrency                                *
  7. * Pokazywanie aktualnej puli pod hud                                                                                *
  8. * Dodano pokaz wplaconych pieniędzy pod hud                                                                            *
  9. * Dodano obliczanie % szans na wygranie pod hud                                                                     *
  10. * Wersja 1.3 Zmieniono pozycję napisu danych stawek                                                                    *
  11. * Dodano !jm - otwiera menu z wyborem preferencji HUD.                                                              *
  12. * Wersja 1.4 Dodano tłumaczenia oraz dodano automatyczne wykrywanie sklepów którego ma używać jackpot              *
  13. * Można również ustawić poprzez ConVar którego sklepu ma używać.                                                 *
  14. * sm_jackpotshopuse 0-Auto detect 1-DR Shop by Brum Brum 2-Store by Zephyrus 3-Shop by FrozDark 4-Yamakashi Credits *
  15. * Zmieniono sposób losowania gracza, z slota na userid                                                             *
  16. * Poprawiono błąd przez który czasem nie losowało wygranego gracza.                                                 *
  17. * Dodano możliwość zmiany TAGu na czacie i menu przez cvar                                                           *
  18. * Dodano pokazywanie ilości graczy, którzy biorą udział w jackpocie                                                 *
  19. * Dodano ConVar przez który można wybrać tryb jackpota(0-standardowy losowanie na końcu rundy                       *
  20. * 1-Od pierwszej wpłaty na daną stawkę jest X(zależy od cvara) sekund na wpłatę)                                  *
  21. ********************************************************************************************************************/
  22.  
  23. #include <dr_shop>
  24. #include <store>
  25. #include <shop>
  26. #include <GoMod>
  27. #include <credits>
  28. #include <multicolors>
  29. #include <clientprefs>
  30.  
  31. #pragma semicolon 1
  32. #pragma newdecls required
  33. //#define MOD_TAG "\x01\x0B★ \x07[ADEPT-Jackpot]\x04 "
  34. ConVar gc_MOD_TAG;
  35. ConVar Currency, ShopDetect, gc_JackpotMode;
  36. ConVar LowPriceJackpotMin, MediumPriceJackpotMin, HighPriceJackpotMin;
  37. ConVar LowPriceJackpotMax, MediumPriceJackpotMax, HighPriceJackpotMax;
  38. ConVar gc_JackpotTimer;
  39.  
  40. char MOD_TAG[64];
  41. char CurrencyString[32];
  42.  
  43. ArrayList JackpotLowPrice, JackpotMediumPrice, JackpotHighPrice, JackpotUnlimitedPrice;
  44.  
  45. bool g_Used[MAXPLAYERS + 1];
  46. bool LowPrice[MAXPLAYERS + 1], MediumPrice[MAXPLAYERS + 1], HighPrice[MAXPLAYERS + 1], UnlimitedPrice[MAXPLAYERS + 1];
  47. bool g_bLow[MAXPLAYERS + 1], g_bMedium[MAXPLAYERS + 1], g_bHigh[MAXPLAYERS + 1], g_bUnlimited[MAXPLAYERS + 1];
  48. bool g_bShopBrum, g_bShopZephyrus, g_bShopFrozeDark, g_bShopYamakashi, g_bShopGoMod;
  49.  
  50. int g_iSpend[MAXPLAYERS + 1];
  51. int HudMode[MAXPLAYERS + 1];
  52.  
  53. Handle g_hLowTime, g_hMediumTime, g_hHighTime, g_hUnlimitedTime;
  54.  
  55. int LowTime, MediumTime, HighTime, UnlimitedTime;
  56.  
  57. float HudCoords1[][] =  {  { 0.02, 0.37 }, { 0.02, 0.05 }, { 0.02, 0.60 }, { 0.35, 0.06 }, { 0.35, 0.43 } };
  58. float HudCoords2[][] =  {  { 0.02, 0.40 }, { 0.02, 0.08 }, { 0.02, 0.63 }, { 0.35, 0.09 }, { 0.35, 0.46 } };
  59. float HudCoords3[][] =  {  { 0.02, 0.43 }, { 0.02, 0.11 }, { 0.02, 0.66 }, { 0.35, 0.12 }, { 0.35, 0.49 } };
  60. float HudCoords4[][] =  {  { 0.02, 0.49 }, { 0.02, 0.17 }, { 0.02, 0.72 }, { 0.35, 0.18 }, { 0.35, 0.55 } };
  61. float HudCoords5[][] =  {  { 0.02, 0.52 }, { 0.02, 0.20 }, { 0.02, 0.75 }, { 0.35, 0.21 }, { 0.35, 0.58 } };
  62.  
  63. Handle HudPostion;
  64.  
  65. /************************************
  66. ****Uga Buga Bioły Uga Uga Buga******
  67. *************************************/
  68.  
  69. public Plugin myinfo =
  70. {
  71.     name = "ADEPT -> Jackpot",
  72.     description = "Autorski plugin studioADEPT.net",
  73.     author = "Brum Brum",
  74.     version = "1.4",
  75.     url = "http://www.StudioADEPT.net"
  76. };
  77.  
  78. public void OnPluginStart()
  79. {
  80.     JackpotLowPrice = new ArrayList();
  81.     JackpotMediumPrice = new ArrayList();
  82.     JackpotHighPrice = new ArrayList();
  83.     JackpotUnlimitedPrice = new ArrayList();
  84.     gc_JackpotMode = CreateConVar("sm_jackpot_mode", "0", "0-Default 1-Timer(60 seconds from the first payment)");
  85.     gc_JackpotTimer = CreateConVar("sm_jackpot_timer", "60", "Działa tylko i wyłącznie z cvarem sm_jackpot_mode 1");
  86.     LowPriceJackpotMin = CreateConVar("sm_jackpotlowpricemin", "250", "Minimum amount at low rates");
  87.     LowPriceJackpotMax = CreateConVar("sm_jackpotlowpricemax", "1500", "Maximum amount at low rates");
  88.     MediumPriceJackpotMin = CreateConVar("sm_jackpotmediumpricemin", "1500", "Minimum amount at average rates");
  89.     MediumPriceJackpotMax = CreateConVar("sm_jackpotmediumpricemax", "4500", "Maximum amount at average rates");
  90.     HighPriceJackpotMin = CreateConVar("sm_jackpothighpricemin", "4500", "Minimum amount at high rates");
  91.     HighPriceJackpotMax = CreateConVar("sm_jackpothighpricemax", "10500", "Maximum amount at high rates");
  92.     ShopDetect = CreateConVar("sm_jackpotshopuse", "0", "0-Auto detect 1-DR Shop by Brum Brum 2-Store by Zephyrus 3-Shop by FrozDark 4-Yamakshi Credits 5 -GoMod");
  93.     gc_MOD_TAG = CreateConVar("sm_jackpot_mod_tag", "ADEPT", "TAG shown in chat and menu");
  94.     Currency = CreateConVar("sm_jackpotcurrency", "$", "Currency name");
  95.     Currency.AddChangeHook(CurrencyNameChanged);
  96.     Currency.GetString(CurrencyString, sizeof(CurrencyString));
  97.     gc_MOD_TAG.AddChangeHook(MOD_TAGNameChanged);
  98.     gc_MOD_TAG.GetString(MOD_TAG, sizeof(MOD_TAG));
  99.     HudPostion = RegClientCookie("sm_jackpothudpostion", "Saving HUD Postion", CookieAccess_Protected);
  100.     RegConsoleCmd("say", ClientSay);
  101.     RegConsoleCmd("say_team", ClientSay);
  102.     RegConsoleCmd("sm_jackpot", CMD_Jackpot);
  103.     RegConsoleCmd("sm_jm", CMD_JackpotMenu);
  104.     HookEvent("round_end", Event_RoundEnd);
  105.     AutoExecConfig(true, "ADEPT_Jackpot");
  106.     LoadTranslations("ADEPT_Jackpot.phrases.txt");
  107.    
  108.     if (!ShopDetect.BoolValue)
  109.     {
  110.         g_bShopBrum = LibraryExists("dr_shop");
  111.         if (g_bShopBrum) {
  112.             NotifyServer();
  113.             return;
  114.         }
  115.        
  116.         g_bShopZephyrus = LibraryExists("store_zephyrus");
  117.         if (g_bShopZephyrus) {
  118.             NotifyServer();
  119.             return;
  120.         }
  121.        
  122.         g_bShopFrozeDark = LibraryExists("shop");
  123.         if (g_bShopFrozeDark) {
  124.             NotifyServer();
  125.             return;
  126.         }
  127.         g_bShopYamakashi = LibraryExists("credits");
  128.         if (g_bShopYamakashi) {
  129.             NotifyServer();
  130.             return;
  131.         }
  132.         g_bShopGoMod = LibraryExists("GoMod");
  133.         if (g_bShopGoMod) {
  134.             NotifyServer();
  135.             return;
  136.         }
  137.        
  138.     }
  139.     else
  140.     {
  141.         if (ShopDetect.IntValue == 1 && LibraryExists("dr_shop"))g_bShopBrum = true;
  142.         else if (ShopDetect.IntValue == 2 && LibraryExists("store_zephyrus"))g_bShopZephyrus = true;
  143.         else if (ShopDetect.IntValue == 3 && LibraryExists("shop"))g_bShopFrozeDark = true;
  144.         else if (ShopDetect.IntValue == 4 && LibraryExists("credits"))g_bShopYamakashi = true;
  145.         else if (ShopDetect.IntValue == 5 && LibraryExists("GoMod"))g_bShopGoMod = true;
  146.         NotifyServer();
  147.     }
  148. }
  149.  
  150. public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
  151. {
  152.     MarkNativeAsOptional("dr_GetMoneyAmount");
  153.     MarkNativeAsOptional("dr_RemoveMoney");
  154.     MarkNativeAsOptional("dr_AddMoney");
  155.     MarkNativeAsOptional("Store_SetClientCredits");
  156.     MarkNativeAsOptional("Store_GetClientCredits");
  157.     MarkNativeAsOptional("Shop_SetClientCredits");
  158.     MarkNativeAsOptional("Shop_GetClientCredits");
  159.     MarkNativeAsOptional("shop_add_credits");
  160.     MarkNativeAsOptional("shop_get_credits");
  161.     MarkNativeAsOptional("shop_set_credits");
  162.     return APLRes_Success;
  163. }
  164.  
  165. public void OnPluginEnd()
  166. {
  167.     for (int i = 1; i <= MaxClients; i++)
  168.     {
  169.         if (IsValidPlayer(i))
  170.         {
  171.             g_Used[i] = false;
  172.             LowPrice[i] = false;
  173.             MediumPrice[i] = false;
  174.             HighPrice[i] = false;
  175.             UnlimitedPrice[i] = false;
  176.             g_bLow[i] = false;
  177.             g_bMedium[i] = false;
  178.             g_bHigh[i] = false;
  179.             g_bUnlimited[i] = false;
  180.             g_iSpend[i] = 0;
  181.         }
  182.     }
  183.     LowTime = 0;
  184.     MediumTime = 0;
  185.     HighTime = 0;
  186.     UnlimitedTime = 0;
  187.     g_hLowTime = INVALID_HANDLE;
  188.     g_hMediumTime = INVALID_HANDLE;
  189.     g_hHighTime = INVALID_HANDLE;
  190.     g_hUnlimitedTime = INVALID_HANDLE;
  191.     JackpotLowPrice.Clear();
  192.     JackpotMediumPrice.Clear();
  193.     JackpotHighPrice.Clear();
  194.     JackpotUnlimitedPrice.Clear();
  195. }
  196.  
  197. public void MOD_TAGNameChanged(ConVar convar, const char[] oldValue, const char[] newValue)
  198. {
  199.     Format(MOD_TAG, sizeof(MOD_TAG), newValue);
  200. }
  201. public void CurrencyNameChanged(ConVar convar, const char[] oldValue, const char[] newValue)
  202. {
  203.     Format(CurrencyString, sizeof(CurrencyString), newValue);
  204. }
  205.  
  206. public void OnLibraryAdded(const char[] name)
  207. {
  208.     if (!ShopDetect.BoolValue)
  209.     {
  210.         if (StrEqual(name, "dr_shop")) {
  211.             g_bShopBrum = true;
  212.             PrintToServer("Jackpot using dr_shop by Brum Brum");
  213.             return;
  214.         }
  215.         else if (StrEqual(name, "store_zephyrus")) {
  216.             g_bShopZephyrus = true;
  217.             PrintToServer("Jackpot using Store by Zephyrus");
  218.             return;
  219.         }
  220.         else if (StrEqual(name, "shop")) {
  221.             g_bShopFrozeDark = true;
  222.             PrintToServer("Jackpot using Shop by FrozDark");
  223.             return;
  224.         }
  225.         else if (StrEqual(name, "credits")) {
  226.             g_bShopYamakashi = true;
  227.             PrintToServer("Jackpot using Credits by Yamakashi");
  228.             return;
  229.         }
  230.         else if (StrEqual(name, "GoMod")) {
  231.             g_bShopGoMod = true;
  232.             PrintToServer("Jackpot using Credits by GoMod");
  233.             return;
  234.         }
  235.     }
  236.     else
  237.     {
  238.         if (ShopDetect.IntValue == 1 && StrEqual(name, "dr_shop"))g_bShopBrum = true;
  239.         else if (ShopDetect.IntValue == 2 && StrEqual(name, "store_zephyrus"))g_bShopZephyrus = true;
  240.         else if (ShopDetect.IntValue == 3 && StrEqual(name, "shop"))g_bShopFrozeDark = true;
  241.         else if (ShopDetect.IntValue == 4 && StrEqual(name, "credits"))g_bShopYamakashi = true;
  242.         else if (ShopDetect.IntValue == 5 && StrEqual(name, "GoMod"))g_bShopGoMod = true;
  243.         NotifyServer();
  244.     }
  245. }
  246.  
  247. public void OnLibraryRemoved(const char[] name)
  248. {
  249.     if (StrEqual(name, "dr_shop"))g_bShopBrum = false;
  250.     else if (StrEqual(name, "store_zephyrus"))g_bShopZephyrus = false;
  251.     else if (StrEqual(name, "shop"))g_bShopFrozeDark = false;
  252.     else if (StrEqual(name, "credits"))g_bShopYamakashi = false;
  253.     else if (StrEqual(name, "GoMod"))g_bShopGoMod = false;
  254. }
  255.  
  256. public void OnClientCookiesCached(int client)
  257. {
  258.     char Value[11];
  259.     GetClientCookie(client, HudPostion, Value, sizeof(Value));
  260.     HudMode[client] = StringToInt(Value);
  261. }
  262.  
  263. public void OnClientDisconnect(int client)
  264. {
  265.     g_Used[client] = false;
  266.     LowPrice[client] = false;
  267.     MediumPrice[client] = false;
  268.     HighPrice[client] = false;
  269.     UnlimitedPrice[client] = false;
  270.     g_bLow[client] = false;
  271.     g_bMedium[client] = false;
  272.     g_bHigh[client] = false;
  273.     g_bUnlimited[client] = false;
  274.     g_iSpend[client] = 0;
  275. }
  276.  
  277. public Action Event_RoundEnd(Event event, const char[] name, bool dontBroadcast)
  278. {
  279.     if (gc_JackpotMode.IntValue == 0)
  280.     {
  281.         ForceWinJackpot(JackpotLowPrice, true, false, false, false);
  282.         ForceWinJackpot(JackpotMediumPrice, false, true, false, false);
  283.         ForceWinJackpot(JackpotHighPrice, false, false, true, false);
  284.         ForceWinJackpot(JackpotUnlimitedPrice, false, false, false, true);
  285.     }
  286. }
  287.  
  288. public Action ClientSay(int client, int args)
  289. {
  290.     int minlowprice = LowPriceJackpotMin.IntValue;
  291.     int maxlowprice = LowPriceJackpotMax.IntValue;
  292.     int minmediumprice = MediumPriceJackpotMin.IntValue;
  293.     int maxmediumprice = MediumPriceJackpotMax.IntValue;
  294.     int minhighprice = HighPriceJackpotMin.IntValue;
  295.     int maxhighprice = HighPriceJackpotMax.IntValue;
  296.     if (LowPrice[client] && !g_Used[client])
  297.     {
  298.         char arg[11];
  299.         GetCmdArg(1, arg, sizeof(arg));
  300.         if (StrContains(arg, "cancel", false) != -1 || StrContains(arg, "anuluj", false) != -1) {
  301.             g_Used[client] = false;
  302.             CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04  %t", MOD_TAG, "Cancel");
  303.             LowPrice[client] = false;
  304.             g_bLow[client] = false;
  305.             return Plugin_Handled;
  306.         }
  307.         int placed = StringToInt(arg);
  308.         if (placed > GetMoney(client)) {
  309.             CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04  %t", MOD_TAG, "Betting more than you have");
  310.             LowPrice[client] = false;
  311.             return Plugin_Handled;
  312.         }
  313.         if (placed < minlowprice) {
  314.             CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04  %t", MOD_TAG, "Minimum amount low", minlowprice, CurrencyString);
  315.             return Plugin_Handled;
  316.         }
  317.         else if (placed > maxlowprice) {
  318.             CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04  %t", MOD_TAG, "Max amount low", maxlowprice, CurrencyString);
  319.             return Plugin_Handled;
  320.         }
  321.         else {
  322.             g_Used[client] = true;
  323.             RemoveMoney(client, placed);
  324.             g_iSpend[client] = placed;
  325.             for (int i = 0; i < placed; i++) {
  326.                 JackpotLowPrice.Push(GetClientUserId(client));
  327.             }
  328.             if (gc_JackpotMode.IntValue == 1) {
  329.                 if (g_hLowTime == INVALID_HANDLE) {
  330.                     LowTime = gc_JackpotTimer.IntValue;
  331.                     g_hLowTime = CreateTimer(1.0, Timer_LowTime, _, TIMER_REPEAT);
  332.                 }
  333.             }
  334.             CreateTimer(0.9, JackpotHudRefresh, GetClientUserId(client), TIMER_REPEAT);
  335.             CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04  %t", MOD_TAG, "Placed Low", placed, CurrencyString, float(placed) / float(JackpotLowPrice.Length) * 100.0, JackpotLowPrice.Length, CurrencyString);
  336.         }
  337.         return Plugin_Handled;
  338.     }
  339.     else if (MediumPrice[client] && !g_Used[client])
  340.     {
  341.         char arg[11];
  342.         GetCmdArg(1, arg, sizeof(arg));
  343.         if (StrContains(arg, "cancel", false) != -1 || StrContains(arg, "anuluj", false) != -1) {
  344.             g_Used[client] = false;
  345.             CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "Cancel");
  346.             MediumPrice[client] = false;
  347.             g_bMedium[client] = false;
  348.             return Plugin_Handled;
  349.         }
  350.         int placed = StringToInt(arg);
  351.         if (placed > GetMoney(client)) {
  352.             CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "Betting more than you have");
  353.             MediumPrice[client] = false;
  354.             return Plugin_Handled;
  355.         }
  356.         if (placed < minmediumprice) {
  357.             CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "Minimum amount medium", minmediumprice, CurrencyString);
  358.             return Plugin_Handled;
  359.         }
  360.         else if (placed > maxmediumprice) {
  361.             CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "Max amount medium", maxmediumprice, CurrencyString);
  362.             return Plugin_Handled;
  363.         }
  364.         else {
  365.             g_Used[client] = true;
  366.             RemoveMoney(client, placed);
  367.             g_iSpend[client] = placed;
  368.             for (int i = 0; i < placed; i++) {
  369.                 JackpotMediumPrice.Push(GetClientUserId(client));
  370.             }
  371.             if (gc_JackpotMode.IntValue == 1) {
  372.                 if (g_hMediumTime == INVALID_HANDLE) {
  373.                     MediumTime = gc_JackpotTimer.IntValue;
  374.                     g_hMediumTime = CreateTimer(1.0, Timer_MediumTime, _, TIMER_REPEAT);
  375.                 }
  376.             }
  377.             CreateTimer(0.9, JackpotHudRefresh, GetClientUserId(client), TIMER_REPEAT);
  378.             CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "Placed Medium", placed, CurrencyString, float(placed) / float(JackpotMediumPrice.Length) * 100.0, JackpotMediumPrice.Length, CurrencyString);
  379.         }
  380.         return Plugin_Handled;
  381.     }
  382.     else if (HighPrice[client] && !g_Used[client])
  383.     {
  384.         char arg[11];
  385.         GetCmdArg(1, arg, sizeof(arg));
  386.         if (StrContains(arg, "cancel", false) != -1 || StrContains(arg, "anuluj", false) != -1) {
  387.             g_Used[client] = false;
  388.             CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "Cancel");
  389.             HighPrice[client] = false;
  390.             g_bHigh[client] = false;
  391.             return Plugin_Handled;
  392.         }
  393.         int placed = StringToInt(arg);
  394.         if (placed > GetMoney(client)) {
  395.             CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "Betting more than you have");
  396.             HighPrice[client] = false;
  397.             return Plugin_Handled;
  398.         }
  399.         if (placed < minhighprice) {
  400.             CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "Minimum amount high", minhighprice, CurrencyString);
  401.             return Plugin_Handled;
  402.         }
  403.         else if (placed > maxhighprice) {
  404.             CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "Max amount high", maxhighprice, CurrencyString);
  405.             return Plugin_Handled;
  406.         }
  407.         else {
  408.             g_Used[client] = true;
  409.             RemoveMoney(client, placed);
  410.             g_iSpend[client] = placed;
  411.             for (int i = 0; i < placed; i++) {
  412.                 JackpotHighPrice.Push(GetClientUserId(client));
  413.             }
  414.             if (gc_JackpotMode.IntValue == 1) {
  415.                 if (g_hHighTime == INVALID_HANDLE) {
  416.                     HighTime = gc_JackpotTimer.IntValue;
  417.                     g_hHighTime = CreateTimer(1.0, Timer_HighTime, _, TIMER_REPEAT);
  418.                 }
  419.             }
  420.             CreateTimer(0.9, JackpotHudRefresh, GetClientUserId(client), TIMER_REPEAT);
  421.             CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "Placed High", placed, CurrencyString, float(placed) / float(JackpotHighPrice.Length) * 100.0, JackpotHighPrice.Length, CurrencyString);
  422.         }
  423.         return Plugin_Handled;
  424.     }
  425.     else if (UnlimitedPrice[client] && !g_Used[client])
  426.     {
  427.         char arg[11];
  428.         GetCmdArg(1, arg, sizeof(arg));
  429.         if (StrContains(arg, "cancel", false) != -1 || StrContains(arg, "anuluj", false) != -1) {
  430.             g_Used[client] = false;
  431.             CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "Cancel");
  432.             UnlimitedPrice[client] = false;
  433.             g_bUnlimited[client] = false;
  434.             return Plugin_Handled;
  435.         }
  436.         int placed = StringToInt(arg);
  437.         if (placed > GetMoney(client)) {
  438.             CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "Betting more than you have");
  439.             UnlimitedPrice[client] = false;
  440.             return Plugin_Handled;
  441.         }
  442.         if (placed <= 0) {
  443.             CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "You cant bet less zero");
  444.             return Plugin_Handled;
  445.         }
  446.         else {
  447.             g_Used[client] = true;
  448.             RemoveMoney(client, placed);
  449.             g_iSpend[client] = placed;
  450.             for (int i = 0; i < placed; i++) {
  451.                 JackpotUnlimitedPrice.Push(GetClientUserId(client));
  452.             }
  453.             if (gc_JackpotMode.IntValue == 1) {
  454.                 if (g_hUnlimitedTime == INVALID_HANDLE) {
  455.                     UnlimitedTime = gc_JackpotTimer.IntValue;
  456.                     g_hUnlimitedTime = CreateTimer(1.0, Timer_UnlimitedTime, _, TIMER_REPEAT);
  457.                 }
  458.             }
  459.             CreateTimer(0.9, JackpotHudRefresh, GetClientUserId(client), TIMER_REPEAT);
  460.             CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "Placed Unlimited", placed, CurrencyString, float(placed) / float(JackpotUnlimitedPrice.Length) * 100.0, JackpotUnlimitedPrice.Length, CurrencyString);
  461.         }
  462.         return Plugin_Handled;
  463.     }
  464.     return Plugin_Continue;
  465. }
  466.  
  467. public Action CMD_Jackpot(int client, int args)
  468. {
  469.     if (client == 0) {
  470.         PrintToServer("Komenda dostępna tylko z poziomu gracza");
  471.         return Plugin_Handled;
  472.     }
  473.    
  474.     char title[128], bet[128];
  475.     Menu menu = new Menu(Menu_Handler);
  476.     Format(title, sizeof(title), "%s -> Jackpot\n%t", MOD_TAG, "Menu Current Money", GetMoney(client), CurrencyString);
  477.     menu.SetTitle(title);
  478.     Format(bet, sizeof(bet), "%t", "Menu Low rates", JackpotLowPrice.Length, CurrencyString);
  479.     menu.AddItem("", bet);
  480.     Format(bet, sizeof(bet), "%t", "Menu Medium rates", JackpotMediumPrice.Length, CurrencyString);
  481.     menu.AddItem("", bet);
  482.     Format(bet, sizeof(bet), "%t", "Menu High rates", JackpotHighPrice.Length, CurrencyString);
  483.     menu.AddItem("", bet);
  484.     Format(bet, sizeof(bet), "%t", "Menu Unlimited rates", JackpotUnlimitedPrice.Length, CurrencyString);
  485.     menu.AddItem("", bet);
  486.     menu.ExitButton = true;
  487.     menu.Display(client, MENU_TIME_FOREVER);
  488.     return Plugin_Handled;
  489. }
  490.  
  491. public Action CMD_JackpotMenu(int client, int args)
  492. {
  493.     if (client == 0) {
  494.         PrintToServer("Komenda dostępna tylko z poziomu gracza");
  495.         return Plugin_Handled;
  496.     }
  497.     char translation[128];
  498.     Menu menu = new Menu(Jackpot_Menu_Handler);
  499.     Format(translation, sizeof(translation), "%s -> Jackpot\n%t", MOD_TAG, "Menu HUD Title");
  500.     menu.SetTitle(translation);
  501.     Format(translation, sizeof(translation), "%t", "Menu HUD Default");
  502.     menu.AddItem("", translation);
  503.     Format(translation, sizeof(translation), "%t", "Menu HUD Upper left corner");
  504.     menu.AddItem("", translation);
  505.     Format(translation, sizeof(translation), "%t", "Menu HUD Above the chat");
  506.     menu.AddItem("", translation);
  507.     Format(translation, sizeof(translation), "%t", "Menu HUD Under result");
  508.     menu.AddItem("", translation);
  509.     Format(translation, sizeof(translation), "%t", "Menu HUD Center");
  510.     menu.AddItem("", translation);
  511.     menu.ExitButton = true;
  512.     menu.Display(client, 60);
  513.     return Plugin_Handled;
  514. }
  515.  
  516. public int Menu_Handler(Menu menu, MenuAction action, int client, int item)
  517. {
  518.     if (!IsValidPlayer(client))return;
  519.    
  520.     switch (action)
  521.     {
  522.         case MenuAction_Select:
  523.         {
  524.             switch (item)
  525.             {
  526.                 case 0:
  527.                 {
  528.                     if (!g_Used[client])
  529.                     {
  530.                         CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "Before Bet");
  531.                         LowPrice[client] = true;
  532.                         g_bLow[client] = true;
  533.                     } else CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "After Bet");
  534.                 }
  535.                 case 1:
  536.                 {
  537.                     if (!g_Used[client])
  538.                     {
  539.                         CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "Before Bet");
  540.                         MediumPrice[client] = true;
  541.                         g_bMedium[client] = true;
  542.                     } else CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "After Bet");
  543.                 }
  544.                 case 2:
  545.                 {
  546.                     if (!g_Used[client])
  547.                     {
  548.                         CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "Before Bet");
  549.                         HighPrice[client] = true;
  550.                         g_bHigh[client] = true;
  551.                     } else CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "After Bet");
  552.                 }
  553.                 case 3:
  554.                 {
  555.                     if (!g_Used[client])
  556.                     {
  557.                         CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "Before Bet");
  558.                         UnlimitedPrice[client] = true;
  559.                         g_bUnlimited[client] = true;
  560.                     } else CPrintToChat(client, "\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "After Bet");
  561.                 }
  562.             }
  563.         }
  564.         case MenuAction_End:delete menu;
  565.     }
  566. }
  567.  
  568. public int Jackpot_Menu_Handler(Menu menu, MenuAction action, int client, int item)
  569. {
  570.     if (!IsValidPlayer(client))return;
  571.    
  572.     if (action == MenuAction_Select)
  573.     {
  574.         HudMode[client] = item;
  575.         char Value[11];
  576.         Format(Value, sizeof(Value), "%d", HudMode[client]);
  577.         SetClientCookie(client, HudPostion, Value);
  578.     }
  579.     else if (action == MenuAction_End)delete menu;
  580. }
  581.  
  582. public Action JackpotHudRefresh(Handle timer, int userid)
  583. {
  584.     int client = GetClientOfUserId(userid);
  585.     if (!IsValidPlayer(client))return Plugin_Stop;
  586.    
  587.     float blow = float(g_iSpend[client]) / float(JackpotLowPrice.Length) * 100.0;
  588.     float bmedium = float(g_iSpend[client]) / float(JackpotMediumPrice.Length) * 100.0;
  589.     float bhigh = float(g_iSpend[client]) / float(JackpotHighPrice.Length) * 100.0;
  590.     float bunlimited = float(g_iSpend[client]) / float(JackpotUnlimitedPrice.Length) * 100.0;
  591.    
  592.     if (LowPrice[client])
  593.     {
  594.         SetHudTextParams(HudCoords1[HudMode[client]][0], HudCoords1[HudMode[client]][1], 1.0, 255, 0, 0, 255, 0, 10.0, 0.0, 0.0);
  595.         ShowHudText(client, -1, "%t", "HUD Low rates name");
  596.         SetHudTextParams(HudCoords2[HudMode[client]][0], HudCoords2[HudMode[client]][1], 1.0, 0, 162, 232, 255, 0, 10.0, 0.0, 0.0);
  597.         ShowHudText(client, -1, "%t", "HUD Low rates pot", JackpotLowPrice.Length, CurrencyString);
  598.         SetHudTextParams(HudCoords3[HudMode[client]][0], HudCoords3[HudMode[client]][1], 1.0, 6, 231, 1, 255, 0, 10.0, 0.0, 0.0);
  599.         ShowHudText(client, -1, "%t", "HUD Low rates placed", g_iSpend[client], CurrencyString, blow);
  600.         SetHudTextParams(HudCoords4[HudMode[client]][0], HudCoords4[HudMode[client]][1], 1.0, 200, 255, 0, 255, 0, 10.0, 0.0, 0.0);
  601.         ShowHudText(client, -1, "%t", "HUD Low rates player count", GetPlayerCount(true, false, false, false));
  602.         if (gc_JackpotMode.IntValue == 1) {
  603.             SetHudTextParams(HudCoords5[HudMode[client]][0], HudCoords5[HudMode[client]][1], 1.0, 20, 50, 255, 255, 0, 10.0, 0.0, 0.0);
  604.             ShowHudText(client, -1, "%t", "HUD Low rates timeleft", LowTime);
  605.         }
  606.     }
  607.     else if (MediumPrice[client])
  608.     {
  609.         SetHudTextParams(HudCoords1[HudMode[client]][0], HudCoords1[HudMode[client]][1], 1.0, 255, 0, 0, 255, 0, 10.0, 0.0, 0.0);
  610.         ShowHudText(client, -1, "%t", "HUD Medium rates name");
  611.         SetHudTextParams(HudCoords2[HudMode[client]][0], HudCoords2[HudMode[client]][1], 1.0, 0, 162, 232, 255, 0, 10.0, 0.0, 0.0);
  612.         ShowHudText(client, -1, "%t", "HUD Medium rates pot", JackpotMediumPrice.Length, CurrencyString);
  613.         SetHudTextParams(HudCoords3[HudMode[client]][0], HudCoords3[HudMode[client]][1], 1.0, 6, 231, 1, 255, 0, 10.0, 0.0, 0.0);
  614.         ShowHudText(client, -1, "%t", "HUD Medium rates placed", g_iSpend[client], CurrencyString, bmedium);
  615.         SetHudTextParams(HudCoords4[HudMode[client]][0], HudCoords4[HudMode[client]][1], 1.0, 200, 255, 0, 255, 0, 10.0, 0.0, 0.0);
  616.         ShowHudText(client, -1, "%t", "HUD Medium rates player count", GetPlayerCount(false, true, false, false));
  617.         if (gc_JackpotMode.IntValue == 1) {
  618.             SetHudTextParams(HudCoords5[HudMode[client]][0], HudCoords5[HudMode[client]][1], 1.0, 20, 50, 255, 255, 0, 10.0, 0.0, 0.0);
  619.             ShowHudText(client, -1, "%t", "HUD Medium rates timeleft", MediumTime);
  620.         }
  621.     }
  622.     else if (HighPrice[client])
  623.     {
  624.         SetHudTextParams(HudCoords1[HudMode[client]][0], HudCoords1[HudMode[client]][1], 1.0, 255, 0, 0, 255, 0, 10.0, 0.0, 0.0);
  625.         ShowHudText(client, -1, "%t", "HUD High rates name");
  626.         SetHudTextParams(HudCoords2[HudMode[client]][0], HudCoords2[HudMode[client]][1], 1.0, 0, 162, 232, 255, 0, 10.0, 0.0, 0.0);
  627.         ShowHudText(client, -1, "%t", "HUD High rates pot", JackpotHighPrice.Length, CurrencyString);
  628.         SetHudTextParams(HudCoords3[HudMode[client]][0], HudCoords3[HudMode[client]][1], 1.0, 6, 231, 1, 255, 0, 10.0, 0.0, 0.0);
  629.         ShowHudText(client, -1, "%t", "HUD High rates placed", g_iSpend[client], CurrencyString, bhigh);
  630.         SetHudTextParams(HudCoords4[HudMode[client]][0], HudCoords4[HudMode[client]][1], 1.0, 200, 255, 0, 255, 0, 10.0, 0.0, 0.0);
  631.         ShowHudText(client, -1, "%t", "HUD High rates player count", GetPlayerCount(false, false, true, false));
  632.         if (gc_JackpotMode.IntValue == 1) {
  633.             SetHudTextParams(HudCoords5[HudMode[client]][0], HudCoords5[HudMode[client]][1], 1.0, 20, 50, 255, 255, 0, 10.0, 0.0, 0.0);
  634.             ShowHudText(client, -1, "%t", "HUD High rates timeleft", HighTime);
  635.         }
  636.     }
  637.     else if (UnlimitedPrice[client])
  638.     {
  639.         SetHudTextParams(HudCoords1[HudMode[client]][0], HudCoords1[HudMode[client]][1], 1.0, 255, 0, 0, 255, 0, 10.0, 0.0, 0.0);
  640.         ShowHudText(client, -1, "%t", "HUD Unlimited rates name");
  641.         SetHudTextParams(HudCoords2[HudMode[client]][0], HudCoords2[HudMode[client]][1], 1.0, 0, 162, 232, 255, 0, 10.0, 0.0, 0.0);
  642.         ShowHudText(client, -1, "%t", "HUD Unlimited rates pot", JackpotUnlimitedPrice.Length, CurrencyString);
  643.         SetHudTextParams(HudCoords3[HudMode[client]][0], HudCoords3[HudMode[client]][1], 1.0, 6, 231, 1, 255, 0, 10.0, 0.0, 0.0);
  644.         ShowHudText(client, -1, "%t", "HUD Unlimited rates placed", g_iSpend[client], CurrencyString, bunlimited);
  645.         SetHudTextParams(HudCoords4[HudMode[client]][0], HudCoords4[HudMode[client]][1], 1.0, 200, 255, 0, 255, 0, 10.0, 0.0, 0.0);
  646.         ShowHudText(client, -1, "%t", "HUD Unlimited rates player count", GetPlayerCount(false, false, false, true));
  647.         if (gc_JackpotMode.IntValue == 1) {
  648.             SetHudTextParams(HudCoords5[HudMode[client]][0], HudCoords5[HudMode[client]][1], 1.0, 20, 50, 255, 255, 0, 10.0, 0.0, 0.0);
  649.             ShowHudText(client, -1, "%t", "HUD Unlimited rates timeleft", UnlimitedTime);
  650.         }
  651.     }
  652.     else return Plugin_Stop;
  653.    
  654.     return Plugin_Continue;
  655. }
  656.  
  657. public Action Timer_LowTime(Handle timer)
  658. {
  659.     if (g_hLowTime == INVALID_HANDLE)return Plugin_Stop;
  660.     if (gc_JackpotMode.IntValue != 1)return Plugin_Stop;
  661.    
  662.     LowTime--;
  663.     if (LowTime == 0) {
  664.         g_hLowTime = INVALID_HANDLE;
  665.         ForceWinJackpot(JackpotLowPrice, true, false, false, false);
  666.     }
  667.     return Plugin_Continue;
  668. }
  669.  
  670. public Action Timer_MediumTime(Handle timer)
  671. {
  672.     if (g_hMediumTime == INVALID_HANDLE)return Plugin_Stop;
  673.     if (gc_JackpotMode.IntValue != 1)return Plugin_Stop;
  674.    
  675.     MediumTime--;
  676.     if (MediumTime == 0) {
  677.         g_hMediumTime = INVALID_HANDLE;
  678.         ForceWinJackpot(JackpotMediumPrice, false, true, false, false);
  679.     }
  680.     return Plugin_Continue;
  681. }
  682.  
  683. public Action Timer_HighTime(Handle timer)
  684. {
  685.     if (g_hHighTime == INVALID_HANDLE)return Plugin_Stop;
  686.     if (gc_JackpotMode.IntValue != 1)return Plugin_Stop;
  687.    
  688.     HighTime--;
  689.     if (HighTime == 0) {
  690.         g_hHighTime = INVALID_HANDLE;
  691.         ForceWinJackpot(JackpotHighPrice, false, false, true, false);
  692.     }
  693.     return Plugin_Continue;
  694. }
  695.  
  696. public Action Timer_UnlimitedTime(Handle timer)
  697. {
  698.     if (g_hUnlimitedTime == INVALID_HANDLE)return Plugin_Stop;
  699.     if (gc_JackpotMode.IntValue != 1)return Plugin_Stop;
  700.    
  701.     UnlimitedTime--;
  702.     if (UnlimitedTime == 0) {
  703.         g_hUnlimitedTime = INVALID_HANDLE;
  704.         ForceWinJackpot(JackpotUnlimitedPrice, false, false, false, true);
  705.     }
  706.     return Plugin_Continue;
  707. }
  708.  
  709. void ForceWinJackpot(ArrayList Jackpot, bool low, bool medium, bool high, bool unlimited)
  710. {
  711.     if (Jackpot.Length > 0)
  712.     {
  713.         int winner = Jackpot.Get(GetRandomInt(0, Jackpot.Length - 1));
  714.         int winner_jackpot = GetClientOfUserId(winner);
  715.         if (!IsValidPlayer(winner_jackpot))
  716.         {
  717.             CPrintToChatAll("\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "Winner no found");
  718.             for (int i = 0; i < Jackpot.Length; i++)
  719.             {
  720.                 winner = Jackpot.Get(GetRandomInt(0, Jackpot.Length - 1));
  721.                 winner_jackpot = GetClientOfUserId(winner);
  722.                
  723.                 if (IsValidPlayer(winner_jackpot))break;
  724.             }
  725.         }
  726.         if (!IsValidPlayer(winner_jackpot)) {
  727.             CPrintToChatAll("\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "Nobody is winner", Jackpot.Length, CurrencyString);
  728.             if (low)JackpotLowPrice.Clear();
  729.             else if (medium)JackpotMediumPrice.Clear();
  730.             else if (high)JackpotHighPrice.Clear();
  731.             else if (unlimited)JackpotUnlimitedPrice.Clear();
  732.            
  733.             return;
  734.         }
  735.        
  736.         AddMoney(winner_jackpot, Jackpot.Length);
  737.         if (low)
  738.         {
  739.             for (int i = 1; i <= MaxClients; i++)
  740.             {
  741.                 if (IsValidPlayer(i) && LowPrice[i])
  742.                 {
  743.                     g_Used[i] = false;
  744.                     LowPrice[i] = false;
  745.                     g_bLow[i] = false;
  746.                     g_iSpend[i] = 0;
  747.                 }
  748.             }
  749.             CPrintToChatAll("\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "Low Price Winner", winner_jackpot, Jackpot.Length, CurrencyString);
  750.             JackpotLowPrice.Clear();
  751.         }
  752.         else if (medium)
  753.         {
  754.             for (int i = 1; i <= MaxClients; i++)
  755.             {
  756.                 if (IsValidPlayer(i) && MediumPrice[i])
  757.                 {
  758.                     g_Used[i] = false;
  759.                     MediumPrice[i] = false;
  760.                     g_bMedium[i] = false;
  761.                     g_iSpend[i] = 0;
  762.                 }
  763.             }
  764.             CPrintToChatAll("\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "Medium Price Winner", winner_jackpot, Jackpot.Length, CurrencyString);
  765.             JackpotMediumPrice.Clear();
  766.         }
  767.         else if (high)
  768.         {
  769.             for (int i = 1; i <= MaxClients; i++)
  770.             {
  771.                 if (IsValidPlayer(i) && HighPrice[i])
  772.                 {
  773.                     g_Used[i] = false;
  774.                     HighPrice[i] = false;
  775.                     g_bHigh[i] = false;
  776.                     g_iSpend[i] = 0;
  777.                 }
  778.             }
  779.             CPrintToChatAll("\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "High Price Winner", winner_jackpot, Jackpot.Length, CurrencyString);
  780.             JackpotHighPrice.Clear();
  781.         }
  782.         else if (unlimited)
  783.         {
  784.             for (int i = 1; i <= MaxClients; i++)
  785.             {
  786.                 if (IsValidPlayer(i) && UnlimitedPrice[i])
  787.                 {
  788.                     g_Used[i] = false;
  789.                     UnlimitedPrice[i] = false;
  790.                     g_bUnlimited[i] = false;
  791.                     g_iSpend[i] = 0;
  792.                 }
  793.             }
  794.             CPrintToChatAll("\x01\x0B\x07[%s -> Jackpot]\x04 %t", MOD_TAG, "Unlimited Price Winner", winner_jackpot, Jackpot.Length, CurrencyString);
  795.             JackpotUnlimitedPrice.Clear();
  796.         }
  797.     }
  798. }
  799.  
  800. int GetPlayerCount(bool low, bool medium, bool high, bool unlimited)
  801. {
  802.     int count;
  803.     if (low) {
  804.         for (int i = 1; i <= MaxClients; i++) {
  805.             if (IsValidPlayer(i) && LowPrice[i])count++;
  806.         }
  807.     }
  808.     else if (medium) {
  809.         for (int i = 1; i <= MaxClients; i++) {
  810.             if (IsValidPlayer(i) && MediumPrice[i])count++;
  811.         }
  812.     }
  813.     else if (high) {
  814.         for (int i = 1; i <= MaxClients; i++) {
  815.             if (IsValidPlayer(i) && HighPrice[i])count++;
  816.         }
  817.     }
  818.     else if (unlimited) {
  819.         for (int i = 1; i <= MaxClients; i++) {
  820.             if (IsValidPlayer(i) && UnlimitedPrice[i])count++;
  821.         }
  822.     }
  823.     return count;
  824. }
  825.  
  826. void NotifyServer()
  827. {
  828.     if (g_bShopBrum)PrintToServer("Jackpot using dr_shop by Brum Brum");
  829.     else if (g_bShopZephyrus)PrintToServer("Jackpot using Store by Zephyrus");
  830.     else if (g_bShopFrozeDark)PrintToServer("Jackpot using Shop by FrozDark");
  831.     else if (g_bShopYamakashi)PrintToServer("Jackpot using Credits by Yamakashi");
  832.     else if (g_bShopGoMod)PrintToServer("Jackpot using Credits by GoMod");
  833. }
  834.  
  835. void AddMoney(int client, int count)
  836. {
  837.     if (!IsValidPlayer(client))return;
  838.     if (!g_bShopBrum && !g_bShopZephyrus && !g_bShopFrozeDark && !g_bShopYamakashi && !g_bShopGoMod) {
  839.         LogError("[ERROR] Jackpot cannot detect any shop [ERROR]");
  840.         return;
  841.     }
  842.    
  843.    
  844.     if (g_bShopBrum)dr_AddMoney(client, count);
  845.     else if (g_bShopZephyrus)Store_SetClientCredits(client, Store_GetClientCredits(client) + count);
  846.     else if (g_bShopFrozeDark)Shop_SetClientCredits(client, Shop_GetClientCredits(client) + count);
  847.     else if (g_bShopYamakashi)shop_add_credits(client, count);
  848.     else if (g_bShopGoMod)GoMod_AddEuro(client, count);
  849. }
  850.  
  851. int GetMoney(int client)
  852. {
  853.     if (!IsValidPlayer(client))return -1;
  854.     if (!g_bShopBrum && !g_bShopZephyrus && !g_bShopFrozeDark && !g_bShopYamakashi && !g_bShopGoMod) {
  855.         LogError("[ERROR] Jackpot cannot detect any shop [ERROR]");
  856.         return -1;
  857.     }
  858.    
  859.     if (g_bShopBrum)return dr_GetMoneyAmount(client);
  860.     else if (g_bShopZephyrus)return Store_GetClientCredits(client);
  861.     else if (g_bShopFrozeDark)return Shop_GetClientCredits(client);
  862.     else if (g_bShopYamakashi)return shop_get_credits(client);
  863.     else if (g_bShopGoMod)return GoMod_GetEuro(client);
  864.    
  865.     return -1;
  866. }
  867.  
  868. void RemoveMoney(int client, int count)
  869. {
  870.     if (!IsValidPlayer(client))return;
  871.     if (!g_bShopBrum && !g_bShopZephyrus && !g_bShopFrozeDark && !g_bShopYamakashi && !g_bShopGoMod) {
  872.         LogError("[ERROR] Jackpot cannot detect any shop [ERROR]");
  873.         return;
  874.     }
  875.    
  876.     if (g_bShopBrum)dr_RemoveMoney(client, count);
  877.     else if (g_bShopZephyrus)Store_SetClientCredits(client, Store_GetClientCredits(client) - count);
  878.     else if (g_bShopFrozeDark)Shop_SetClientCredits(client, Shop_GetClientCredits(client) - count);
  879.     else if (g_bShopYamakashi)shop_set_credits(client, shop_get_credits(client) - count);
  880.     else if (g_bShopGoMod)GoMod_AddEuro(client, GoMod_GetEuro(client) - count);
  881. }
  882.  
  883. public bool IsValidPlayer(int client)
  884. {
  885.     if (!(1 <= client <= MaxClients) || !IsClientInGame(client) || !IsClientConnected(client) || IsFakeClient(client) || IsClientSourceTV(client))
  886.         return false;
  887.    
  888.     return true;
  889. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement