From cab3150cbb909b25eedbed2b5ea84a22bb7e14fc Mon Sep 17 00:00:00 2001 From: schwarper <75811921+schwarper@users.noreply.github.com> Date: Mon, 26 Aug 2024 22:50:37 +0300 Subject: [PATCH 1/3] 1.3 --- Store/lang/ch.json | 1 + Store/lang/en.json | 1 + Store/lang/pt-BR.json | 1 + Store/lang/ro.json | 1 + Store/lang/ru.json | 1 + Store/lang/sl.json | 1 + Store/lang/tr.json | 1 + Store/lang/ua.json | 1 + Store/src/command/command.cs | 8 ++++++++ Store/src/cs2-store.cs | 1 + Store/src/event/event.cs | 3 +++ 11 files changed, 20 insertions(+) diff --git a/Store/lang/ch.json b/Store/lang/ch.json index b7d4519..49a9d16 100644 --- a/Store/lang/ch.json +++ b/Store/lang/ch.json @@ -10,6 +10,7 @@ "No in pistol round": "{white}手枪局无法购买{green}{0}{white}.", "No gift yourself": "{white}无法给自己赠送金币.", "No type found": "{white}没有找到这个类型,请重新输入.", + "Gift timeout": "{white}你需要等待 {green}{0} 秒 {white}后才能赠送.", "t team players": "{green}T阵营{white}玩家", "ct team players": "{green}CT阵营{white}玩家", diff --git a/Store/lang/en.json b/Store/lang/en.json index c7854a9..1195ca9 100644 --- a/Store/lang/en.json +++ b/Store/lang/en.json @@ -10,6 +10,7 @@ "No in pistol round": "{white}You cannot buy this item {green}{0} {white} in pistol round.", "No gift yourself": "{white}You cannot gift credits to yourself.", "No type found": "{white}No type found.", + "Gift timeout": "{white}You need to wait {green}{0} seconds {white}to gift.", "t team players": "{green}t team {white}players", "ct team players": "{green}ct team {white}players", diff --git a/Store/lang/pt-BR.json b/Store/lang/pt-BR.json index c68dc57..3b62ad3 100644 --- a/Store/lang/pt-BR.json +++ b/Store/lang/pt-BR.json @@ -10,6 +10,7 @@ "No in pistol round": "{white}Você não pode comprar este item {green}{0} {white} na rodada de pistola.", "No gift yourself": "{white}Você não pode presentear a si mesmo.", "No type found": "{white}Nenhum tipo encontrado.", + "Gift timeout": "{white}Você precisa esperar {green}{0} segundos {white}para enviar o presente.", "t team players": "{green}Jogadores de team t{white}", "ct team players": "{green}Jogadores de team ct{white}", diff --git a/Store/lang/ro.json b/Store/lang/ro.json index 6253fa7..05607cb 100644 --- a/Store/lang/ro.json +++ b/Store/lang/ro.json @@ -10,6 +10,7 @@ "No in pistol round": "{white}Nu poți cumpăra acest obiect {green}{0} {white}în runda de pistol.", "No gift yourself": "{white}Nu poți trimite credite către tine însuți.", "No type found": "{white}Nu a fost găsit niciun tip.", + "Gift timeout": "{white}Trebuie să aștepți {green}{0} secunde {white}pentru a oferi cadoul.", "t team players": "{green}jucători echipa T {white}", "ct team players": "{green}jucători echipa CT {white}", diff --git a/Store/lang/ru.json b/Store/lang/ru.json index 60bc48d..738e740 100644 --- a/Store/lang/ru.json +++ b/Store/lang/ru.json @@ -10,6 +10,7 @@ "No in pistol round": "{white}Вы не сможете купить этот предмет {green}{0} {white} в пистолетном раунде.", "No gift yourself": "{white}Вы не можете подарить кредиты сами себе.", "No type found": "{white}Тип не найден.", + "Gift timeout": "{white}Вам нужно подождать {green}{0} секунд {white}перед тем, как отправить подарок.", "t team players": "{green}Игроки {white}в команде t team", "ct team players": "{green}Игроки {white}в команде ct team", diff --git a/Store/lang/sl.json b/Store/lang/sl.json index 29050fb..e2f78d8 100644 --- a/Store/lang/sl.json +++ b/Store/lang/sl.json @@ -10,6 +10,7 @@ "No in pistol round": "{white}Tento predmet nemôžete použiť {green}{0} {white}v pištoľnom kole.", "No gift yourself": "{white}Ne morete darovati kreditov samemu sebi.", "No type found": "{white}Samemu sebi ne morete podariti kreditov.", + "Gift timeout": "{white}Počakati moraš {green}{0} sekund {white}preden lahko podariš darilo.", "t team players": "{green}Zaporniki", "ct team players": "{green}Pazniki", diff --git a/Store/lang/tr.json b/Store/lang/tr.json index f1619ed..e6284e0 100644 --- a/Store/lang/tr.json +++ b/Store/lang/tr.json @@ -10,6 +10,7 @@ "No in pistol round": "{white}Bu ürünü {green}{0} {white}tabanca turunda alamazsınız.", "No gift yourself": "{white}Kendine kredi hediye edemezsin.", "No type found": "{white}Böyle bir type bulunamadı.", + "Gift timeout": "{white}Kredi hediye etmek için {green}{0} saniye {white}beklemelisin.", "t team players": "{green}t takımı {white}oyuncularını", "ct team players": "{green}ct takımı {white}oyuncularını", diff --git a/Store/lang/ua.json b/Store/lang/ua.json index b932de0..0fa5153 100644 --- a/Store/lang/ua.json +++ b/Store/lang/ua.json @@ -10,6 +10,7 @@ "No in pistol round": "{white}Ви не зможете купити цей предмет {green}{0} {white} у пістолетному раунді.", "No gift yourself": "{white}Ви не можете подарувати кредити самому собі.", "No type found": "{white}Тип не знайдено.", + "Gift timeout": "{white}Вам потрібно зачекати {green}{0} секунд {white}щоб зробити подарунок.", "t team players": "{green}Гравці {white}у команді t team", "ct team players": "{green}Гравці {white}у команді ct team", diff --git a/Store/src/command/command.cs b/Store/src/command/command.cs index dc8403e..387375e 100644 --- a/Store/src/command/command.cs +++ b/Store/src/command/command.cs @@ -132,6 +132,12 @@ public static void Command_Gift(CCSPlayerController? player, CommandInfo command return; } + if (Instance.GlobalGiftTimeout[player] > Server.CurrentTime) + { + command.ReplyToCommand(Config.Tag + Instance.Localizer["Gift timeout", Instance.GlobalGiftTimeout[player] - Server.CurrentTime]); + return; + } + (List players, _) = FindTarget.Find(command, 2, false); if (players == null) @@ -174,6 +180,8 @@ public static void Command_Gift(CCSPlayerController? player, CommandInfo command Credits.Give(player, -value); Credits.Give(target, value); + Instance.GlobalGiftTimeout[player] = Server.CurrentTime + 5.0f; + player.PrintToChatMessage("css_gift", target.PlayerName, value); target.PrintToChatMessage("css_gift", player.PlayerName, value); } diff --git a/Store/src/cs2-store.cs b/Store/src/cs2-store.cs index c2d9e2c..7c3f802 100644 --- a/Store/src/cs2-store.cs +++ b/Store/src/cs2-store.cs @@ -21,6 +21,7 @@ public class Store : BasePlugin, IPluginConfig public int GlobalTickrate { get; set; } = 0; public static Store Instance { get; set; } = new(); public Random Random { get; set; } = new(); + public Dictionary GlobalGiftTimeout { get; set; } = []; public override void Load(bool hotReload) { diff --git a/Store/src/event/event.cs b/Store/src/event/event.cs index 5daf812..e7d9e72 100644 --- a/Store/src/event/event.cs +++ b/Store/src/event/event.cs @@ -193,6 +193,8 @@ public static HookResult OnPlayerConnectFull(EventPlayerConnectFull @event, Game Instance.GlobalDictionaryPlayer.Add(player, value); } + Instance.GlobalGiftTimeout.Add(player, 0); + Database.UpdateVip(player); return HookResult.Continue; @@ -219,6 +221,7 @@ public static HookResult OnPlayerDisconnect(EventPlayerDisconnect @event, GameEv Instance.GlobalStorePlayers.RemoveAll(p => p.SteamID == player.SteamID); Instance.GlobalStorePlayerItems.RemoveAll(i => i.SteamID == player.SteamID); Instance.GlobalStorePlayerEquipments.RemoveAll(e => e.SteamID == player.SteamID); + Instance.GlobalGiftTimeout.Remove(player); return HookResult.Continue; } From b8704d783a34282e0fa2b9df79be85f394a9a116 Mon Sep 17 00:00:00 2001 From: schwarper <75811921+schwarper@users.noreply.github.com> Date: Mon, 26 Aug 2024 23:46:10 +0300 Subject: [PATCH 2/3] Update command.cs --- Store/src/command/command.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Store/src/command/command.cs b/Store/src/command/command.cs index 387375e..f778a5a 100644 --- a/Store/src/command/command.cs +++ b/Store/src/command/command.cs @@ -134,7 +134,7 @@ public static void Command_Gift(CCSPlayerController? player, CommandInfo command if (Instance.GlobalGiftTimeout[player] > Server.CurrentTime) { - command.ReplyToCommand(Config.Tag + Instance.Localizer["Gift timeout", Instance.GlobalGiftTimeout[player] - Server.CurrentTime]); + command.ReplyToCommand(Config.Tag + Instance.Localizer["Gift timeout", Math.Ceiling(Instance.GlobalGiftTimeout[player] - Server.CurrentTime)]); return; } @@ -258,4 +258,4 @@ public static void Command_ResetPlayer(CCSPlayerController? player, CommandInfo Server.PrintToChatAll(Config.Tag + Instance.Localizer["css_reset", player?.PlayerName ?? "Console", target.PlayerName]); } -} \ No newline at end of file +} From 368c63031fc41d9c4d5b9b120c83111ed8f24c04 Mon Sep 17 00:00:00 2001 From: schwarper <75811921+schwarper@users.noreply.github.com> Date: Mon, 26 Aug 2024 23:47:00 +0300 Subject: [PATCH 3/3] Update cs2-store.cs --- Store/src/cs2-store.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Store/src/cs2-store.cs b/Store/src/cs2-store.cs index 7c3f802..b4a6002 100644 --- a/Store/src/cs2-store.cs +++ b/Store/src/cs2-store.cs @@ -9,7 +9,7 @@ namespace Store; public class Store : BasePlugin, IPluginConfig { public override string ModuleName => "Store"; - public override string ModuleVersion => "1.2"; + public override string ModuleVersion => "1.3"; public override string ModuleAuthor => "schwarper"; public Item_Config Config { get; set; } = new Item_Config();