Maurize Posted August 18, 2011 Share Posted August 18, 2011 So no errors appearing. But if i browse the database, i can´t find any table named "playerData". Please help me and tell me what i have done wrong. Thanks function CreateTable() executeSQLCreateTable( "playerData", "name STRING, x FLOAT, y FLOAT, z FLOAT, s INT" ) end addEventHandler( "onResourceStart", getResourceRootElement( getThisResource() ), CreateTable ) function UpdateTable() local x, y, z = getElementPosition( source ) local s = getElementModel( source ) local playerTable = executeSQLUpdate( "playerData", "name = '" .. getAccountName( getPlayerAccount( source ) ) .. "'", "x = '" .. x .. "'", "y = '" .. y .. "'", "z = '" .. z .. "'", "s = '" .. s .. "'" ) end addEventHandler( "onPlayerQuit", getRootElement(), UpdateTable ) function SelectTable() local playerTable = executeSQLSelect ( "playerData", "name = '" .. getAccountName( getPlayerAccount( source ) ) .. "'", "x", "y", "z", "s" ) setElementPosition( source, playerTable[3], playerTable[4], playerTable[5] ) setElementModel( source, playerTable[6] ) end addEventHandler( "onPlayerLogin", getRootElement(), SelectTable ) Link to comment
JR10 Posted August 18, 2011 Share Posted August 18, 2011 Both function arguments are wrong. bool executeSQLUpdate ( string tableName, string set, [ string conditions ] ) 3 arguments. executeSQLUpdate should be: executeSQLUpdate( "playerData", "name = '" .. getAccountName( getPlayerAccount( source ) ) .. "', x = '" .. x .. "', y = '" .. y .. "', z = '" .. z .. "', s = '" .. s .. "'" ) Creating the table is correct, make sure you are checking registry.db not internal.db Link to comment
Maurize Posted August 19, 2011 Author Share Posted August 19, 2011 Thanks. Hm. So SQL is a very smart database Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now