Lua Error

Hi guys I got this error:


[ERROR] gamemodes/cityrp/gamemode/core/libraries/sv_player.lua:484: attempt to concatenate global 'UniqueID' (a nil value)
  1. saveDataAll - gamemodes/cityrp/gamemode/core/libraries/sv_player.lua:484
   2. unknown - gamemodes/cityrp/gamemode/init.lua:202

I cant fix it.

Maybe usefull
gamemodes/cityrp/gamemode/core/libraries/sv_player.lua:482-499



			if(query == '') then
				query = query.."UPDATE players SET ("..keys..") VALUES ("..values..") WHERE _UniqueID = '"..UniqueID.."'"
			else
				query = query..",("..values..")"
			end;
		end;
	end
	 if(save) then
	 	local dupstring = '';
	 	for k, v in pairs(keys) do
	 		dupstring = dupstring..v.."=VALUES("..v.."),"
	 	end
	 	local len = string.len(dupstring);
	 	dupstring = string.sub(dupstring, 1, len - 1);
	 	query = query.."ON DUPLICATE KEY UPDATE "..dupstring;
		DB:Query(query);
	 end;
end;


gamemodes/cityrp/gamemode/core/libraries/sv_player.lua:*



--[[
Name: "sv_player.lua".
Product: "CityRP (Roleplay)".
--]]

if(!cityrp.player) then
	cityrp.player = {};
	cityrp.player.nextSecond = 0;
end;
cityrp.playerpreload = {};

-- Pre-cache for networking
util.AddNetworkString( "cityrp_gplayerdata" )
util.AddNetworkString( "cityrp_gplayerdataupdate" )
util.AddNetworkString( "_cityrp_localplytab" )

--[[
	GM13 Networking Replacement
	Wrote by G.Matt
	For assistance contact me: matt@gmanager.net
]]--

function cityrp.player.sendGlobalPlayerData(ply)
	if !IsValid(ply) || !ply.cityrp || !ply._clgdata then return end -- Check to make sure the player hasn't D/c'ed
	--ply._gdatacache = ply._gdatacache or {}
	--if ply._gdatacache == ply._clgdata then return end -- Why send if it's exactly the same?
	net.Start("cityrp_gplayerdata") // Start the net message
		net.WriteEntity(ply)
		net.WriteTable(ply._clgdata) // Write the playerdata table
		--print("Sending "..ply:Nick().."'s global playerdata") // Debug
	net.Broadcast() // Send to players
	--ply._gdatacache = ply._clgdata
	ply._clgdatatime = os.time();
end
hook.Add("PlayerSpawn", "playerdataonspawn", cityrp.player.sendGlobalPlayerData);

function cityrp.player.UpdateGlobalPlayerData(ply, varname)
	if(!IsValid(ply) || !ply.cityrp || !ply._clgdata) then return end; -- Check to make sure the player hasn't D/c'ed
	ply._clgdatatime = ply._clgdatatime or 0;
--	ply._gdatacache = ply._gdatacache or {};
	--if(ply._gdatacache[varname] == ply._clgdata[varname]) then return end; -- Why send if it's exactly the same?
	if(ply._clgdatatime < (os.time() - 60)) then
		cityrp.player.sendGlobalPlayerData(ply);
		return;
	end;
	local sendtable = {ply._clgdata[varname]};
	net.Start("cityrp_gplayerdataupdate") // Start the net message
		net.WriteEntity(ply)
		net.WriteString(varname)
		net.WriteTable(sendtable) // Write the update
	net.Broadcast() // Send to players
--	ply._gdatacache[varname] = ply._clgdata[varname];
--	if(ply._gdatacache != ply._clgdata) then cityrp.player.sendGlobalPlayerData(ply) return end; -- not matching better send all
end

--[[
	Function cityrp.player.sendLocalPlayerTable(ply,data)
	Uses: Send local player data to client in one big table using net libary.
	Advantages: Send all the player data in one table instead of sending loads of usermessages (optimization)
	Inputs: player object, table
	Returns: Nothing
	Author: _G.Matt (matt@gmanager.net)
]]--

