Hi everyone. So I run a TTT server and I found this error today and I can't quite figure out what's up with it. Nothing looks wrong in the files.
[ERROR] gamemodes/terrortown/gamemode/cl_hud.lua:246: bad argument #3 to 'format' (number expected, got boolean)
1. format - [C]:-1
2. InfoPaint - gamemodes/terrortown/gamemode/cl_hud.lua:246
3. unknown - gamemodes/terrortown/gamemode/cl_hud.lua:342
Found this error anything?
-
- New to forums
- Posts: 2
- https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
- Joined: Sat May 25, 2013 10:58 pm
- ThatGuyNex
- This is my homepage
- Posts: 239
- Joined: Tue May 28, 2013 12:23 pm
Re: Found this error anything?
Have you tried to modify anything in the gamemode lua files? Also could you post your cl_hud.lua?
-
- New to forums
- Posts: 2
- Joined: Sat May 25, 2013 10:58 pm
Re: Found this error anything?
-- Draw ammo
if client:GetActiveWeapon().Primary then
local ammo_clip, ammo_max, ammo_inv = GetAmmo(client)
if ammo_clip != -1 then
local ammo_y = health_y + bar_height + margin
PaintBar(x+margin, ammo_y, bar_width, bar_height, ammo_colors, ammo_clip/ammo_max)
local text = string.format("%i + %02i", ammo_clip, ammo_inv)
ShadowedText(text, "HealthAmmo", bar_width, ammo_y, COLOR_WHITE, TEXT_ALIGN_RIGHT, TEXT_ALIGN_RIGHT)
end
end
-- Draw traitor state
local round_state = GAMEMODE.round_state
local traitor_y = y - 30
local text = nil
if round_state == ROUND_ACTIVE then
text = L[ client:GetRoleStringRaw() ]
else
text = L[ roundstate_string[round_state] ]
end
ShadowedText(text, "TraitorState", x + margin + 73, traitor_y, COLOR_WHITE, TEXT_ALIGN_CENTER)
-- Draw round time
local is_haste = HasteMode() and round_state == ROUND_ACTIVE
local is_traitor = client:IsActiveTraitor()
local endtime = GetGlobalFloat("ttt_round_end", 0) - CurTime()
local text
local font = "TimeLeft"
local color = COLOR_WHITE
local rx = x + margin + 170
local ry = traitor_y + 3
-- Time displays differently depending on whether haste mode is on,
-- whether the player is traitor or not, and whether it is overtime.
if is_haste then
local hastetime = GetGlobalFloat("ttt_haste_end", 0) - CurTime()
if hastetime < 0 then
if (not is_traitor) or (math.ceil(CurTime()) % 7 <= 2) then
-- innocent or blinking "overtime"
text = L.overtime
font = "Trebuchet18"
-- need to hack the position a little because of the font switch
ry = ry + 5
rx = rx - 3
else
-- traitor and not blinking "overtime" right now, so standard endtime display
text = util.SimpleTime(math.max(0, endtime), "%02i:%02i")
color = COLOR_RED
end
else
-- still in starting period
local t = hastetime
if is_traitor and math.ceil(CurTime()) % 6 < 2 then
t = endtime
color = COLOR_RED
end
text = util.SimpleTime(math.max(0, t), "%02i:%02i")
end
else
-- bog standard time when haste mode is off (or round not active)
text = util.SimpleTime(math.max(0, endtime), "%02i:%02i")
end
ShadowedText(text, font, rx, ry, color)
if is_haste then
dr.SimpleText(L.hastemode, "TabLarge", x + margin + 165, traitor_y -
end
end
-- Paints player status HUD element in the bottom left
function GM:HUDPaint()
local client = LocalPlayer()
GAMEMODE:HUDDrawTargetID()
MSTACK:Draw(client)
if (not client:Alive()) or client:Team() == TEAM_SPEC then
SpecHUDPaint(client)
return
end
RADAR:Draw(client)
TBHUD:Draw(client)
WSWITCH:Draw(client)
VOICE.Draw(client)
DISGUISE.Draw(client)
GAMEMODE:HUDDrawPickupHistory()
-- Draw bottom left info panel
InfoPaint(client)
end
if client:GetActiveWeapon().Primary then
local ammo_clip, ammo_max, ammo_inv = GetAmmo(client)
if ammo_clip != -1 then
local ammo_y = health_y + bar_height + margin
PaintBar(x+margin, ammo_y, bar_width, bar_height, ammo_colors, ammo_clip/ammo_max)
local text = string.format("%i + %02i", ammo_clip, ammo_inv)
ShadowedText(text, "HealthAmmo", bar_width, ammo_y, COLOR_WHITE, TEXT_ALIGN_RIGHT, TEXT_ALIGN_RIGHT)
end
end
-- Draw traitor state
local round_state = GAMEMODE.round_state
local traitor_y = y - 30
local text = nil
if round_state == ROUND_ACTIVE then
text = L[ client:GetRoleStringRaw() ]
else
text = L[ roundstate_string[round_state] ]
end
ShadowedText(text, "TraitorState", x + margin + 73, traitor_y, COLOR_WHITE, TEXT_ALIGN_CENTER)
-- Draw round time
local is_haste = HasteMode() and round_state == ROUND_ACTIVE
local is_traitor = client:IsActiveTraitor()
local endtime = GetGlobalFloat("ttt_round_end", 0) - CurTime()
local text
local font = "TimeLeft"
local color = COLOR_WHITE
local rx = x + margin + 170
local ry = traitor_y + 3
-- Time displays differently depending on whether haste mode is on,
-- whether the player is traitor or not, and whether it is overtime.
if is_haste then
local hastetime = GetGlobalFloat("ttt_haste_end", 0) - CurTime()
if hastetime < 0 then
if (not is_traitor) or (math.ceil(CurTime()) % 7 <= 2) then
-- innocent or blinking "overtime"
text = L.overtime
font = "Trebuchet18"
-- need to hack the position a little because of the font switch
ry = ry + 5
rx = rx - 3
else
-- traitor and not blinking "overtime" right now, so standard endtime display
text = util.SimpleTime(math.max(0, endtime), "%02i:%02i")
color = COLOR_RED
end
else
-- still in starting period
local t = hastetime
if is_traitor and math.ceil(CurTime()) % 6 < 2 then
t = endtime
color = COLOR_RED
end
text = util.SimpleTime(math.max(0, t), "%02i:%02i")
end
else
-- bog standard time when haste mode is off (or round not active)
text = util.SimpleTime(math.max(0, endtime), "%02i:%02i")
end
ShadowedText(text, font, rx, ry, color)
if is_haste then
dr.SimpleText(L.hastemode, "TabLarge", x + margin + 165, traitor_y -
end
end
-- Paints player status HUD element in the bottom left
function GM:HUDPaint()
local client = LocalPlayer()
GAMEMODE:HUDDrawTargetID()
MSTACK:Draw(client)
if (not client:Alive()) or client:Team() == TEAM_SPEC then
SpecHUDPaint(client)
return
end
RADAR:Draw(client)
TBHUD:Draw(client)
WSWITCH:Draw(client)
VOICE.Draw(client)
DISGUISE.Draw(client)
GAMEMODE:HUDDrawPickupHistory()
-- Draw bottom left info panel
InfoPaint(client)
end