Client and Server Side Fucntions

FOR TESTING AND PRACTICE PURPOSES

I’ve got this timer format function in init.lua:


function FormatTimer( t )
	local t = tonumber(t)
	local __t = string.FormattedTime( math.Round( t, 2 ), "%02i:%02i:%02i")
	local split = string.FormattedTime( math.Round( t, 2 ) )
	if t > 3600 then
		__t = string.format( "%02i:%02i:%02i:%02i", split.h, split.m, split.s, split.ms )
	else
		__t = string.format( "%02i:%02i:%02i", split.m, split.s, split.ms )
	end
	return __t
end

This is my cl_hud:


	if ply:GetNWBool("started") then
		draw.SimpleText(FormatTimer(CurTime()-ply:GetNWInt("StartTime")), "timer_font", 130, ScrH() - 95, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
	else
		draw.SimpleText(FormatTimer(0), "timer_font", 130, ScrH() - 95, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
	end

Would it be possible to allow the FormatTimer function to be called from a client side file?

Just put the function in your cl_hud.lua or any other clientside or shared file.

It’s obviously the underscores. Don’t do that!
(Kidding)

Put the files in an autorun directory or edit existing files.

Damn RobotBoy!