diff --git a/src/LastRequest/Dodgeball.cs b/src/LastRequest/Dodgeball.cs index 37473fa..c2ad917 100644 --- a/src/LastRequest/Dodgeball.cs +++ b/src/LastRequest/Dodgeball.cs @@ -59,7 +59,7 @@ public override void player_hurt(int damage, int health, int hitgroup) public override void grenade_thrown() { CCSPlayerController? player = Utilities.GetPlayerFromSlot(player_slot); - Lib.give_event_nade_delay(player,1.4f,"weapon_flashbang"); + give_lr_nade_delay(1.4f,"weapon_flashbang"); } public override void ent_created(CEntityInstance entity) diff --git a/src/LastRequest/Grenade.cs b/src/LastRequest/Grenade.cs index 1d4dcc6..6c7b68d 100644 --- a/src/LastRequest/Grenade.cs +++ b/src/LastRequest/Grenade.cs @@ -50,6 +50,6 @@ public override void grenade_thrown() { CCSPlayerController? player = Utilities.GetPlayerFromSlot(player_slot); player.strip_weapons(true); - Lib.give_event_nade_delay(player,1.4f,"weapon_hegrenade"); + give_lr_nade_delay(1.4f,"weapon_hegrenade"); } } \ No newline at end of file diff --git a/src/LastRequest/LRBase.cs b/src/LastRequest/LRBase.cs index 1e6e5df..70c7e23 100644 --- a/src/LastRequest/LRBase.cs +++ b/src/LastRequest/LRBase.cs @@ -226,6 +226,28 @@ public virtual bool weapon_equip(String name) return (winner,loser,winner_lr); } + + public void give_lr_nade_delay(float delay, String name) + { + if(JailPlugin.global_ctx == null) + { + return; + } + + JailPlugin.global_ctx.AddTimer(delay,() => + { + CCSPlayerController? player = Utilities.GetPlayerFromSlot(player_slot); + + // need to double check LR is actually still active... + if(player != null && player.is_valid_alive() && manager.in_lr(player)) + { + //Server.PrintToChatAll("give nade"); + player.strip_weapons(true); + player.GiveNamedItem(name); + } + }); + } + static public void print_countdown(LRBase lr, int delay) { if(lr.partner == null) diff --git a/src/Lib.cs b/src/Lib.cs index fc85de9..b778637 100644 --- a/src/Lib.cs +++ b/src/Lib.cs @@ -302,12 +302,8 @@ static public void strip_weapons(this CCSPlayerController? player, bool remove_k return; } - // buggy on windows (Wrong gamedata issue) - if(!is_windows()) - { - player.RemoveWeapons(); - } - + player.RemoveWeapons(); + // dont remove knife its buggy if(!remove_knife) { diff --git a/src/Stats.cs b/src/Stats.cs index 0d528b1..07b8f01 100644 --- a/src/Stats.cs +++ b/src/Stats.cs @@ -145,7 +145,7 @@ async void insert_player(String steam_id, String player_name) public void inc_db(CCSPlayerController? player,LastRequest.LRType type, bool win) { - if(player == null || !player.is_valid() || type == LastRequest.LRType.NONE) + if(player == null || !player.is_valid() || type == LastRequest.LRType.NONE || player.IsBot) { return; }