• Print

Author Topic: I need help with hud! :((  (Read 5739 times)

0 Members and 1 Guest are viewing this topic.

Offline M0NstR

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
I need help with hud! :((
« on: January 25, 2017, 02:12:27 pm »
Hi there! Forgive me if the question will seem incomprehensible and sorry for my bad English.
I tried to translate Midnight HUD from English to Russian, but I was able to translate only Innocent, but Traitor and Detective doesn't work.

Console error, look:
[ULib] lua/cl_hud_mnhud.lua:268: bad argument #3 to 'SetDrawColor' (number expected, got no value)
  1. SetDrawColor - [C]:-1
   2. BorderedRect - lua/cl_hud_mnhud.lua:268
    3. ShouldDraw - lua/cl_hud_mnhud.lua:865
     4. fn - lua/cl_hud_mnhud.lua:906
      5. unknown - lua/ulib/shared/hook.lua:110

What should I do with this?

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: I need help with hud! :((
« Reply #1 on: January 25, 2017, 02:21:12 pm »
We can't give you any help if you don't give us the code you're having trouble with. surface.SetDrawColor requires at least 3 number arguments, and yours is saying it has no argument in it's third spot (the b in an r, g, b colour).
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline M0NstR

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: I need help with hud! :((
« Reply #2 on: January 25, 2017, 02:33:06 pm »
check this  :'(
Can I send all this code, if you need?

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: I need help with hud! :((
« Reply #3 on: January 25, 2017, 02:49:36 pm »
I'd need the whole code. To know, I'd have to find where 'main' is defined and being called (most likely line 865). Please copy it all and use the  tags around the paste, please.
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline M0NstR

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: I need help with hud! :((
« Reply #4 on: January 25, 2017, 02:54:07 pm »
ready!
I tried to copy, but there was an error: 20000 characters
« Last Edit: January 25, 2017, 02:55:41 pm by M0NstR »

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: I need help with hud! :((
« Reply #5 on: January 25, 2017, 03:08:51 pm »
Code: Lua
  1.       local function HealthBarColours(ent)
  2.          local bar_dark, bar_light
  3.          
  4.          if ent:IsDetective() then
  5.             bar_dark = role_dark.detective
  6.             bar_light = role_light.detective
  7.            
  8.             return bar_dark, bar_light
  9.          elseif ent:IsTraitor() then
  10.             bar_dark = role_dark.traitor
  11.             bar_light = role_light.traitor
  12.            
  13.             return bar_dark, bar_light
  14.          elseif ent:Health() > 90 then
  15.             bar_dark = health_bar_dark.hp_healthy
  16.             bar_light = health_bar_light.hp_healthy
  17.            
  18.             return bar_dark, bar_light
  19.          elseif ent:Health() > 70 then
  20.             bar_dark = health_bar_dark.hp_hurt
  21.             bar_light = health_bar_light.hp_hurt
  22.            
  23.             return bar_dark, bar_light
  24.          elseif ent:Health() > 40 then
  25.             bar_dark = health_bar_dark.hp_wounded
  26.             bar_light = health_bar_light.hp_wounded
  27.            
  28.             return bar_dark, bar_light
  29.          elseif ent:Health() > 20 then
  30.             bar_dark = health_bar_dark.hp_badwnd
  31.             bar_light = health_bar_light.hp_badwnd
  32.            
  33.             return bar_dark, bar_light
  34.          else
  35.             bar_dark = health_bar_dark.hp_death
  36.             bar_light = health_bar_light.hp_death
  37.            
  38.             return bar_dark, bar_light
  39.          end

This is the function causing issues. One of the health_bar_light.<something> is only returning 2 values, but the part of the code that defines those is not existent in the code sample you have. You'll need to find where these are defined:
Code: Lua
  1.       local health_bar_light = {
  2.          ["hp_healthy"] = midnight_hud.health_bar_light.healthy,
  3.          ["hp_hurt"] = midnight_hud.health_bar_light.hurt,
  4.          ["hp_wounded"] = midnight_hud.health_bar_light.wounded,
  5.          ["hp_badwnd"] = midnight_hud.health_bar_light.badly_wounded,
  6.          ["hp_death"] = midnight_hud.health_bar_light.near_death
  7.       }
because without knowing what those are assigned to, you can't fix your problem. Unless I'm completely overlooking something, that should be the issue.
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

  • Print