altmp / coreclr-module

CoreClr (.NET Core Common Language Runtime) community made module
MIT License
17 stars 8 forks source link

Client crash on GetWeaponDataByWeaponHash #25

Open TuK4z opened 3 months ago

TuK4z commented 3 months ago

When enter Hydra or Tank client event "WeaponChange" returns newweapon as 0 leading to crash when use Alt.GetWeaponDataByWeaponHash(newweapon)

Doxoh commented 2 months ago

please provide full repo code

TuK4z commented 2 months ago

Sorry.

Clientside: Alt.OnPlayerWeaponChange += (oldweapon, newweapon) => { AltV.Net.Client.Elements.Data.WeaponData? wData = Alt.GetWeaponDataByWeaponHash(newweapon); };

When entering hydra for example after one of the latest release updates ir started to return 0. I added check if (newweapon == 0) return;

It's not a big problem but reporting, because it crash if you use GetWeaponDataByWeaponHash(0)