modusmogulus/GmodDynamicWeaponReverb

Multiplayer only clientside error when using ammo-less weapons

Closed this issue · 1 comments

Using the pulse pistol from this pack causes the following clientside error when used in multiplayer:

[Dynamic Weapon Reverb] lua/autorun/client/dwr_client.lua:521: attempt to get length of local 'ammotype' (a nil value)
  1. onPrimaryAttack - lua/autorun/client/dwr_client.lua:521
   2. v - lua/autorun/client/dwr_client.lua:537
    3. unknown - lua/includes/modules/hook.lua:96

https://github.com/modusmogulus/GmodDynamicWeaponReverb/blob/main/dwrV3/lua/autorun/client/dwr_client.lua#L505 needs a check for game.GetAmmoName() returning nil, my suggestion would be to check for weapon.dwr_customAmmoType first and either exit out or default to another value if neither return a proper ammo type.

fixed