local lptcache = {}
function cityrp.player.sendLocalPlayerTable(ply, data)
	if !IsValid(ply) || !data  then return end -- Check to make sure the player is a valid entity, check to make sure the data exists and check to make sure the data is a table
	net.Start("_cityrp_localplytab") -- Start the precached net Packet
		net.WriteTable(data) -- Write the table
	net.Send(ply) -- Send to client
	--print("Debug: Sending LocalPlayertable to "..ply:Nick())
	lptcache[ply] = data -- Cache it so we can check if it's the same as the one we're sending for optimization.
end

-- Set a player's local player variable for the client.
util.AddNetworkString( "cityrp._LocalPlayerVariable" );
function cityrp.player.setLocalPlayerVariable(player, class, key, value)
	if ( IsValid(player) ) then
		local variable = key.."_Last_"..class;
		
		-- Check if we can send this player variable again.
		if (player[variable] == nil or player[variable] != value) then				
				net.Start( "cityrp._LocalPlayerVariable" );
					net.WriteInt( class, 8 );
					net.WriteString( key );
				
				-- Check if we can get what class of variable it is.
				if (class == CLASS_STRING) then
					value = value or ""; net.WriteString(value)
				elseif (class == CLASS_LONG) then
					value = value or 0; net.WriteInt(value, 32)
				elseif (class == CLASS_SHORT) then
					value = value or 0; net.WriteInt(value, 16)
				elseif (class == CLASS_BOOL) then
					value = value or false; net.WriteBit(value)
				elseif (class == CLASS_VECTOR) then
					value = value or Vector(0, 0, 0); net.WriteVector(value)
				elseif (class == CLASS_ENTITY) then
					value = value or NULL; net.WriteEntity(value)
				elseif (class == CLASS_ANGLE) then
					value = value or Angle(0, 0, 0); net.WriteAngle(value)
				elseif (class == CLASS_CHAR) then
					value = value or 0; net.WriteInt(value, 8)
				elseif (class == CLASS_FLOAT) then
					value = value or 0; net.WriteFloat(value)
				end;				
			net.Send( player );
			
			player[variable] = value;
		end;
	end;
end;

-- Print a message to player's with the specified access.
function cityrp.player.printConsoleAccess(text, access)
	for k, v in pairs( g_Player.GetAll() ) do
		if ( cityrp.access.hasAccess(v, access) ) then v:PrintMessage(2, text); end;
	end;
end;

-- Get a player by a part of their name.
function cityrp.player.get(name)
	local found = false;
	local rp = false;
	local foundnames = {};
	if(name) then
		if(string.find(string.upper(name), "STEAM_")) then
			return cityrp.player.getid(name)
		end;
		for k, v in pairs( g_Player.GetAll() ) do
			if (tostring(v:UserID()) == name) then
				return v;
			elseif (string.len(name) > 1 and string.find(string.lower(v:Name()), string.lower(name), 1, true)) then
				if(!found) then
					found = true;
					rp = v;
					table.insert(foundnames, v);
				else
					rp = false;
					table.insert(foundnames, v);
				end;
			end;
		end;
	end;
	
	if(!empty(foundnames)) then
		return rp, foundnames;
	else
		return rp, false;
	end;
end;

function cityrp.player.getid(steamid)
	steamid = string.upper(steamid);
	if(string.find(steamid, "STEAM_")) then
		for k, v in pairs( g_Player.GetAll() ) do
			if (v:SteamID() == steamid) then
				return v;
			end;
		end;
	end;
	
	-- Return false because we didn't find any players.
	return false;
end;

function cityrp.player.playerstostring(players)
	local names = {}
	for _,v in pairs(players) do
		table.insert(names, v:Nick() .. " (" .. v:UserID() .. ")")
	end
	names = string.Implode(", ",names);
	return names;
end;

-- Notifies every player using Garry's hint messages.
function cityrp.player.notifyAll(message, class)

	for k, v in pairs( g_Player.GetAll() ) do
		v:Notify( message, class );
	end;
	
	print( message );
