[HELP] GMOD - Programming Base Wars. BUG

Hey there guys, I am wondering if you could help me with a bug that I cannot just wrap my head around. I have been programming my own Base Wars for the past few months and it is near completion. I am just stuck at this one bug and I just cannot wrap my head around it.

Here is the ERROR and the code

Attempt to compare number with nil

if(ply:GetTable().maxStarterPrinter >= CfgVars["maxStarterPrinter"])then
			Notify( ply, 4, 3, "Max Starter Printers Reached!" );
			return "";

If you could help it would be appreciated, peace.

You need to show some more of the code, right now it just say that something is wrong with the outcome of your two tables that you’re comparing ( ply:GetTable().maxStarterPrinter ) and ( CfgVars[“maxStarterPrinter”] ) Use Ctrl+F and search for their values, then post them, one of them has the nil value you cannot compare.

Well here is the CfgVar in vars.lua


But also it is called/wrote/read from the init.lua in the printer.

ply:GetTable().maxStarterPrinter=ply:GetTable().maxStarterPrinter + 1

Well check how it handles the


because I dont see the mistake in the CfgVars.
Why is it even a table, when its only about one value? just seem odd to me, thats all.

In what file, just a bit confused and tired considering that is is 2:31am here…

Well I guess in the init.lua, you said it was writen there.

Its 3:31 here, so yea.

It doesn’t want to handle just ply:GetTable().maxStarterPrinter
Just loves the ‘=’.

It is being strange and I just find tables a lot more simpler and easier to use for my use anyway…
May sound like a noob, but I have been working on this gamemode for months now. I started it from scratch and it’s near completion and I just want to get it up and running smoothly and make updates weekly… So yea.

Oh and by the way, thanks for the help man.

Well it’s hard for me to find a solution, when I cant see what is going on in that table,
and how it gets it value, because it says that it dosent have a value.
So maybe it dosent change and thats the problem, just search after “maxStarterPrinter”, thats what you’re looking for.

Alright thanks man, I do appreciate it!

Well maybe, im just talking rubish right now and its much more simple than what im saying, just trying you know. It is late you know, so im off. Good luck and everything with your gamemode.

well shit, looks like I’m not the only one recreating this gamemode from scratch lol

if( !ply:GetTable().maxStarterPrinter ) then ply:GetTable().maxStarterPrinter = 0 end
if(ply:GetTable().maxStarterPrinter >= CfgVars[“maxStarterPrinter”])then
Notify( ply, 4, 3, “Max Starter Printers Reached!” );
return “”;