Skip to content

Commit

Permalink
Update WeaponPaints.cs
Browse files Browse the repository at this point in the history
Temporary fix for player loading
  • Loading branch information
daffyyyy authored Nov 14, 2023
1 parent b4f8bdb commit 2c0fad2
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions WeaponPaints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,14 @@ public override void Load(bool hotReload)
{
MySql = new MySqlDb(Config.DatabaseHost!, Config.DatabaseUser!, Config.DatabasePassword!, Config.DatabaseName!, Config.DatabasePort);
RegisterListener<Listeners.OnEntitySpawned>(OnEntitySpawned);
RegisterListener<Listeners.OnClientAuthorized>(OnClientAuthorized);
RegisterListener<Listeners.OnClientPutInServer>(OnClientPutInServer);
RegisterListener<Listeners.OnClientDisconnect>(OnClientDisconnect);
}
public void OnConfigParsed(WeaponPaintsConfig config)
{
Config = config;
}
private void OnClientAuthorized(int playerSlot, SteamID steamId)

private void OnClientPutInServer(int playerSlot)
{
int slot = playerSlot;
Server.NextFrame(() =>
Expand Down Expand Up @@ -144,11 +143,11 @@ public CSkeletonInstance GetSkeletonInstance(CGameSceneNode node)
Func<nint, nint> GetSkeletonInstance = VirtualFunction.Create<nint, nint>(node.Handle, 8);
return new CSkeletonInstance(GetSkeletonInstance(node.Handle));
}
private async Task GetWeaponPaintsFromDatabase(int playerIndex)
private async Task GetWeaponPaintsFromDatabase(int playerSlot)
{
try
{
CCSPlayerController player = Utilities.GetPlayerFromIndex(playerIndex);
CCSPlayerController player = Utilities.GetPlayerFromSlot(playerSlot);
if (player == null || !player.IsValid) return;
var steamId = new SteamID(player.SteamID);

Expand Down Expand Up @@ -187,4 +186,4 @@ private async Task GetWeaponPaintsFromDatabase(int playerIndex)
return;
}
}
}
}

0 comments on commit 2c0fad2

Please sign in to comment.