xXMADEXx Posted March 9, 2013 Posted March 9, 2013 Im trying to make my housing system on sqlite, so that my server dosn't lag, but for some reason i keep on getting this error: [2013-03-09 11:14:09] WARNING: test\server.lua:25: dbExec failed; SQL logic error or missing database Here is my script: connectToDb = dbConnect( "sqlite", "housing.db" ) addEventHandler('onResourceStart',getResourceRootElement(), function () if (not connectToDb) then outputChatBox("ERROR: Housing.db has failed to load!",255,0,0) else --dbExec ( connectToDb, "CREATE TABLE IF NOT EXISTS 'houses' ( city TEXT PRIMARY KEY, zone INT, x INT, y INT, z INT, int INT, dim INT )" ) dbExec ( connectToDb, "CREATE TABLE IF NOT EXISTS 'houses' ( rowid INT PRIMARY KEY, city TEXT, zone TEXT, x INT, y INT, z INT, int INT, dim INT )" ) end end ) addCommandHandler("house", function (player) local x,y,z = getElementPosition(player) local city = getZoneName(x,y,z,true) local zone = getZoneName(x,y,z) -- x,y,z,int,dim createHouse(city,zone,x,y,z,math.random(1,10),math.random(0,5000)) end ) function createHouse(city,zone,x,y,z,int,dim) local insertTheNewHouse = dbExec ( connectToDb, "INSERT INTO houses VALUES (?,?,?,?,?,?,?,?)","NULL",city,zone,x,y,z,int,dim) newHousePickup = createPickup(x,y,z,3,1272,500) end The Ultimate Lua Tutorial! | MTA PHP SDK
Castillo Posted March 9, 2013 Posted March 9, 2013 connectToDb = dbConnect( "sqlite", "housing.db" ) addEventHandler('onResourceStart',getResourceRootElement(), function () if (not connectToDb) then outputChatBox("ERROR: Housing.db has failed to load!",255,0,0) else --dbExec ( connectToDb, "CREATE TABLE IF NOT EXISTS 'houses' ( city TEXT PRIMARY KEY, zone INT, x INT, y INT, z INT, int INT, dim INT )" ) dbExec ( connectToDb, "CREATE TABLE IF NOT EXISTS 'houses' ( rowID INT PRIMARY KEY, city TEXT, zone TEXT, x INT, y INT, z INT, int INT, dim INT )" ) end end ) addCommandHandler("house", function (player) local x,y,z = getElementPosition(player) local city = getZoneName(x,y,z,true) local zone = getZoneName(x,y,z) -- x,y,z,int,dim createHouse(city,zone,x,y,z,math.random(1,10),math.random(0,5000)) end ) function createHouse(city,zone,x,y,z,int,dim) dbExec ( handler, "INSERT INTO houses ( city, zone, x, y, z, int, dim ) VALUES ( ?, ?, ?, ?, ?, ?, ? )", city, zone, x, y, z, int, dim ) newHousePickup = createPickup(x,y,z,3,1272,500) end San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
xXMADEXx Posted March 9, 2013 Author Posted March 9, 2013 Thank you, again The Ultimate Lua Tutorial! | MTA PHP SDK
Castillo Posted March 9, 2013 Posted March 9, 2013 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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