
TheNightRider
Members-
Posts
180 -
Joined
-
Last visited
Everything posted by TheNightRider
-
Thanks mate but how do i create the table?
-
JR10 if couldn't use the db files you say then how scripts such as certain fuel scripts, bank, house systems, business system etc. store their information in there?
-
Okay could you give me an example please?? I am a total noob when it comes to database scripting
-
Thanks your right ive missed that part out stupid me anyways I have corrected it but still the dbconnect line still returns a nil value. addEventHandler( "onResourceStart", resourceRoot, function( ) local server = dbConnect( "sqlite", "Storedinfo.db" ) local results = dbPoll( qh, 10 ) for key, value in pairs( results ) do dbQuery( value.r ) outputDebugString( "Query not free()'d: " .. value.q, 2 ) end end )
-
Thanks for your help I forgot to remove that lot lol. Am not all that good with scripting on this level I am a bit lost on the part of the code which does the dbconnect. It returns a nil value addEventHandler( "onResourceStop", resourceRoot, function( ) local server = dbConnect( "sqlite", "C:\Program Files\MTA San Andreas 1.1\server\mods\deathmatch\internal.db" ) for key, value in pairs( results ) do dbQuery( value.r ) outputDebugString( "Query not free()'d: " .. value.q, 2 ) end end )
-
Thanks mate ive added the tags as requested and am having bit of trouble learning the db functions. Not sure if am getting all the information I require or not
-
server = dbConnect( "sqlite", "Storedinfo.db" ) addEventHandler( "onResourceStop", resourceRoot, function( ) for key, value in pairs( results ) do db_free_result( value.r ) outputDebugString( "Query not free()'d: " .. value.q, 2 ) end end ) local function query( str, ... ) if ( ... ) then local t = { ... } for k, v in ipairs( t ) do t[ k ] = escape_string( tostring( v ) ) or "" end str = str:format( unpack( t ) ) end local result = db_query( connection, str ) if result then for num = 1, max_results do if not results[ num ] then results[ num ] = { r = result, q = str } return num end end db_free_result( result ) return false, "Unable to allocate result in pool" end return false, db_error( connection ) end function query_free( str, ... ) if sourceResource == getResourceFromName( "runcode" ) then return false end if ( ... ) then local t = { ... } for k, v in ipairs( t ) do t[ k ] = escape_string( tostring( v ) ) or "" end str = str:format( unpack( t ) ) end local result = db_query( connection, str ) if result then db_free_result( result ) return true end return false, db_error( connection ) end function free_result( result ) if results[ result ] then db_free_result( results[ result ].r ) results[ result ] = nil end end function query_assoc( str, ... ) if sourceResource == getResourceFromName( "runcode" ) then return false end local t = { } local result, error = query( str, ... ) if result then for result, row in mysql_rows_assoc( results[ result ].r ) do local num = #t + 1 t[ num ] = { } for key, value in pairs( row ) do if value ~= null then t[ num ][ key ] = tonumber( value ) or value end end end free_result( result ) return t end return false, error end function query_assoc_single( str, ... ) if sourceResource == getResourceFromName( "runcode" ) then return false end local t = { } local result, error = query( str, ... ) if result then local row = db_fetch_assoc( results[ result ].r ) if row then for key, value in pairs( row ) do if value ~= null then t[ key ] = tonumber( value ) or value end end free_result( result ) return t end free_result( result ) return false end return false, error end function query_insertid( str, ... ) if sourceResource == getResourceFromName( "runcode" ) then return false end local result, error = query( str, ... ) if result then local id = db_insert_id( connection ) free_result( result ) return id end return false, error end function query_affected_rows( str, ... ) if sourceResource == getResourceFromName( "runcode" ) then return false end local result, error = query( str, ... ) if result then local rows = db_affected_rows( connection ) free_result( result ) return rows end return false, error end I converted much as the code as I could from MYSQL to db but it won't work:( I have added the database file to the resource and it starts up but script doesn't seem to be able to find it.
-
Nothing wrong with the script itself it worked in the past and hasn't been altered whatsoever.
-
Hey guys ive set up a mysql script and a mysql server. I have setup the rights correctly but for some reason the mysql script cannot login into the mysql server. Please note:- Account on the mysql server was set up host, port, password, username etc was set up correctly in the mysql script. mysql modules etc was added into the modules folder and in the serverconf. I am lost for words on this 1 lol. It just won't login
-
Regarding collision could I use an actual object instead of colshape?
-
Cheers mate that was what I was looking for
-
Hey guys am working on a GUI am just wondering how could I use an image as a button instead of a GUI-Button? Any idea's are most welcome.
-
Thanks people for your input, I do know about the wikki if you look on my profile you'll see a automated gate script which is my first script I'll have to learn to make Modules for the server I guess hopefully I'll pull it off
-
sure but am a student and C++ is 1 of the things I have to learn. I was told its much better than LUA so I was wondering if MTA server can use C++ as a resource
-
Could anyone tell me if I could use C++ programming for my resourcing instead of LUA? Any real advice would be very welcome Thanks.
-
Okay I have finally got the SQL server going and a lot of my script is not working thanks guys
-
I am trying to get an mysql.socket file for the sql server but I cannot find 1 Any idea's?
-
Will do thanks budy
-
Yes its being done from a home computer and having trouble setting xampp up
-
Okay thank you for your possitive help
-
Cool how do I do that?