• Draw color error
    9 replies, posted
I have this error in my console when i join my server, And my hud dont work: [ERROR] lua/includes/modules/draw.lua:198: bad argument #3 to 'SetDrawColor' (number expected, got nil) 1. SetDrawColor - [C]:-1 2. RoundedBox - lua/includes/modules/draw.lua:198 3. fn - gamemodes/darkrp/gamemode/modules/hungermod/cl_init.lua:74 4. Run - addons/ulib/lua/ulib/shared/hook.lua:179 5. HUDPaint - gamemodes/base/gamemode/cl_init.lua:75 6. unknown - gamemodes/sandbox/gamemode/cl_init.lua:75
I blame russians?.. Why? Because it's the only logical reason of your code not working, especially because you didn't provide any freakin' code.
Russians are a decent assumption, but I would say they might be trying to do [lua]SetDrawColor(155, 155, 155) // Example[/lua] Instead of [lua]SetDrawColor(Color(155, 155, 155)) // Correct[/lua]
[QUOTE=Nookyava;47304003]Russians are a decent assumption, but I would say they might be trying to do [lua]SetDrawColor(155, 155, 155) // Example[/lua] Instead of [lua]SetDrawColor(Color(155, 155, 155)) // Correct[/lua][/QUOTE] Actually no. Both are correct. Checking out gmods code, mostly the first way is used(But you need to have 4 numbers, alpha as well), but there are a few places where the 2nd way is used. Anyways, like Neth said, we can't help you much without a code snippet.
-snip-
[QUOTE=Nookyava;47304474]Both aren't correct. and you don't need to have the alpha (default is 255).[/QUOTE] [IMG]https://newjorciks.com/new/image/WvhT.png[/IMG] Don't have to say more, this is taken from garrysmod\lua\vgui\dcolorbutton.lua
Then I apologize, I suppose both can be used. Don't need to set the alpha still though, default is 255 so if you don't enter a value for it, it won't error.
[QUOTE=Nookyava;47304574]Then I apologize, I suppose both can be used. Don't need to set the alpha still though, default is 255 so if you don't enter a value for it, it won't error.[/QUOTE] Ok, there you are right, I assumed that alpha had to be defined(Atleast in the non-ColorTable way) because everywhere in gmods main lua files they have it set even if it's 255, I guess it's just a good practice to set it, even if it's same as default.
You always want to set your own values, that way you have control. For example let's say they change it to 155 as default and people don't set it, then all of a sudden a lot of things become slightly transparent.
See how much time we could've saved if that guy had provided us with code in the first place?
Sorry, you need to Log In to post a reply to this thread.