Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Weapon give bug after warmup #302

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ private void OnCommandRefresh(CCSPlayerController? player, CommandInfo command)

try
{
if (WeaponPaints.Utility.IsWarmup) {
player!.Print(Localizer["wp_command_disable_warmup"])
return;
}
if (player != null && !commandsCooldown.TryGetValue(player.Slot, out var cooldownEndTime) ||
player != null && DateTime.UtcNow >= (commandsCooldown.TryGetValue(player.Slot, out cooldownEndTime) ? cooldownEndTime : DateTime.UtcNow))
{
Expand Down
15 changes: 15 additions & 0 deletions Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@ namespace WeaponPaints
{
internal static class Utility
{
CCSGameRules? gameRules = null;

void GetGameRules() => gameRules = Utilities.FindAllEntitiesByDesignerName<CCSGameRulesProxy>("cs_gamerules").First().GameRules!;

public bool IsWarmup
{
get
{
if (gameRules is null)
GetGameRules();

return gameRules is not null && gameRules.WarmupPeriod;
}
}

internal static WeaponPaintsConfig? Config { get; set; }

internal static async Task CheckDatabaseTables()
Expand Down
Empty file added lang/bg.json
Empty file.
41 changes: 21 additions & 20 deletions lang/en.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
{
"wp_prefix": "{lightblue}[WeaponPaints] {default}",
"wp_info_website": "Visit {lime}{0}{default} where you can change skins",
"wp_info_refresh": "Type {lime}!wp{default} to synchronize chosen skins",
"wp_info_knife": "Type {lime}!knife{default} to open knife menu",
"wp_info_glove": "Type {lime}!gloves{default} to open gloves menu",
"wp_info_agent": "Type {lime}!agents{default} to open agents menu",
"wp_info_music": "Type {lime}!music{default} to open music menu",
"wp_command_cooldown": "{lightred}You can't refresh weapon paints right now",
"wp_command_refresh_done": "{lime}Refreshing weapon paints",
"wp_knife_menu_select": "You have chosen {lime}{0}{default} as your knife",
"wp_info_website": "Посетете {lime}{0}{default}, където можете да променяте скинове",
"wp_info_refresh": "Напишете {lime}!wp{default}, за да синхронизирате избраните скинове",
"wp_info_knife": "Напишете {lime}!knife{default}, за да отворите менюто за ножове",
"wp_info_glove": "Напишете {lime}!gloves{default}, за да отворите менюто за ръкавици",
"wp_info_agent": "Напишете {lime}!agents{default}, за да отворите менюто за агенти",
"wp_info_music": "Напишете {lime}!music{default}, за да отворите менюто за музика",
"wp_command_cooldown": "{lightred}Не можете да обновявате скинове в момента",
"wp_command_refresh_done": "{lime}Обновяване на скинове",
"wp_command_disable_warmup": "{lightred}Не можете да обновявате скинове по време на загрявка",
"wp_knife_menu_select": "Избрахте {lime}{0}{default} като ваш нож",
"wp_knife_menu_kill": "",
"wp_knife_menu_title": "Knife Menu",
"wp_glove_menu_select": "You have chosen {lime}{0}{default} as your glove",
"wp_glove_menu_title": "Gloves Menu",
"wp_agent_menu_select": "You have chosen {lime}{0}{default} as your agent",
"wp_agent_menu_title": "Agents Menu",
"wp_music_menu_title": "Music Menu",
"wp_music_menu_select": "You have chosen {lime}{0}{default} as your music kit",
"wp_skin_menu_weapon_title": "Weapon Menu",
"wp_skin_menu_skin_title": "Select skin for {lime}{0}{default}",
"wp_skin_menu_select": "You have chosen {lime}{0}{default} as your skin",
"wp_knife_menu_title": "Меню за ножове",
"wp_glove_menu_select": "Избрахте {lime}{0}{default} като вашите ръкавици",
"wp_glove_menu_title": "Меню за ръкавици",
"wp_agent_menu_select": "Избрахте {lime}{0}{default} като ваш агент",
"wp_agent_menu_title": "Меню за агенти",
"wp_music_menu_title": "Меню за музика",
"wp_music_menu_select": "Избрахте {lime}{0}{default} като ваш музикален комплект",
"wp_skin_menu_weapon_title": "Меню за оръжия",
"wp_skin_menu_skin_title": "Изберете скин за {lime}{0}{default}",
"wp_skin_menu_select": "Избрахте {lime}{0}{default} като ваш скин",

"None": "None"
"None": "Няма"
}
1 change: 1 addition & 0 deletions lang/lv.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"wp_info_music": "Ievadiet {lime}!music{default}, lai atvērtu mūzikas izvēlni",
"wp_command_cooldown": "{lightred}Šobrīd nevarat atsvaidzināt ieroča krāsas",
"wp_command_refresh_done": "{lime}Atsvaidzinot ieroča krāsas",
"wp_command_disable_warmup": "{lightred}Jūs nevarat atsvaidzināt apvalkus iesildīšanās laikā",
"wp_knife_menu_select": "Jūs esat izvēlējies {lime}{0}{default} kā savu nazi",
"wp_knife_menu_kill": "",
"wp_knife_menu_title": "Nazi Izvēlne",
Expand Down
1 change: 1 addition & 0 deletions lang/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"wp_info_music": "Wpisz {lime}!music{default}, aby otworzyć menu muzyczne",
"wp_command_cooldown": "{lightred}Nie możesz teraz odświeżyć kolorów broni",
"wp_command_refresh_done": "{lime}Odświeżanie kolorów broni",
"wp_command_disable_warmup": "{lightred}Nie możesz odświeżać skinów podczas rozgrzewki",
"wp_knife_menu_select": "Wybrałeś {lime}{0}{default} jako swój nóż",
"wp_knife_menu_kill": "",
"wp_knife_menu_title": "Menu Noży",
Expand Down
1 change: 1 addition & 0 deletions lang/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"wp_info_music": "Digite {lime}!music{default} para abrir o menu de música",
"wp_command_cooldown": "{lightred}Você não pode atualizar as skins de armas agora",
"wp_command_refresh_done": "{lime}Atualizando as skins de armas",
"wp_command_disable_warmup": "{lightred}Você não pode atualizar as skins durante o aquecimento",
"wp_knife_menu_select": "Você escolheu {lime}{0}{default} como sua faca",
"wp_knife_menu_kill": "",
"wp_knife_menu_title": "Menu de Facas",
Expand Down
1 change: 1 addition & 0 deletions lang/pt-PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"wp_info_music": "Digite {lime}!music{default} para abrir o menu de música",
"wp_command_cooldown": "{lightred}Não pode atualizar as skins de armas de momento",
"wp_command_refresh_done": "{lime}Atualizando as skins de armas",
"wp_command_disable_warmup": "{lightred}Não podes atualizar as skins durante o aquecimento",
"wp_knife_menu_select": "Escolheu {lime}{0}{default} como a sua faca",
"wp_knife_menu_kill": "",
"wp_knife_menu_title": "Menu de Facas",
Expand Down
1 change: 1 addition & 0 deletions lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"wp_info_music": "Введите {lime}!music{default}, чтобы открыть меню музыки",
"wp_command_cooldown": "{lightred}Вы не можете обновить раскраску оружия сейчас",
"wp_command_refresh_done": "{lime}Обновление раскраски оружия",
"wp_command_disable_warmup": "{lightred}Вы не можете обновить скины во время разминки",
"wp_knife_menu_select": "Вы выбрали {lime}{0}{default} в качестве вашего ножа",
"wp_knife_menu_kill": "",
"wp_knife_menu_title": "Меню Ножей",
Expand Down
1 change: 1 addition & 0 deletions lang/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"wp_info_music": "Müzik menüsünü açmak için {lime}!music{default} yazın",
"wp_command_cooldown": "{lightred}Şu anda silah boyalarını yenileyemezsiniz",
"wp_command_refresh_done": "{lime}Silah boyaları yenileniyor",
"wp_command_disable_warmup": "{lightred}Isınma sırasında skin'leri yenileyemezsiniz",
"wp_knife_menu_select": "{lime}{0}{default} olarak bıçağınızı seçtiniz",
"wp_knife_menu_kill": "",
"wp_knife_menu_title": "Bıçak Menüsü",
Expand Down
1 change: 1 addition & 0 deletions lang/ua.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"wp_info_music": "Введіть {lime}!music{default}, щоб відкрити меню музики",
"wp_command_cooldown": "{lightred}Ви не можете оновити фарби зброї зараз",
"wp_command_refresh_done": "{lime}Оновлення фарби зброї",
"wp_command_disable_warmup": "{lightred}Ви не можете оновити скіни під час розігріву",
"wp_knife_menu_select": "Ви обрали {lime}{0}{default} як свій ніж",
"wp_knife_menu_kill": "",
"wp_knife_menu_title": "Меню Ножів",
Expand Down
1 change: 1 addition & 0 deletions lang/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"wp_info_music": "输入 {lime}!music{default} 打开音乐菜单",
"wp_command_cooldown": "{lightred}您现在无法刷新武器涂装",
"wp_command_refresh_done": "{lime}正在刷新武器涂装",
"wp_command_disable_warmup": "{lightred}你不能在热身期间刷新皮肤",
"wp_knife_menu_select": "您选择了 {lime}{0}{default} 作为您的刀具",
"wp_knife_menu_kill": "",
"wp_knife_menu_title": "刀具菜单",
Expand Down