Ok im trying to add on to an addon I made called sim helper pretty self-explanatory on what it does but I want to make the delay timer either go on a hud hook which iv tried to do and gotten errors or have the chat command I made say [Sim Helper] There is <TIMELEFT> left. ps not how Iv been doing. Ill show you the code and errors I get. Iv tried doing this to get the time left
local timeleft = string.ToMinutesSeconds( timetimerles - CurTime() )
but this causes errors with arthimatics
error
[ERROR] addons/sim_helper_by_snowa/lua/autorun/client/cl_netcode_recive.lua:83: attempt to concatenate local 'timetimerles' (a nil value)
1. func - addons/sim_helper_by_snowa/lua/autorun/client/cl_netcode_recive.lua:83
2. unknown - lua/includes/extensions/net.lua:32
[ERROR] addons/sim_helper_by_snowa/lua/autorun/client/cl_netcode_recive.lua:81: attempt to perform arithmetic on local 'timetimerles' (a nil value)
1. func - addons/sim_helper_by_snowa/lua/autorun/client/cl_netcode_recive.lua:81
2. unknown - lua/includes/extensions/net.lua:32
client side
net.Receive( 'sendSHT', function()
local timetimerles = timer.TimeLeft("delaytimer")
--local timeleft = string.ToMinutesSeconds( timetimerles - CurTime() )
print(timetimerles)
chat.AddText(noticecolor, '[Sim Helper] ', announcolor, 'There is '..timetimerles.." left!")
end)
server side
hook.Add("PlayerSay", "sht", function(ply, text, public)
if (string.sub(text, 1, 4) == "!sht") then
net.Start("sendSHT")
net.Send(ply)
return ""
end
end)
init
local delaytimerthing = 600
local shouldOccur = true
function ENT:AcceptInput(name, activator, caller)
if name == "Use" and caller:IsPlayer() then
if shouldOccur then
net.Start("spawn_npcs")
net.Send( activator )
shouldOccur = false
net.Start( 'colorchatmsg' )
net.Broadcast()
net.Start( 'startthe3d' )
net.Broadcast()
timer.Create("delaytimer", delaytimerthing, 0, function()
shouldOccur = true end)
end
end
end
errors
nil
[ERROR] addons/sim_helper_by_snowa/lua/autorun/client/cl_netcode_recive.lua:83: attempt to concatenate local 'timetimerles' (a nil value)
1. func - addons/sim_helper_by_snowa/lua/autorun/client/cl_netcode_recive.lua:83
2. unknown - lua/includes/extensions/net.lua:32