- Changed data loading to non-block main thread
- Additional check for empty agent
This commit is contained in:
Dawid Bepierszcz
2024-03-11 11:10:25 +01:00
parent ad8e51a403
commit ced010645d
5 changed files with 49 additions and 30 deletions

View File

@@ -300,14 +300,17 @@ namespace WeaponPaints
{
if (!g_playersAgent.ContainsKey(player.Slot)) return;
string? model = player.TeamNum == 3 ? g_playersAgent[player.Slot].CT : g_playersAgent[player.Slot].T;
if (string.IsNullOrEmpty(model)) return;
if (player.PlayerPawn.Value == null)
return;
try
{
Server.NextFrame(() =>
{
string? model = player.TeamNum == 3 ? g_playersAgent[player.Slot].CT : g_playersAgent[player.Slot].T;
if (string.IsNullOrEmpty(model)) return;
player.PlayerPawn.Value!.SetModel(
player.PlayerPawn.Value.SetModel(
$"characters/models/{model}.vmdl"
);
});