Help Porting A Gamemode,

Hey, I’ve Been Porting Cider and i cant seem to fix the error

[ERROR] gamemodes/cider/gamemode/cl_init.lua:418: bad argument #1 to ‘GetTextSize’ (string expected, got nil)

  1. GetTextSize - [C]:-1
  2. DrawInformation - gamemodes/cider/gamemode/cl_init.lua:418
    3. unknown - gamemodes/cider/gamemode/cl_init.lua:543

Since No-one loves seeing a whole cl_init i’m just going to post the lines that the error is calling. that way its shorter and easier

Line 417-418

//	-- Get the width and height of the text.
	local width, height = surface.GetTextSize(text);

Line 540-545

-- Called every time the HUD should be painted.
function GM:HUDPaint()
	if ( !self:IsUsingCamera() ) then
		self:DrawInformation(cider.configuration["Website URL"], "ChatFont", ScrW(), ScrH(), Color(255, 255, 255, 255), 255, true, function(x, y, width, height)
			return x - width - 8, y - height - 8;

  1. Noone is going to fix the gamemode for you
  2. Why the hell you post code snippets not related to the error at all?

#1 Thanks For Flaming.
#2 I’ve Already Fixed The Majority Of It.
#3 Not Everyone’s As Big An Ass hat As You

(User was banned for this post ("Flaming" - Craptasket))

You have to use surface.SetFont(“font”) before getting text size.

So it becomes

// – Get the width and height of the text.
local width, height = surface.GetTextSize(text);

[editline]8th September 2013[/editline]

Line 605-606

		-- Loop through every player.
		for k, v in pairs( g_Player.GetAll() ) do hook.Call("PlayerHUDPaint", GAMEMODE, v); end;

[ERROR] gamemodes/cider/gamemode/cl_init.lua:570: attempt to call field ‘GetChat
BoxPos’ (a nil value)

  1. unknown - gamemodes/cider/gamemode/cl_init.lua:570

Post lines 560-580. Lines 605-606 have nothing to do with the error.

You also have to define text so that the function knows what characters are contained so that it can calculated the size.

I’m helping him in Steam, I’ve helped him with most of the stuff.