Saving Teams Models

Hay guys im trying to make it able to save the model that was last knowned
just to let you guys now that im using goatures database.

Thats the Putting it in



function ply:databaseModel()
local model = ply:GetNWInt("Model")
ply:SetModel( model )


end





function ply:databaseDefault()

	self:databaseSetValue( "Model", "models/Humans/Group01/male_09.mdl")

	local i = {}
	
	self:databaseSetValue( "inventory", i )
end

function ply:databaseNetworkedData()

	local Models = self:databaseGetValue( "Model" )

	self:SetNWInt("Model", Models)
	
	
	self:KillSilent()
	self:Spawn()
end




function GM:PlayerSpawn( ply )
ply:databaseModel()

end


The Errors are leading to



function ply:databaseModel()
local model = ply:GetNWInt("Model") -- HERE
ply:SetModel( model )

end


can you tell me what im doing wrong thank you!

where is ply:databaseNetworkedData() being called?

It appears you’re trying to compare an int to a string. At least, that’s what I’ve gathered without seeing the functions you haven’t listed.

Right around here, you’re setting the database value of ‘Model’ to a string.


self:databaseSetValue( "Model", "models/Humans/Group01/male_09.mdl") /*  That second argument is a string, hence the quotes around it.  */

Then, you’re setting that string to a variable, then trying to pass it in as an int into SetNWInt.


local Models = self:databaseGetValue( "Model" ) /*  Setting the above string to a variable...  */
self:SetNWInt("Model", Models) /*  ... then trying to set a Networked Int to a string.  */

From what I can tell, that’s your problem. Using ‘SetNWString’ instead of ‘SetNWInt’ might fix that. If not, please post the ‘databaseSetValue’ and ‘databaseGetValue’ functions as well.