• Hud Problem
    7 replies, posted
Error: [ERROR] lua/includes/util/color.lua:16: bad argument #1 to 'min' (number expected, got nil) 1. min - [C]:-1 2. Color - lua/includes/util/color.lua:16 3. Base - addons/darkrpmodification/lua/darkrp_modules/testhud/cl_spadehud.lua:5 4. fn - addons/darkrpmodification/lua/darkrp_modules/testhud/cl_spadehud.lua:317 5. unknown - addons/ulib/lua/ulib/shared/hook.lua:183 Code: [CODE]local function Base() draw.RoundedBox(6, ScrW() - 400 - 10, ScrH () - 200 - 10, 400, 200, Color(40, 40, 40, 250)) draw.RoundedBox(6, ScrW() - 400, ScrH () - 200, 400-20, 30, Color( playercolor )) local playercolor = LocalPlayer():GetPlayerColor() end [/CODE] i want this to change the block color based on the players color but it doesn't seem to work
You're defining the variable after you're indexing it. Which means it's nil. Put the local playercolor line before you're draw.RoundedBox() functions.
Define playercolor above where you call it.
You are also creating a color from another color which is impossible. [code] local function Base() local playercolor = LocalPlayer():GetPlayerColor() draw.RoundedBox(6, ScrW() - 400 - 10, ScrH () - 200 - 10, 400, 200, Color(40, 40, 40, 250)) draw.RoundedBox(6, ScrW() - 400, ScrH () - 200, 400-20, 30, playercolor * 255) end [/code]
It still doesnt work it does not show my player color at all it just shows black
Gambits code should work.
[QUOTE=DeadShotKillz;45585528]It still doesnt work it does not show my player color at all it just shows black[/QUOTE] because GetPlayerColor returns a vector normalized Multiply the vector by 255 and parse it as color
Fixed my post with the code :) [editline]4th August 2014[/editline] [QUOTE=imMrAnarchy;45585570]Gambits code should work.[/QUOTE] My code always works :wink: ... Well some times.
Sorry, you need to Log In to post a reply to this thread.