end;

-- Prints a message to every player's chat area and console.
function cityrp.player.printMessageAll(message)
	for k, v in pairs( g_Player.GetAll() ) do
		v:printMessage( message );
	end;
	
	print( message );
end;

-- Prints a message to players within a radius of a specified position.
function cityrp.player.printMessageInRadius(message, position, radius)
	for k, v in pairs( g_Player.GetAll() ) do
		if (position:Distance( v:GetPos() ) <= radius) then
			v:printMessage( message );
		end;
	end;
end;

-- Called when player connects. -- got abused so disabled
-- hook.Add( "player_connect2", "connectreload", function(name, steamid, ip, id)
	-- local pq = "SELECT * FROM "..cityrpserver["MySQL Table"].." WHERE _SteamID = '"..steamid.."'";
	-- cityrp.playerpreload[steamid] = nil;
	-- DB:Query(pq, function(result)
		-- if (result and type(result) == "table" and #result > 0) then
			-- cityrp.playerpreload[steamid] = result[1];
			-- cityrp.playerpreload[steamid].ctime = os.time();
		-- end;
	-- end, steamid);
	-- local pq = "UPDATE "..cityrpserver["MySQL Table"].." SET _Online = 1, _Server = '"..cityrpserver["Server"].."' WHERE _SteamID = '"..steamid.."'"
	-- DB:Query(pq);
-- end )

hook.Add("PlayerDisconnected","PreloadPlayerDisconnected",function(player)
	cityrp.playerpreload[player:SteamID()] = nil;
end);

-- Get the player's inventory as a string.
function cityrp.player.getInventoryString(player)
	local value = "";
	if(!player._invalid_inventory) then
		player._invalid_inventory = {}
	end;

	-- Loop through the table.
	for k2, v2 in pairs(player.cityrp._Inventory) do
		value = value..k2..": "..tostring(v2).."; ";
	end;
	for k2, v2 in pairs(player._invalid_inventory) do
		value = value..k2..": "..tostring(v2).."; ";
	end;

	-- Return the new value.
	return string.sub(value, 1, -3);
end;

-- Convert an inventory string to a table.
function cityrp.player.convertInventoryString(data)
	local exploded = string.Explode("; ", data);
	local inventory = {};
	local invalid_inventory = {};
	
	-- Loop through our exploded values.
	for k, v in pairs(exploded) do
		local item;
		local amount;
		
		-- Substitute the item and amount into their variables.
		string.gsub(v, "(.+): ", function(a) item = a end)
		string.gsub(v, ": (.+)", function(a) amount = a end)
		
		-- Check to see if we have both an item and an amount.
		if (item and amount) then
			item = string.Trim(item);
			
			-- Check if the item is one of the old ones.
			if (item == "cityrp_usp") then
				item = "cityrp_usp45";
			elseif (item == "cityrp_sniper") then
				item = "cityrp_g3sg1";
			elseif (item == "cityrp_shotgun") then
				item = "cityrp_m3super90";
			elseif (item == "cityrp_glock") then
				item = "cityrp_glock18";
			elseif (item == "cityrp_deagle") then
				item = "cityrp_deserteagle";
			end;
			
			-- Check to see if this is a valid item.
			if (cityrp.item.stored[item]) then
				inventory[item] = tonumber(amount);
			else
				invalid_inventory[item] = tonumber(amount);
				print("Invalid inventory item: "..item);
			end;
		end;
	end;
	
	-- Return the new inventory.
	return inventory, invalid_inventory;
end;

-- Get a player's data as MySQL key values.
function cityrp.player.getDataKeyValues(player)
	local keys = "";
	local values = "";
	local amount = 1;
	
	local keyst = {
			'_Name',
			'_IP',
			'_Igname',
			'_Description',
			'_Clan',
			'_Gender',
			'_SteamID',
			'_UniqueID',
			'_Money',
			'_Flags',
			'_Donator',
			'_Arrested',
			'_Inventory',
			'_TimePlayed',
			'_Points',
			'_svrank',
			'_Music'
		};

	-- Loop through the player's data.
	for k, v in pairs(keyst) do
		keys = keys..v..", ";

		-- We create a temporary variable here to store the value.
		local value = tostring(player.cityrp[v]);

		-- Check to see if the type of the value is a table.
		if (type(player.cityrp[v]) == "table") then
			if (v == "_Inventory") then
				value = cityrp.player.getInventoryString(player);
			end;
		end;
		if(v == "_Arrested") then
			if(player.cityrp[v]) then
				value = player._WarrantedTime;
			else
				value = 0;
			end;
		end;

		values = values.."\""..mysql_escape(value).."\", ";

		-- Update the amount that we've done.
		amount = amount + 1;
	end;
	local len = string.len(keys);
	keys = string.sub(keys, 1, len - 2);
	local len = string.len(values);
	values = string.sub(values, 1, len - 2);
	-- Return the keys and values that we collected.
	return keys, values;
end;

-- Get an update query of a player's data.
function cityrp.player.getDataUpdateQuery(player)
	local uniqueID = player:UniqueID();
	local query = "";
	local keys = {};

	if(FLServer == "build" or cityrp.disablesave) then
		keys = {
			'_Name',
			'_IP',
			'_SteamID',
			'_UniqueID',
			'_TimePlayed',
			'_Points',
			'_svrank',
			'_Music'
		};
	else
		keys = {
			'_Name',
			'_IP',
			'_Igname',
			'_Description',
			'_Clan',
			'_Gender',
			'_SteamID',
			'_UniqueID',
			'_Money',
			'_Flags',
			'_Donator',
			'_Arrested',
			'_Inventory',
			'_TimePlayed',
			'_Points',
			'_svrank',
			'_Music'
		};
	end;

	-- Loop through our data.
	for k, v in pairs(keys) do
		d = player.cityrp[v]
		-- We create a temporary variable here to store the value.
		local value = tostring(d);

		if (v == "_Inventory") then
			value = cityrp.player.getInventoryString(player);
		elseif(v == "_Arrested") then
			if(d) then
				value = player._WarrantedTime;
			else
				value = 0;
			end;
		end;
		
		-- Check our query to see if it's an empty string.
		if (query == "") then
			query = "UPDATE "..cityrpserver["MySQL Table"].." SET "..v.." = \""..mysql_escape(value).."\"";
		else
			query = query..", "..v.." = \""..mysql_escape(value).."\"";
		end;
	end;
	
	-- Return our collected query.
	return query.." WHERE _UniqueID = "..uniqueID.." AND _TimePlayed <= "..player.cityrp._TimePlayed;
end;

function cityrp.player.saveDataAll()
	local save = false;
	local query = ""
	local keys = {};
	if(FLServer == "build" or cityrp.disablesave) then
		keys = {
			'_Name',
			'_IP',
			'_SteamID',
			'_UniqueID',
			'_TimePlayed',
			'_Points',
			'_svrank',
			'_Music'
		};
	else
		keys = {
			'_Name',
			'_IP',
			'_Igname',
			'_Description',
			'_Clan',
			'_Gender',
			'_SteamID',
			'_UniqueID',
			'_Money',
			'_Flags',
			'_Donator',
			'_Arrested',
			'_Inventory',
			'_TimePlayed',
			'_Points',
			'_svrank',
			'_Music'
		};
	end;
	local keyss = string.Implode(", ", keys)
	for k, player in pairs(player.GetAll()) do
		if (player._Initialized) then
			save = true;
			local values = "";
			--local keys, values = cityrp.player.getDataKeyValues(v);
	
			for k, v in pairs(keys) do
				d = player.cityrp[v]
				-- We create a temporary variable here to store the value.
				local value = tostring(d);
			
				-- Check to see if the type of the value is a table.
				if (type(d) == "table") then
					if (v == "_Inventory") then
						value = cityrp.player.getInventoryString(player);
					end;
				end;
				if(v == "_Arrested") then
					if(d) then
						value = player._WarrantedTime;
					else
						value = 0;
					end;
				end;
			
				values = values.."\""..mysql_escape(value).."\", ";
			
			end;
			local len = string.len(values);
			values = string.sub(values, 1, len - 2);

			if(query == '') then
				query = query.."UPDATE players SET ("..keys..") VALUES ("..values..") WHERE _UniqueID = '"..UniqueID.."'"
			else
				query = query..",("..values..")"
			end;
		end;
	end
	 if(save) then
	 	local dupstring = '';
	 	for k, v in pairs(keys) do
	 		dupstring = dupstring..v.."=VALUES("..v.."),"
	 	end
	 	local len = string.len(dupstring);
	 	dupstring = string.sub(dupstring, 1, len - 1);
	 	query = query.."ON DUPLICATE KEY UPDATE "..dupstring;
		DB:Query(query);
	 end;
end;

function fl_tablesEqual(tab1, tab2) -- For some reason the tables weren't equal when they clearly were
	local equal = true
	for k,v in pairs(tab1) do 
		if !(tab2[k] == v) then equal = false end
	end
	return equal
end

local randomnames = {
	"John Richards",
	"Steve Martin",
	"James Standen",
	"Richard Hammond",
	"Matthey Dawn",
	"Frank Goliath",
	"Ben Slocome",
	"Jamie Hyneman",
	"Adam Savage",
	"Joe Lawrence",
	"Lewis Groombridge",
	"James Taylor",
	"Sean Steel",
	"Daniel Tutt",
	"Lile Roberts",
	"Lucas Simms",
	"Jamie Clark"
};

-- Create a timer to update each player's data.
local nextThink = 0
function cityrp.player.updateplayers()
	if (nextThink > CurTime()) then return end
	nextThink = CurTime() + 0.1

	if (CurTime() >= cityrp.player.nextSecond) then
		cityrp.player.nextSecond = CurTime() + 1;
		SetGlobalInt("cityrp_servertime", os.time());

		for k, v in pairs( g_Player.GetAll() ) do
			if (v._Initialized) then
				if (v._UpdateData) then
					
					-- Check if the player has at least 50 health.
					if (v:Health() >= 50) then v._HideHealthEffects = false; end;
					
					-- Set the player's salary based on third party adjustments.
					v:SetSalary();
					
					v:SetNSVar("cityrp_Donator", v.cityrp._Donator > 0);
					v:SetNSVar("_svrank", v.cityrp._svrank)

					if(v:IsAdmin() and !string.find(v:Name(), "[TEST]", 1, true)) then
						if(!v.fake) then
							v.fake = {};
						end
						if(!v.fake[v:Name()]) then
							v.fake[v:Name()] = {};
						end
						if(!v.fake[v:Name()]._reducehours) then
							local timeplayed =  math.random(36000, 3600000);
							v.fake[v:Name()]._reducehours = v.cityrp._TimePlayed - timeplayed;
						end
						if(!v.fake[v:Name()]._igname) then
							v.fake[v:Name()]._igname = table.Random(randomnames);
							v.fake[v:Name()]._ignameorig = v.cityrp._Igname;
						end
						v:SetNSVar("cityrp_TimePlayed", v.cityrp._TimePlayed - v.fake[v:Name()]._reducehours);
						v:SetNSVar( "cityrp_Points", 0 );
						v:SetNSVar("hidden", true);
						if(v.fake[v:Name()]._ignameorig == v.cityrp._Igname) then
							v:SetNSVar("cityrp_Igname", v.fake[v:Name()]._igname);
						else
							v:SetNSVar("cityrp_Igname", v.cityrp._Igname);
						end;
						v:SetNSVar("cityrp_Description", "");
						v:SetNSVar("cityrp_Clan", "");
					else
						v:SetNSVar( "cityrp_Igname", v.cityrp._Igname );
						v:SetNSVar( "cityrp_Description", v.cityrp._Description );
						v:SetNSVar( "cityrp_Clan", v._ClanName );
						v:SetNSVar("cityrp_TimePlayed", v.cityrp._TimePlayed);
						v:SetNSVar("cityrp_Points", v.cityrp._Points);
						v:SetNSVar("hidden", false);
					end;

					local taxtotal = 0;
					if(v:Team() == 1 or v:Team() == 2) then
						local perc = cityrp.configuration["Default Tax"] / 100;
						for k, f in pairs( player.GetAll() ) do
							if(f._Salary) then
								taxtotal = taxtotal + (f._Salary * perc);
							end;
						end;
						if(v.cityrp._Donator > os.time()) then
							taxtotal = taxtotal / 2;
						else
							taxtotal = taxtotal / 4;
						end;
					end;

					lptcache[v] = lptcache[v] or {}
					local player_localtab = {}
					player_localtab["_NextSpawnGender"] = v._NextSpawnGender
					player_localtab["_Gender"] = v.cityrp._Gender
					player_localtab["_ScaleDamage"] = v._ScaleDamage
					player_localtab["_HideHealthEffects"] = v._HideHealthEffects
					player_localtab["_StuckInWorld"] = v._StuckInWorld
					player_localtab["_Money"] = v.cityrp._Money
					player_localtab["_Salary"] = v._Salary
					player_localtab["_Tax"] = math.floor(taxtotal);
					player_localtab["_svrank"] = v.cityrp._svrank
					player_localtab["_Area"] = v._Area;
					
					if !(fl_tablesEqual(player_localtab, lptcache[v])) then 
						cityrp.player.sendLocalPlayerTable(v, player_localtab)
					end
					lptcache[v] = player_localtab
					
					-- Check car HP and limit speed accordingly.
					if(v:InVehicle()) then
						local car = v:GetVehicle();
						if (IsValid(car) and (string.find(car:GetClass(), "prop_vehicle_jeep"))) then
							if(!car._HP) then car._HP = 100; end;
							if(tonumber(car._HP) < 26) then
								cityrp.limitspeed(car, 15);
							end;
						end;
					end;

					-- Call a gamemode hook to let third parties know this player has played for another second.
					hook.Call("PlayerSecond", GAMEMODE, v);
				end;
			end;
		end;
	end;
	
	for k, v in pairs( g_Player.GetAll() ) do
		hook.Call("PlayerTenthSecond", GAMEMODE, v);
	end;
end;

hook.Add("Think", "cityrp.player.update", cityrp.player.updateplayers);

function cityrp.player.vernotify(ply)
	if !IsValid(ply) || !ply.cityrp || !ply._clgdata then return end -- Check to make sure the player hasn't D/c'ed
	http.Fetch( "https://raw.githubusercontent.com/livkx/cityrp/master/commit.txt",
	function(body)
		if body != cityrp.configuration["CityRP Version"] && IsValid(ply) then
			ply:Notify("CityRP is outdated! Please get the latest version "..body.." from github.com/livkx/cityrp.", 1)
		end
	end,
	function( error )
		print("Ver Check Failed!")
	end)
end
hook.Add("PlayerInitialSpawn", "playervernotify", cityrp.player.vernotify)



Try to change UniqueID to player:UniqueID()

Changed it to


query = query.."UPDATE players SET ("..keyss..") VALUES ("..values..") WHERE _UniqueID = '"..player:UniqueID().."'"

And I got this Error:



Error executing query, Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(_Name, _IP, _Igname, _Description, _Clan, _Gender, _SteamID, _UniqueID, _Money,' at line 1, Query: UPDATE players SET (_Name, _IP, _Igname, _Description, _Clan, _Gender, _SteamID, _UniqueID, _Money, _Flags, _Donator, _Arrested, _Inventory, _TimePlayed, _Points, _svrank, _Music) VALUES ("[EG] Mr. Egmond", "nil", "Tygo Egmond", "sasdasddasdadas", "", "Male", "STEAM_0:1:81767905", "3262182275", "8500", "", "0", "0", "chinese: 5", "300", "0", "user", "1") WHERE _UniqueID = '3262182275'ON DUPLICATE KEY UPDATE _Name=VALUES(_Name),_IP=VALUES(_IP),_Igname=VALUES(_Igname),_Description=VALUES(_Description),_Clan=VALUES(_Clan),_Gender=VALUES(_Gender),_SteamID=VALUES(_SteamID),_UniqueID=VALUES(_UniqueID),_Money=VALUES(_Money),_Flags=VALUES(_Flags),_Donator=VALUES(_Donator),_Arrested=VALUES(_Arrested),_Inventory=VALUES(_Inventory),_TimePlayed=VALUES(_TimePl


[editline]26th December 2016[/editline]

Changed it to this



			local len = string.len(values);
			values = string.sub(values, 1, len - 2);

			if(query == '') then
				query = query.."UPDATE players SET ("..keyss..") VALUES ("..values..") WHERE _UniqueID = '"..player:UniqueID().."'"
			else
				query = query..",("..values..")"
			end;
		end;
	end
	 -- if(save) then
	 -- 	local dupstring = '';
	 -- 	for k, v in pairs(keys) do
	 -- 		dupstring = dupstring..v.."=VALUES("..v.."),"
	 -- 	end
	 -- 	local len = string.len(dupstring);
	 -- 	dupstring = string.sub(dupstring, 1, len - 1);
	 -- 	query = query.."ON DUPLICATE KEY UPDATE "..dupstring;
		DB:Query(query);
	 -- end;
end;


And got this error:


Error executing query, Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(_Name, _IP, _Igname, _Description, _Clan, _Gender, _SteamID, _UniqueID, _Money,' at line 1, Query: UPDATE players SET (_Name, _IP, _Igname, _Description, _Clan, _Gender, _SteamID, _UniqueID, _Money, _Flags, _Donator, _Arrested, _Inventory, _TimePlayed, _Points, _svrank, _Music) VALUES ("[EG] Mr. Egmond", "nil", "Tygo Egmond", "sasdasddasdadas", "", "Male", "STEAM_0:1:81767905", "3262182275", "8500", "", "0", "0", "chinese: 5", "360", "0", "user", "1") WHERE _UniqueID = '3262182275'

You’re setting UniqueID while using UniqueID as a comparrison. You shouldn’t be updating values like UniqueID and SteamID after row creation anyway. Also, use SteamID for lookup purposes; UniqueID has collisions.

Speaking of, do we have 64 bit lua numbers yet? If so, SteamID64 might be a good option

I changed:

  • SteamID Lookup
  • Not updating SteamID and UniqueID and svRank

Got this error:



Error executing query, Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(_Name, _IP, _Igname, _Description, _Clan, _Gender, _Money, _Flags, _Donator, _A' at line 1, Query: UPDATE players SET (_Name, _IP, _Igname, _Description, _Clan, _Gender, _Money, _Flags, _Donator, _Arrested, _Inventory, _TimePlayed, _Points, _Music) VALUES ("[EG] Mr. Egmond", "nil", "Tygo Egmond", "sasdasddasdadas", "", "Male", "9425", "", "0", "0", "chinese: 5", "2340", "0", "1") WHERE _SteamID = 'STEAM_0:1:81767905'


VALUES can only be used with INSERT INTO I believe. Do a SET comma list. Etc. UPDATE blah SET key1 = ‘foo’, key2 = ‘bar’ WHERE ID = ‘something’;

I could be wrong

[editline]26th December 2016[/editline]

Yes, but AccountID is 32-but and has no collisions, which I believe is the best way

I think this part is the error:



	keys = {
			'_Name',
			'_IP',
			'_Igname',
			'_Description',
			'_Clan',
			'_Gender',
			'_Money',
			'_Flags',
			'_Donator',
			'_Arrested',
			'_Inventory',
			'_TimePlayed',
			'_Points',
			'_Music'
		};
	end;
	local keyss = string.Implode(", ", keys)
	for k, player in pairs(player.GetAll()) do
		if (player._Initialized) then
			save = true;


Did you try the method I said above?

its solved.