Skip to content

Commit 3113fbd

Browse files
committed
fix: enityt removed on round end/round start.
1 parent aeb2f88 commit 3113fbd

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

Extensions/Extensions.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,16 @@ public static void Unfreeze(this CCSPlayerController player)
6464
}
6565
public static void ChangeMoveType(this CBasePlayerPawn pawn, MoveType_t movetype)
6666
{
67+
if (pawn.Handle == IntPtr.Zero)
68+
{
69+
return;
70+
}
71+
6772
pawn.MoveType = movetype;
6873
Schema.SetSchemaValue(pawn.Handle, "CBaseEntity", "m_nActualMoveType", movetype);
6974
Utilities.SetStateChanged(pawn, "CBaseEntity", "m_MoveType");
7075
}
76+
7177
}
7278
public static class WorldTextExtensions
7379
{

Internal/ScreenMenuInstance.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,15 @@ private HookResult OnRoundStart(EventRoundStart @event, GameEventInfo info)
122122
if (MenuAPI.GetActiveMenu(_player) != this)
123123
return HookResult.Continue;
124124

125-
_plugin.AddTimer(0.1f, RecreateHud);
125+
_plugin.AddTimer(0.1f, () =>
126+
{
127+
ScreenMenu menu = _menu;
128+
Close();
129+
if (menu.IsSubMenu)
130+
MenuAPI.OpenSubMenu(_plugin, _player, menu);
131+
else
132+
MenuAPI.OpenMenu(_plugin, _player, menu);
133+
});
126134
return HookResult.Continue;
127135
}
128136
private HookResult OnRoundEnd(EventRoundEnd @event, GameEventInfo info)

0 commit comments

Comments
 (0)