• A bad argument in includes/util.lua when i die in the game?
    15 replies, posted
Hello. Whenever i die, i get this error: [PHP]ERROR: GAMEMODE:'HUDPaint' Failed: includes\util.lua:23: bad argument #1 to 'min' (number expected, got nil) [/PHP] It stops as soon as i respawn. Does anybody know how to fix this? Thanks
[QUOTE=Chrik;22163450]Hello. Whenever i die, i get this error: [PHP]ERROR: GAMEMODE:'HUDPaint' Failed: includes\util.lua:23: bad argument #1 to 'min' (number expected, got nil) [/PHP] It stops as soon as i respawn. Does anybody know how to fix this? Thanks[/QUOTE] Give us the clientside file you recently edited, with hudpaint init.
It means you passed a value to a "Color" function that did not parse as a number.
It most likely is due to an addon you have installed recently. Try and remove some/all to find which one.
It worked for some days ago, but now it dosent. I havent added any addons since then.
I tried to reinstall the server, and it still dosent work.
Update possibly?
I have updated the server to update 81.
Before you could do like [lua]Color(255)[/lua] and it would become red, when garry added the color clamps he broke that
Exactly. I open the includes/util.lua file and tried to fix it, but failed. Do you know how to fix this?
[lua]function Color( r, g, b, a ) a = a or 255 a = r or 0 a = g or 0 a = b or 0 return { r = math.min( tonumber(r), 255 ), g = math.min( tonumber(g), 255 ), b = math.min( tonumber(b), 255 ), a = math.min( tonumber(a), 255 ) } end[/lua]
[QUOTE=Tobba;22210989]*code*[/QUOTE] [lua] function Color( r, g, b, a ) return { r = math.Clamp( tonumber( r ) or 0, 0, 255 ), g = math.Clamp( tonumber( g ) or 0, 0, 255 ), b = math.Clamp( tonumber( b ) or 0, 0, 255 ), a = math.Clamp( tonumber( a ) or 0, 0, 255 ) } end [/lua] Clamping includes lower bounds.
Sadly garry/AzuiSleet used min instead of Clamp :saddowns: Atleast in my .gcf
[QUOTE=Tobba;22210989]function Color( r, g, b, a ) a = a or 255 a = r or 0 a = g or 0 a = b or 0 return { r = math.min( tonumber(r), 255 ), g = math.min( tonumber(g), 255 ), b = math.min( tonumber(b), 255 ), a = math.min( tonumber(a), 255 ) } end[/QUOTE] Its pretty funny actually, i tried that before you suggested but it did not worked. I will try to replace the math.min with math.Clamp and see if that works.
Ow i failed, use what Kogitsune said
Kogitsunes suggestion did not worked. Lua errors spammed me. (Mostly due to some variables was not defined because of a error in util.lua)
Sorry, you need to Log In to post a reply to this thread.