Skip to content

Commit

Permalink
Merge pull request #89 from schwarper/1.3
Browse files Browse the repository at this point in the history
1.3
  • Loading branch information
schwarper committed Aug 26, 2024
2 parents 3040e07 + 368c630 commit 358e582
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions Store/lang/ch.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}玩家",
Expand Down
1 change: 1 addition & 0 deletions Store/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions Store/lang/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand Down
1 change: 1 addition & 0 deletions Store/lang/ro.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand Down
1 change: 1 addition & 0 deletions Store/lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions Store/lang/sl.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions Store/lang/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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ı",
Expand Down
1 change: 1 addition & 0 deletions Store/lang/ua.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 9 additions & 1 deletion Store/src/command/command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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", Math.Ceiling(Instance.GlobalGiftTimeout[player] - Server.CurrentTime)]);
return;
}

(List<CCSPlayerController> players, _) = FindTarget.Find(command, 2, false);

if (players == null)
Expand Down Expand Up @@ -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<player>", target.PlayerName, value);
target.PrintToChatMessage("css_gift<target>", player.PlayerName, value);
}
Expand Down Expand Up @@ -250,4 +258,4 @@ public static void Command_ResetPlayer(CCSPlayerController? player, CommandInfo

Server.PrintToChatAll(Config.Tag + Instance.Localizer["css_reset", player?.PlayerName ?? "Console", target.PlayerName]);
}
}
}
3 changes: 2 additions & 1 deletion Store/src/cs2-store.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Store;
public class Store : BasePlugin, IPluginConfig<Item_Config>
{
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();
Expand All @@ -21,6 +21,7 @@ public class Store : BasePlugin, IPluginConfig<Item_Config>
public int GlobalTickrate { get; set; } = 0;
public static Store Instance { get; set; } = new();
public Random Random { get; set; } = new();
public Dictionary<CCSPlayerController, float> GlobalGiftTimeout { get; set; } = [];

public override void Load(bool hotReload)
{
Expand Down
3 changes: 3 additions & 0 deletions Store/src/event/event.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down

0 comments on commit 358e582

Please sign in to comment.