Player.lua error

So I’m having a weird issue on my laptop that I wasn’t have at home on my desktop, I even reverified the game content, still nothing. I never modified this file, and the errors that follow it were working before.

here is the error that I get after the database connects:

lua/includes/extensions/player.lua:156: attempt to call field ‘Query’ (a nil value)

and the following errors all have to do with the player class and saving pdata… except the player:Alive function, i’m not sure why that’s saying it’s a nil value too.

but practically everything related to the player.lua file is broken. Any idea?

Post full errors, with full stack trace.

[editline]5th February 2014[/editline]

in


 tags.

alright.

console:


] reload
SoundEmitter:  removing map sound overrides [26 to remove, 0 to restore]
Dropped soulzstudios from server (Disconnect by user.)
PREP OK
Error, bad server command lua_error_url ''
Lua JIT is DISABLED!
Weapon Strip con var created
Penetration/ricochet con var created
Recoil con var created
Unique Slots con var created
Holster Disable con var created
Ammo crate detonation con var created
Gas effect con var created
Nav File is wrong or something (1)
Database connected
Garry's Mod

rainbowfactory
gm_flatgrass
1
76561198048067017
Requesting 3 lua files from the server
clientside lua startup!
Lua JIT is DISABLED!
setting points for STEAM_0:0:0
lua/includes/extensions/player.lua:156: attempt to call field 'Query' (a nil value)
Compact freed 823296 bytes
Redownloading all lightmaps

[ERROR] gamemodes/rainbowfactory/gamemode/hud.lua:37: attempt to call method 'Alive' (a nil value)
  1. v - gamemodes/rainbowfactory/gamemode/hud.lua:37
   2. unknown - lua/includes/modules/hook.lua:82





local function HUDPaint()
	client = client or LocalPlayer()
	if( !client:Alive( ) ) then return; end
	
	local vars =
	{
		font = "default",
		width = 0.25,
		bar_height = 16,
		bar_spacing = 5,
		text_spacing = 2,
		padding = 10,
		margin = 35,
		
		mana_bar =
		{
			border = Color(255, 255, 255, 255 ),
			background = Color( 255, 255, 255, 200 ),
			shade = Color ( 255, 255, 255, 2 ),
			fill = Color ( 0, 0, 0, 255 ),
		},
		
		text =
		{
			shadow = Color( 0, 0, 0, 155),
			text = Color( 255, 255, 255, 255)
		},
		
		health_bar =
		{
			border = Color( 255, 0, 0, 255 ),
			background = Color( 255, 0, 0, 75 ),
			shade = Color( 255, 104, 104, 75 ),
			fill = Color( 232, 0, 0, 255 )		
		},
		
		armour_bar =
		{
			border = Color( 255, 0 ,0, 255),
			backgraoun = Color( 255, 0, 0, 75),
			shade = Color( 255, 104, 104 , 255),
			fill = Color( 232, 0 , 0, 255 )
		}
	}
	
	local th = hud:TextSize( "TEXT", vars.font)
	local i = 2;
	
	local width = vars.width * ScrW();
	local bar_width = width - ( vars. padding * i );
	local height = ( vars.padding * 1 ) + (th * i ) + ( vars.text_spacing * i ) + ( vars.bar_height * i ) + vars.bar_spacing
	
	local x = vars.margin
	--local y = ScrH( ) - vars.margin - height
	local y = 10
	
	local cx = x + vars.padding
	local cy = y + vars.padding
	
	local by = th + vars.text_spacing;
	--local text = string.format( "Mana: %iMP", 100 );
	--hud:PaintText( cx, cy, text, vars.font, vars.text )
	--hud:PaintBar( cx, cy + by, bar_width, vars.bar_height, vars.mana_bar, 100 / 100 );
	
	by = by + vars.bar_height + vars.bar_spacing;
	
	local text = string.format( "Level: %i", client:getLevel() )
	hud:PaintText( cx, cy + by, text, vars.font, vars.text)
	
	by = by + vars.bar_height + vars.bar_spacing;

	local text = string.format( "Exp: %i / %i EXP", client:getExp(), 100)
	hud:PaintText( cx, cy + by, text, vars.font, vars.text)
	
	
	
	--hud:PaintBar( cx, cy + by + th + vars.text_spacing, bar_width, vars.bar_height, vars.armour_bar, client:Armor() / 100)
	local text = string.format( "Points: %sP", client:getPoints())
	hud:PaintText( cx, cy, text, vars.font, vars.text)
	if client:getRank() <= 750 then
		by = by + vars.bar_height + vars.bar_spacing;
		text = string.format ( "Living Entities: %s", getAllEnemies())
		hud:PaintText( cx, cy + by, text, vars.font, vars.text)
	end
end

the line to the error about Alive

client = client or LocalPlayer()
if( !client:Alive( ) ) then return; end

It seems your gamemode/addons/module is overriding the sql library of GMod.




client = client or LocalPlayer()
if( !IsValid( client ) ) then return; end
if( !client:Alive( ) ) then return; end

that’s really weird, it wasn’t doing this the other day. I have no idea how it could be doing that. could it be the name of my files? I do have an sql.lua

It would be something redefining the global ‘sql’ or redefining the sql module. You could check inside for any cases of that.




local log = {
	["sql"] = true;
};

local new_G = {}
for k,v in pairs(_G) do
	new_G[k] = v;
	_G[k] = nil;
end

setmetatable(_G, {
	__index = function(self, k)
		return new_G[k]
	end;
	__newindex = function(self, k, v)
		if(log[k]) then
			print("!!!LOG: 
global variable '"..k.."' was overridden! Stack trace:
"..debug.traceback());
		end
		new_G[k] = v;
	end;
});


Should work, untested.

alright I’ll try seeing if I defined sql else where and then test it thanks for the help guys.

just put the script i wrote above in an autorun file and print the stack trace, we can help easier if you do that