diff --git a/WeaponsGiver.cs b/WeaponsGiver.cs index 5dd88ef..ea8af59 100644 --- a/WeaponsGiver.cs +++ b/WeaponsGiver.cs @@ -1,16 +1,12 @@ using CounterStrikeSharp.API; using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core.Attributes; -using CounterStrikeSharp.API.Modules.Memory; -using CounterStrikeSharp.API.Modules.Entities.Constants; using CounterStrikeSharp.API.Modules.Cvars; using CounterStrikeSharp.API.Modules.Utils; -using System; -using System.Timers; namespace WeaponsGiver { - [MinimumApiVersion(175)] + [MinimumApiVersion(198)] public class WeaponsGiver : BasePlugin { private string tPrimary; @@ -23,7 +19,7 @@ public class WeaponsGiver : 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 => "build5"; + public override string ModuleVersion => "build6"; public override void Load(bool hotReload) { @@ -50,13 +46,14 @@ private HookResult Event_RoundPrestart(EventRoundPrestart @event, GameEventInfo private HookResult Event_PlayerSpawn(EventPlayerSpawn @event, GameEventInfo info) { - this.AddTimer(1, ()=>GiveWeapons(@event.Userid)); + Server.RunOnTick(Server.TickCount + 1, () => GiveWeapons(@event.Userid)); return HookResult.Continue; } private void GiveWeapons(CCSPlayerController player) { - if(!player.IsValid || !player.PlayerPawn.IsValid) return; + if(!player.IsValid || !player.PlayerPawn.IsValid) return; + if (player.Connected != PlayerConnectedState.PlayerConnected) return; switch((CsTeam)player.TeamNum) { diff --git a/WeaponsGiver.csproj b/WeaponsGiver.csproj index 9f1ee7f..0fd2cd9 100644 --- a/WeaponsGiver.csproj +++ b/WeaponsGiver.csproj @@ -7,6 +7,6 @@ - +