ThaD4N13L Posted December 18, 2011 Share Posted December 18, 2011 @SolidSnake14 MTA Paradise is a good GM it just needs to be put in proper things and re-scripted re-don like put the account-system and lses-system don't just put things in the players thing. Link to comment
JR10 Posted December 18, 2011 Share Posted December 18, 2011 @NightRider, I suggest you take a look at one of the resources that use sqlite, like house_system by dakilla, or my business resource. Link to comment
Castillo Posted December 18, 2011 Share Posted December 18, 2011 @SolidSnake14 MTA Paradise is a good GM it just needs to be put in proper things and re-scripted re-don like put the account-system and lses-system don't just put things in the players thing. I was talking about the MySQL of MTA Paradise, he tried to put a Lua table with columns into a MySQL table like MTA Paradise does, but it's not that simple. Link to comment
TheNightRider Posted December 18, 2011 Author Share Posted December 18, 2011 Okay guys I will do and just thought I could use paradise as something to learn from. I'll check out the house_system see if that will help me better to direct my learning Link to comment
TheNightRider Posted December 18, 2011 Author Share Posted December 18, 2011 I have had a look and ive tidied the script up however it still returns the connection has nil (false) could someone explain why this is happening? function( ) local server = dbConnect( "sqlite", "Storedinfo.db" ) local qh = dbQuery(server, "SELECT * FROM vehicles") local results = dbPoll( qh, -1 ) for key, value in pairs( results ) do dbFree ( dbQuery ( connection,"CREATE TABLE IF NOT EXISTS newTable ( vehicleID, model, posX, posY, posZ, rotX, rotY, rotZ, interior, dimension, respawnPosX, respawnPosY, respawnPosZ, respawnRotX, respawnRotY, respawnRotZ, respawnInterior, respawn, Dimension, numberplate, health, color1, color2, characterID, engineState, locked, lightsState, tintedWindows, fuel")) return end Link to comment
Castillo Posted December 18, 2011 Share Posted December 18, 2011 function( ) local server = dbConnect( "sqlite", "Storedinfo.db" ) local qh = dbQuery(server, "SELECT * FROM vehicles") local results = dbPoll( qh, -1 ) dbFree ( dbQuery ( server,"CREATE TABLE IF NOT EXISTS newTable ( vehicleID, model, posX, posY, posZ, rotX, rotY, rotZ, interior, dimension, respawnPosX, respawnPosY, respawnPosZ, respawnRotX, respawnRotY, respawnRotZ, respawnInterior, respawn, Dimension, numberplate, health, color1, color2, characterID, engineState, locked, lightsState, tintedWindows, fuel")) end) Link to comment
TheNightRider Posted December 18, 2011 Author Share Posted December 18, 2011 Thank you but still get a nil value Link to comment
TheNightRider Posted December 18, 2011 Author Share Posted December 18, 2011 Get a nil value where? Here:- local server = dbConnect( "sqlite", "Storedinfo.db" ) It is the correct name for the db file plus its in the same folder as the script. Link to comment
JR10 Posted December 18, 2011 Share Posted December 18, 2011 Did you create 'Storedinfo.db' yourself? Link to comment
TheNightRider Posted December 19, 2011 Author Share Posted December 19, 2011 yes with sqllite Link to comment
JR10 Posted December 19, 2011 Share Posted December 19, 2011 Hm weird, try deleting 'Storedinfo.db'. And let the script create it. Link to comment
TheNightRider Posted December 19, 2011 Author Share Posted December 19, 2011 Sorry doesn't work I didn't think it would. Link to comment
BinSlayer1 Posted December 19, 2011 Share Posted December 19, 2011 What kind of nil? like "attempt to call global function (blahblah) a nil value" ? That means you need to check meta.xml and make sure it's serverside script also are you sure you're running one of the latest nightlies (patches) ? Link to comment
myonlake Posted December 19, 2011 Share Posted December 19, 2011 Just use MySQL Way easier. Link to comment
TheNightRider Posted December 20, 2011 Author Share Posted December 20, 2011 Thanks for that I forgot to state its server in the meta.xml lol I was told in the past if you don't state which 1 it is it will become serverside any ways. What is the nightlies patch and do you know where I can get it from? I have a syntax error near 'fuel' but I cannot find it lol dbFree ( dbQuery ( server,"CREATE TABLE IF NOT EXISTS newTable ( vehicleID, model, posX, posY, posZ, rotX, rotY, rotZ, interior,respawnPosX, respawnPosY, respawnPosZ, respawnRotX, respawnRotY, respawnRotZ, respawnInterior, respawn, Dimension, numberplate, health, color1, color2, characterID, engineState, locked, lightsState, tintedWindows, fuel")) Link to comment
BinSlayer1 Posted December 20, 2011 Share Posted December 20, 2011 Thanks for that I forgot to state its server in the meta.xml lol I was told in the past if you don't state which 1 it is it will become serverside any ways. What is the nightlies patch and do you know where I can get it from?I have a syntax error near 'fuel' but I cannot find it lol dbFree ( dbQuery ( server,"CREATE TABLE IF NOT EXISTS newTable ( vehicleID, model, posX, posY, posZ, rotX, rotY, rotZ, interior,respawnPosX, respawnPosY, respawnPosZ, respawnRotX, respawnRotY, respawnRotZ, respawnInterior, respawn, Dimension, numberplate, health, color1, color2, characterID, engineState, locked, lightsState, tintedWindows, fuel")) dbFree ( dbQuery ( server,"CREATE TABLE IF NOT EXISTS newTable ( vehicleID, model, posX, posY, posZ, rotX, rotY, rotZ, interior,respawnPosX, respawnPosY, respawnPosZ, respawnRotX, respawnRotY, respawnRotZ, respawnInterior, respawn, Dimension, numberplate, health, color1, color2, characterID, engineState, locked, lightsState, tintedWindows, fuel )")) Try this. Not sure Also.. In order to execute these db-functions you need either 1.1 with latest patch (https://nightly.multitheftauto.com) or MTA 1.2 If you don't have these then your MTA server will most likely not have the functions built-in so they will return nil when called About meta.xml, if you don't define server/client types then it indeed defaults to server Link to comment
TheNightRider Posted December 20, 2011 Author Share Posted December 20, 2011 Thank you now it says error:call to none-running server resource (sql) string?? Forget to mention am on the MTA 1.2 and I don't know where on the site the patch is. if exports.sql:query_free( "UPDATE vehicles SET characterID = " .. -faction .. " WHERE vehicleID = " .. data.vehicleID ) then Link to comment
JR10 Posted December 20, 2011 Share Posted December 20, 2011 Do you have a resource called 'sql' running? I guess it should be: if dbFree ( dbQuery ( server, "UPDATE vehicles SET characterID = " .. faction .. " WHERE vehicleID = " .. data.vehicleID )) then Link to comment
TheNightRider Posted December 20, 2011 Author Share Posted December 20, 2011 Do you have a resource called 'sql' running?I guess it should be: if dbFree ( dbQuery ( server, "UPDATE vehicles SET characterID = " .. faction .. " WHERE vehicleID = " .. data.vehicleID )) then Sql as in for mysql? if so then no i don't and your right ive corrected that and now the script builds the tables but i want to set the correct settings for the table for each such as autoincrement, num, text etc. but idk how to do that part whatsoever Link to comment
JR10 Posted December 20, 2011 Share Posted December 20, 2011 You are already updating the sql table. Be more specific about your problem. Also, I would suggest you to use '?' instead of using the variables in the query string. Ex: if dbFree ( dbQuery ( server, "UPDATE vehicles SET characterID = ? WHERE vehicleID = ?" , faction, data.vehicleID )) then Take a look here for more information: executeSQLQuery. 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