From 69b3737f887356841f63a86d27ec7789ec6742c7 Mon Sep 17 00:00:00 2001 From: jithatsonei Date: Wed, 28 Feb 2024 23:23:36 +0000 Subject: [PATCH] update --- KnifeGiver.cs => WeaponsGiver.cs | 22 ++++++++++++---------- KnifeGiver.csproj => WeaponsGiver.csproj | 0 2 files changed, 12 insertions(+), 10 deletions(-) rename KnifeGiver.cs => WeaponsGiver.cs (78%) rename KnifeGiver.csproj => WeaponsGiver.csproj (100%) diff --git a/KnifeGiver.cs b/WeaponsGiver.cs similarity index 78% rename from KnifeGiver.cs rename to WeaponsGiver.cs index 3e6b6c0..2f5b4e6 100644 --- a/KnifeGiver.cs +++ b/WeaponsGiver.cs @@ -6,10 +6,10 @@ using CounterStrikeSharp.API.Modules.Cvars; using CounterStrikeSharp.API.Modules.Utils; -namespace KnifeGiver +namespace WeaponsGiver { [MinimumApiVersion(175)] - public class KnifeGiver : BasePlugin + public class WeaponsGiver : BasePlugin { private string tPrimary; private string tSecondary; @@ -21,27 +21,29 @@ public class KnifeGiver : BasePlugin public override string ModuleName => "WeaponsGiver"; public override string ModuleAuthor => "ji"; public override string ModuleDescription => "Ensures players in custom gamemodes spawn with starting weapons."; - public override string ModuleVersion => "build3"; + public override string ModuleVersion => "build4"; public override void Load(bool hotReload) { RegisterEventHandler(Event_PlayerSpawn, HookMode.Post); RegisterEventHandler(Event_RoundPrestart, HookMode.Pre); - GetVars(); } public void GetVars() { - tPrimary = ConVar.Find("mp_t_default_primary").StringValue; - tSecondary = ConVar.Find("mp_t_default_secondary").StringValue; - tMelee = ConVar.Find("mp_t_default_melee").StringValue; - ctPrimary = ConVar.Find("mp_ct_default_primary").StringValue; - ctSecondary = ConVar.Find("mp_ct_default_secondary").StringValue; - ctMelee = ConVar.Find("mp_ct_default_melee").StringValue; + if (!String.IsNullOrEmpty(ConVar.Find("mp_t_default_melee").StringValue())) { + tPrimary = ConVar.Find("mp_t_default_primary").StringValue; + tSecondary = ConVar.Find("mp_t_default_secondary").StringValue; + tMelee = ConVar.Find("mp_t_default_melee").StringValue; + ctPrimary = ConVar.Find("mp_ct_default_primary").StringValue; + ctSecondary = ConVar.Find("mp_ct_default_secondary").StringValue; + ctMelee = ConVar.Find("mp_ct_default_melee").StringValue; + } } private HookResult Event_RoundPrestart(EventRoundPrestart @event, GameEventInfo info) { + GetVars(); return HookResult.Continue; } diff --git a/KnifeGiver.csproj b/WeaponsGiver.csproj similarity index 100% rename from KnifeGiver.csproj rename to WeaponsGiver.csproj