nrlulz / ACF

Combat damage system for Garry's Mod
110 stars 116 forks source link

Server Console Error Spam - acf_ammo.lua:417: bad argument #1 to 'max' (number expected, got nil) #412

Closed abirduphigh closed 2 years ago

abirduphigh commented 2 years ago

An error spams the server console:

[acf-master] addons/acf-master/lua/entities/acf_ammo.lua:417: bad argument #1 to 'max' (number expected, got nil)
  1. max - [C]:-1
   2. UpdateMass - addons/acf-master/lua/entities/acf_ammo.lua:417
    3. unknown - addons/acf-master/lua/entities/acf_ammo.lua:484

The troublesome line in question appears to be:

self.Mass = self.EmptyMass + self.AmmoMassMax*(self.Ammo/math.max(self.Capacity,1))

I've mitigated the error spamming by changing that line to:

self.Mass = self.EmptyMass + self.AmmoMassMax*(self.Ammo)

This means the mass of the ammo crate no longer decreases but the error has vanished.

abirduphigh commented 2 years ago

I ended up replacing acf_ammo.lua with a copy of my client version and everything seems to be working normally now with no errors. I believe this was an issue with the file on our server, which appears to have been tampered with or outdated. I apologize for the unnecessary post.