Jump to content

i have done everything and it still dont work!!!


k0ed298

Recommended Posts

Ok ive done everything to try and get my paradise server started. Ive updated the mta_mysql.dll file and i put the libmysql in the server directory but this still comes up! please. please someone help.

=========================================================== 
= Multi Theft Auto: San Andreas v1.3 
=========================================================== 
= Server name      : paradise ~ Roleplay 
= Server IP address:  
= Server port      : 22003 
=  
= Log file         : .. 1.3/server/mods/deathmatch/logs/server.log 
= Maximum players  : 32 
= HTTP port        : 22005 
= Voice Chat       : Disabled 
=========================================================== 
[2012-04-28 00:12:11] Resources: 212 loaded, 0 failed 
[2012-04-28 00:12:11] Querying game-monitor.com master server... unavailable! 
[2012-04-28 00:12:11] Querying backup master server... success! 
[2012-04-28 00:12:12] MODULE: Loaded "MySQL 5.0 database module" (0.50) by "Alberto Alonso <[email protected]>" 
[2012-04-28 00:12:12] MODULE: Loaded "SHA Module" (1.02) by "mabako" 
[2012-04-28 00:12:12] MODULE: Loaded "MySQL 5.0 database module" (0.50) by "Alberto Alonso <[email protected]>" 
[2012-04-28 00:12:12] Starting resources..... 
[2012-04-28 00:12:13] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061) 
[2012-04-28 00:12:13] ERROR: sql\mysql.lua:42: Connection to MySQL Failed. 
[2012-04-28 00:12:13] Server shutdown as requested by resource sql (MySQL failed to connect.) 
[2012-04-28 00:12:13] Start up of resource sql cancelled by script 
[2012-04-28 00:12:13] ERROR: Unable to start resource sql; Start up of resource cancelled by script 
  
[2012-04-28 00:12:13] Start up of resource irc cancelled by script 
[2012-04-28 00:12:13] ERROR: Unable to start resource irc; Start up of resource cancelled by script 
  
[2012-04-28 00:12:14] WARNING: players/main.lua(Line 379) [server] setPedFrozen is deprecated and may not work in future versions. Please replace with setElementFrozen. 
[2012-04-28 00:12:14] Some files in 'players' use deprecated functions. 
[2012-04-28 00:12:14] Use the 'upgrade' command to perform a basic upgrade of resources. 
[2012-04-28 00:12:15] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061) 
[2012-04-28 00:12:15] ERROR: sql\mysql.lua:42: Connection to MySQL Failed. 
[2012-04-28 00:12:15] Server shutdown as requested by resource sql (MySQL failed to connect.) 
[2012-04-28 00:12:15] Start up of resource sql cancelled by script 
[2012-04-28 00:12:15] ERROR: exports: Call to non-running server resource (sql) [string "?"] 
[2012-04-28 00:12:15] Start up of resource players cancelled by script 
[2012-04-28 00:12:15] ERROR: Unable to start resource players; Start up of resource cancelled by script 
  

Link to comment
  • Replies 55
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Change this lines ( sql/mysql.lua )( 27-32 )

  
local server = get( "server" ) or "localhost" 
local user = get( "user" ) or "root" 
local password = get( "password" ) or "" 
local db = get( "database" ) or "mta" 
local port = get( "port" ) or 3306 
local socket = get( "socket" ) or nil 

Link to comment
Change this lines ( sql/mysql.lua )( 27-32 )
  
local server = get( "server" ) or "localhost" 
local user = get( "user" ) or "root" 
local password = get( "password" ) or "" 
local db = get( "database" ) or "mta" 
local port = get( "port" ) or 3306 
local socket = get( "socket" ) or nil 

What do i change ? Like what file do i have to change ??

Link to comment

ok im just going to post the notes so i can see where abouts i have put the words and tht .

  
Copyright (c) 2010 MTA: Paradise 
  
This program is free software; you can redistribute it and/or modify 
it under the terms of the GNU General Public License as published by 
the Free Software Foundation; either version 3 of the License, or 
(at your option) any later version. 
  
This program is distributed in the hope that it will be useful, 
but WITHOUT ANY WARRANTY; without even the implied warranty of 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
GNU General Public License for more details. 
  
You should have received a copy of the GNU General Public License 
along with this program. If not, see <http://www.gnu.org/licenses/>. 
]] 
  
local connection = nil 
local connection = nil 
local null = nil 
local results = { } 
local max_results = 128 
  
-- connection functions 
local function connect( ) 
    -- retrieve the settings 
    local server = get( "server" ) or "localhost" 
    local user = get( "user" ) or "root" 
    local password = get( "password" ) or "" 
    local db = get( "database" ) or "mta" 
    local port = get( "port" ) or 3306 
    local socket = get( "socket" ) or nil 
     
    -- connect 
    connection = mysql_connect ( server, user, password, db, port, socket ) 
    if connection then 
        if user == "root" then 
            setTimer( outputDebugString, 100, 1, "Connecting to your MySQL as 'root' is strongly discouraged.", 2 ) 
        end 
        return true 
    else 
        outputDebugString ( "Connection to MySQL Failed.", 1 ) 
        return false 
    end 
end 
  
local function disconnect( ) 
    if connection and mysql_ping( connection ) then 
        mysql_close( connection ) 
    end 
end 
  
local function checkConnection( ) 
    if not connection or not mysql_ping( connection ) then 
        return connect( ) 
    end 
    return true 
end 
  
addEventHandler( "onResourceStart", resourceRoot, 
    function( ) 
        if not mysql_connect then 
            if hasObjectPermissionTo( resource, "function.shutdown" ) then 
                shutdown( "MySQL module missing." ) 
            end 
            cancelEvent( true, "MySQL module missing." ) 
        elseif not hasObjectPermissionTo( resource, "function.mysql_connect" ) then 
            if hasObjectPermissionTo( resource, "function.shutdown" ) then 
                shutdown( "Insufficient ACL rights for mysql resource." ) 
            end 
            cancelEvent( true, "Insufficient ACL rights for mysql resource." ) 
        elseif not connect( ) then 
            if connection then 
                outputDebugString( mysql_error( connection ), 1 ) 
            end 
             
            if hasObjectPermissionTo( resource, "function.shutdown" ) then 
                shutdown( "MySQL failed to connect." ) 
            end 
            cancelEvent( true, "MySQL failed to connect." ) 
        else 
            null = mysql_null( ) 
        end 
    end 
) 
  
addEventHandler( "onResourceStop", resourceRoot, 
    function( ) 
        for key, value in pairs( results ) do 
            mysql_free_result( value.r ) 
            outputDebugString( "Query not free()'d: " .. value.q, 2 ) 
        end 
         
        disconnect( ) 
    end 
) 
  
-- 
  
function escape_string( str ) 
    if type( str ) == "string" then 
        return mysql_escape_string( connection, str ) 
    elseif type( str ) == "number" then 
        return tostring( str ) 
    end 
end 
  
local function query( str, ... ) 
    checkConnection( ) 
     
    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 = mysql_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 
        mysql_free_result( result ) 
        return false, "Unable to allocate result in pool" 
    end 
    return false, mysql_error( connection ) 
end 
  
function query_free( str, ... ) 
    if sourceResource == getResourceFromName( "runcode" ) then 
        return false 
    end 
     
    checkConnection( ) 
     
    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 = mysql_query( connection, str ) 
    if result then 
        mysql_free_result( result ) 
        return true 
    end 
    return false, mysql_error( connection ) 
end 
  
function free_result( result ) 
    if results[ result ] then 
        mysql_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 = mysql_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 = mysql_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 = mysql_affected_rows( connection ) 
        free_result( result ) 
        return rows 
    end 
    return false, error 
end 
  

Edit:

"mods\deathmatch\resources\sql\mysql.lua"

ok i can run the server now but the screen just goes black. this is whats came up in the sever log.

=========================================================== 
= Multi Theft Auto: San Andreas v1.3 
=========================================================== 
= Server name      : paradise ~ Roleplay 
= Server IP address:  
= Server port      : 22003 
=  
= Log file         : .. 1.3/Server/mods/deathmatch/logs/server.log 
= Maximum players  : 32 
= HTTP port        : 22005 
= Voice Chat       : Disabled 
=========================================================== 
[2012-04-28 11:43:58] Resources: 212 loaded, 0 failed 
[2012-04-28 11:43:58] Querying game-monitor.com master server... unavailable! 
[2012-04-28 11:43:58] Querying backup master server... success! 
[2012-04-28 11:43:59] MODULE: Loaded "MySQL 5.0 database module" (0.50) by "Alberto Alonso <[email protected]>" 
[2012-04-28 11:43:59] MODULE: Loaded "SHA Module" (1.02) by "mabako" 
[2012-04-28 11:43:59] MODULE: Loaded "MySQL 5.0 database module" (0.50) by "Alberto Alonso <[email protected]>" 
[2012-04-28 11:43:59] Starting resources..... 
[2012-04-28 11:43:59] SCRIPT ERROR: sql\mysql.lua:1: unexpected symbol near '2010' 
[2012-04-28 11:43:59] WARNING: Loading script failed: sql\mysql.lua:1: unexpected symbol near '2010' 
[2012-04-28 11:43:59] Start up of resource irc cancelled by script 
[2012-04-28 11:43:59] ERROR: Unable to start resource irc; Start up of resource cancelled by script 
  
[2012-04-28 11:43:59] WARNING: players/main.lua(Line 379) [server] setPedFrozen is deprecated and may not work in future versions. Please replace with setElementFrozen. 
[2012-04-28 11:43:59] Some files in 'players' use deprecated functions. 
[2012-04-28 11:43:59] Use the 'upgrade' command to perform a basic upgrade of resources. 
[2012-04-28 11:43:59] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:43:59] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:43:59] Start up of resource players cancelled by script 
[2012-04-28 11:43:59] ERROR: Unable to start resource players; Start up of resource cancelled by script 
  
[2012-04-28 11:44:00] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:00] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:00] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:00] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:00] Start up of resource vehicles cancelled by script 
[2012-04-28 11:44:00] ERROR: Unable to start resource vehicles; Start up of resource cancelled by script 
  
[2012-04-28 11:44:01] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:01] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:01] Start up of resource players cancelled by script 
[2012-04-28 11:44:01] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:01] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:01] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:01] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:01] Start up of resource items cancelled by script 
[2012-04-28 11:44:01] ERROR: Unable to start resource items; Start up of resource cancelled by script 
  
[2012-04-28 11:44:01] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:01] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:01] Start up of resource players cancelled by script 
[2012-04-28 11:44:01] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:01] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:01] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:01] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:01] Start up of resource vehicles cancelled by script 
[2012-04-28 11:44:02] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:02] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:02] Start up of resource players cancelled by script 
[2012-04-28 11:44:02] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:02] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:02] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:02] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:02] Start up of resource items cancelled by script 
[2012-04-28 11:44:02] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:02] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:02] Start up of resource players cancelled by script 
[2012-04-28 11:44:04] WARNING: shops/shop.lua(Line 57) [server] setPedFrozen is deprecated and may not work in future versions. Please replace with setElementFrozen. 
[2012-04-28 11:44:04] Some files in 'shops' use deprecated functions. 
[2012-04-28 11:44:04] Use the 'upgrade' command to perform a basic upgrade of resources. 
[2012-04-28 11:44:05] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:05] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:05] Start up of resource players cancelled by script 
[2012-04-28 11:44:05] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:05] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:05] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:05] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:05] Start up of resource items cancelled by script 
[2012-04-28 11:44:05] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:05] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:05] Start up of resource players cancelled by script 
[2012-04-28 11:44:05] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:05] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:05] Start up of resource shops cancelled by script 
[2012-04-28 11:44:06] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:06] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:06] Start up of resource players cancelled by script 
[2012-04-28 11:44:06] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:06] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:06] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:06] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:06] Start up of resource items cancelled by script 
[2012-04-28 11:44:06] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:06] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:06] Start up of resource players cancelled by script 
[2012-04-28 11:44:06] ERROR: Unable to start resource shops; Start up of resource cancelled by script 
  
[2012-04-28 11:44:06] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:06] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:06] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:06] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:06] Start up of resource vehicles cancelled by script 
[2012-04-28 11:44:07] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:07] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:07] Start up of resource players cancelled by script 
[2012-04-28 11:44:07] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:07] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:07] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:07] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:07] Start up of resource items cancelled by script 
[2012-04-28 11:44:07] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:07] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:07] Start up of resource players cancelled by script 
[2012-04-28 11:44:07] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:07] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:07] Start up of resource shops cancelled by script 
[2012-04-28 11:44:08] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:08] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:08] Start up of resource players cancelled by script 
[2012-04-28 11:44:08] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:08] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:08] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:08] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:08] Start up of resource items cancelled by script 
[2012-04-28 11:44:08] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:08] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:08] Start up of resource players cancelled by script 
[2012-04-28 11:44:08] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:08] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:08] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:08] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:08] Start up of resource vehicles cancelled by script 
[2012-04-28 11:44:08] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:08] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:08] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:08] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:08] Start up of resource vehicles cancelled by script 
[2012-04-28 11:44:08] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:08] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:08] Start up of resource maps cancelled by script 
[2012-04-28 11:44:08] ERROR: Unable to start resource maps; Start up of resource cancelled by script 
  
[2012-04-28 11:44:08] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:08] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:08] Start up of resource teleports cancelled by script 
[2012-04-28 11:44:08] ERROR: Unable to start resource teleports; Start up of resource cancelled by script 
  
[2012-04-28 11:44:08] ERROR: Couldn't find resource an  ims. Check it exists. 
[2012-04-28 11:44:08] WARNING: bank/bank.lua(Line 59) [server] setPedFrozen is deprecated and may not work in future versions. Please replace with setElementFrozen. 
[2012-04-28 11:44:08] Some files in 'bank' use deprecated functions. 
[2012-04-28 11:44:08] Use the 'upgrade' command to perform a basic upgrade of resources. 
[2012-04-28 11:44:09] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:09] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:09] Start up of resource players cancelled by script 
[2012-04-28 11:44:10] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:10] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:10] Start up of resource players cancelled by script 
[2012-04-28 11:44:10] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:10] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:10] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:10] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:10] Start up of resource items cancelled by script 
[2012-04-28 11:44:10] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:10] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:10] Start up of resource players cancelled by script 
[2012-04-28 11:44:10] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:10] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:10] Start up of resource bank cancelled by script 
[2012-04-28 11:44:10] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:10] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:10] Start up of resource players cancelled by script 
[2012-04-28 11:44:11] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:11] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:11] Start up of resource players cancelled by script 
[2012-04-28 11:44:11] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:11] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:11] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:11] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:11] Start up of resource items cancelled by script 
[2012-04-28 11:44:11] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:11] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:11] Start up of resource players cancelled by script 
[2012-04-28 11:44:11] ERROR: Unable to start resource bank; Start up of resource cancelled by script 
  
[2012-04-28 11:44:12] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:12] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:12] Start up of resource players cancelled by script 
[2012-04-28 11:44:12] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:12] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:12] Start up of resource factions cancelled by script 
[2012-04-28 11:44:12] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:12] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:12] Start up of resource players cancelled by script 
[2012-04-28 11:44:12] ERROR: Unable to start resource factions; Start up of resource cancelled by script 
  
[2012-04-28 11:44:12] ERROR: sql\layout.lua:65: attempt to call global 'query_assoc_single' (a nil value) 
[2012-04-28 11:44:12] ERROR: call: failed to call 'sql:create_table' [string "?"] 
[2012-04-28 11:44:12] Start up of resource 3dtext cancelled by script 
[2012-04-28 11:44:12] ERROR: Unable to start resource 3dtext; Start up of resource cancelled by script 
  
[2012-04-28 11:44:12] Server started and is ready to accept connections! 
[2012-04-28 11:44:12] Type 'help' for a list of commands. 
[2012-04-28 11:44:12]               _                                    _ _ 
[2012-04-28 11:44:12]              | |                                  | (_) 
[2012-04-28 11:44:12]     _ __ ___ | |_ __ _   _ __   __ _ _ __ __ _  __| |_ ___  ___ 
[2012-04-28 11:44:12]    | '_ ` _ \| __/ _` | | '_ \ / _` | '__/ _` |/ _` | / __|/ _ \ 
[2012-04-28 11:44:12]    | | | | | | || (_| | | |_) | (_| | | | (_| | (_| | \__ \  __/ 
[2012-04-28 11:44:12]    |_| |_| |_|\__\__,_| | .__/ \__,_|_|  \__,_|\__,_|_|___/\___| 
[2012-04-28 11:44:12]                         | | 
[2012-04-28 11:44:12]                         |_| v1.00 
[2012-04-28 11:44:45] Available commands: 
  
update                   start                    stop                      
stopall                  restart                  refresh                   
refreshall               list                     info                      
install                  upgrade                  checkall                  
say                      teamsay                  msg                       
me                       nick                     login                     
logout                   chgmypass                addaccount                
delaccount               chgpass                  shutdown                  
aexec                    whois                    whowas                    
debugscript              help                     loadmodule                
ver                      sver                     ase                       
openports                stest                    checkls                   
debugdb                  aclrequest                
[2012-04-28 11:46:12] CONNECT: jake connected (IP: 192.168.0.3  Serial: 95A17DC75C53D1BBC2D2FB7A541DD494  Version: 1.3.0-9.03916.0) 
[2012-04-28 11:46:16] JOIN: jake joined the game (IP: 192.168.0.3) 
[2012-04-28 11:46:24] ERROR: parasite\elementdata.lua:39: attempt to call global 'getElmentType' (a nil value) 
[2012-04-28 11:46:24] ERROR: parasite\elementdata.lua:39: attempt to call global 'getElmentType' (a nil value) 
[2012-04-28 11:46:24] ERROR: parasite\elementdata.lua:39: attempt to call global 'getElmentType' (a nil value) 
[2012-04-28 11:46:24] ERROR: parasite\elementdata.lua:39: attempt to call global 'getElmentType' (a nil value) 
  

Link to comment
Copyright (c) 2010 MTA: Paradise 
  
  
  
This program is free software; you can redistribute it and/or modify 
it under the terms of the GNU General Public License as published by 
the Free Software Foundation; either version 3 of the License, or 
(at your option) any later version. 
  
This program is distributed in the hope that it will be useful, 
but WITHOUT ANY WARRANTY; without even the implied warranty of 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
GNU General Public License for more details. 
  
You should have received a copy of the GNU General Public License 
along with this program. If not, see <http://www.gnu.org/licenses/>. 
]] 
  
local connection = nil 
local connection = nil 
local null = nil 
local results = { } 
local max_results = 128 
  
-- connection functions 
local function connect( ) 
    -- retrieve the settings 
    local server = get( "server" ) or "localhost" 
local user = get( "user" ) or "root" 
local password = get( "password" ) or "" 
local db = get( "database" ) or "mta" 
local port = get( "port" ) or 3306 
local socket = get( "socket" ) or nil 
     
    -- connect 
    connection = mysql_connect ( server, user, password, db, port, socket ) 
    if connection then 
        if user == "root" then 
            setTimer( outputDebugString, 100, 1, "Connecting to your MySQL as 'root' is strongly discouraged.", 2 ) 
        end 
        return true 
    else 
        outputDebugString ( "Connection to MySQL Failed.", 1 ) 
        return false 
    end 
end 
  
local function disconnect( ) 
    if connection and mysql_ping( connection ) then 
        mysql_close( connection ) 
    end 
end 
  
local function checkConnection( ) 
    if not connection or not mysql_ping( connection ) then 
        return connect( ) 
    end 
    return true 
end 
  
addEventHandler( "onResourceStart", resourceRoot, 
    function( ) 
        if not mysql_connect then 
            if hasObjectPermissionTo( resource, "function.shutdown" ) then 
                shutdown( "MySQL module missing." ) 
            end 
            cancelEvent( true, "MySQL module missing." ) 
        elseif not hasObjectPermissionTo( resource, "function.mysql_connect" ) then 
            if hasObjectPermissionTo( resource, "function.shutdown" ) then 
                shutdown( "Insufficient ACL rights for mysql resource." ) 
            end 
            cancelEvent( true, "Insufficient ACL rights for mysql resource." ) 
        elseif not connect( ) then 
            if connection then 
                outputDebugString( mysql_error( connection ), 1 ) 
            end 
             
            if hasObjectPermissionTo( resource, "function.shutdown" ) then 
                shutdown( "MySQL failed to connect." ) 
            end 
            cancelEvent( true, "MySQL failed to connect." ) 
        else 
            null = mysql_null( ) 
        end 
    end 
) 
  
addEventHandler( "onResourceStop", resourceRoot, 
    function( ) 
        for key, value in pairs( results ) do 
            mysql_free_result( value.r ) 
            outputDebugString( "Query not free()'d: " .. value.q, 2 ) 
        end 
         
        disconnect( ) 
    end 
) 
  
-- 
  
function escape_string( str ) 
    if type( str ) == "string" then 
        return mysql_escape_string( connection, str ) 
    elseif type( str ) == "number" then 
        return tostring( str ) 
    end 
end 
  
local function query( str, ... ) 
    checkConnection( ) 
     
    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 = mysql_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 
        mysql_free_result( result ) 
        return false, "Unable to allocate result in pool" 
    end 
    return false, mysql_error( connection ) 
end 
  
function query_free( str, ... ) 
    if sourceResource == getResourceFromName( "runcode" ) then 
        return false 
    end 
     
    checkConnection( ) 
     
    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 = mysql_query( connection, str ) 
    if result then 
        mysql_free_result( result ) 
        return true 
    end 
    return false, mysql_error( connection ) 
end 
  
function free_result( result ) 
    if results[ result ] then 
        mysql_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 = mysql_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 = mysql_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 = mysql_affected_rows( connection ) 
        free_result( result ) 
        return rows 
    end 
    return false, error 
end 
  

Post your "mysql.lua" content, you have a script error.
Link to comment

You've got missing "--[[" at line @ 1.

--[[ 
Copyright (c) 2010 MTA: Paradise 
  
  
  
This program is free software; you can redistribute it and/or modify 
it under the terms of the GNU General Public License as published by 
the Free Software Foundation; either version 3 of the License, or 
(at your option) any later version. 
  
This program is distributed in the hope that it will be useful, 
but WITHOUT ANY WARRANTY; without even the implied warranty of 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
GNU General Public License for more details. 
  
You should have received a copy of the GNU General Public License 
along with this program. If not, see . 
]] 
  
local connection = nil 
local connection = nil 
local null = nil 
local results = { } 
local max_results = 128 
  
-- connection functions 
local function connect( ) 
    -- retrieve the settings 
    local server = get( "server" ) or "localhost" 
local user = get( "user" ) or "root" 
local password = get( "password" ) or "" 
local db = get( "database" ) or "mta" 
local port = get( "port" ) or 3306 
local socket = get( "socket" ) or nil 
    
    -- connect 
    connection = mysql_connect ( server, user, password, db, port, socket ) 
    if connection then 
        if user == "root" then 
            setTimer( outputDebugString, 100, 1, "Connecting to your MySQL as 'root' is strongly discouraged.", 2 ) 
        end 
        return true 
    else 
        outputDebugString ( "Connection to MySQL Failed.", 1 ) 
        return false 
    end 
end 
  
local function disconnect( ) 
    if connection and mysql_ping( connection ) then 
        mysql_close( connection ) 
    end 
end 
  
local function checkConnection( ) 
    if not connection or not mysql_ping( connection ) then 
        return connect( ) 
    end 
    return true 
end 
  
addEventHandler( "onResourceStart", resourceRoot, 
    function( ) 
        if not mysql_connect then 
            if hasObjectPermissionTo( resource, "function.shutdown" ) then 
                shutdown( "MySQL module missing." ) 
            end 
            cancelEvent( true, "MySQL module missing." ) 
        elseif not hasObjectPermissionTo( resource, "function.mysql_connect" ) then 
            if hasObjectPermissionTo( resource, "function.shutdown" ) then 
                shutdown( "Insufficient ACL rights for mysql resource." ) 
            end 
            cancelEvent( true, "Insufficient ACL rights for mysql resource." ) 
        elseif not connect( ) then 
            if connection then 
                outputDebugString( mysql_error( connection ), 1 ) 
            end 
            
            if hasObjectPermissionTo( resource, "function.shutdown" ) then 
                shutdown( "MySQL failed to connect." ) 
            end 
            cancelEvent( true, "MySQL failed to connect." ) 
        else 
            null = mysql_null( ) 
        end 
    end 
) 
  
addEventHandler( "onResourceStop", resourceRoot, 
    function( ) 
        for key, value in pairs( results ) do 
            mysql_free_result( value.r ) 
            outputDebugString( "Query not free()'d: " .. value.q, 2 ) 
        end 
        
        disconnect( ) 
    end 
) 
  
-- 
  
function escape_string( str ) 
    if type( str ) == "string" then 
        return mysql_escape_string( connection, str ) 
    elseif type( str ) == "number" then 
        return tostring( str ) 
    end 
end 
  
local function query( str, ... ) 
    checkConnection( ) 
    
    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 = mysql_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 
        mysql_free_result( result ) 
        return false, "Unable to allocate result in pool" 
    end 
    return false, mysql_error( connection ) 
end 
  
function query_free( str, ... ) 
    if sourceResource == getResourceFromName( "runcode" ) then 
        return false 
    end 
    
    checkConnection( ) 
    
    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 = mysql_query( connection, str ) 
    if result then 
        mysql_free_result( result ) 
        return true 
    end 
    return false, mysql_error( connection ) 
end 
  
function free_result( result ) 
    if results[ result ] then 
        mysql_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 = mysql_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 = mysql_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 = mysql_affected_rows( connection ) 
        free_result( result ) 
        return rows 
    end 
    return false, error 
end 

Link to comment
You've got missing "--[[" at line @ 1.
--[[ 
Copyright (c) 2010 MTA: Paradise 
  
  
  
This program is free software; you can redistribute it and/or modify 
it under the terms of the GNU General Public License as published by 
the Free Software Foundation; either version 3 of the License, or 
(at your option) any later version. 
  
This program is distributed in the hope that it will be useful, 
but WITHOUT ANY WARRANTY; without even the implied warranty of 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
GNU General Public License for more details. 
  
You should have received a copy of the GNU General Public License 
along with this program. If not, see . 
]] 
  
local connection = nil 
local connection = nil 
local null = nil 
local results = { } 
local max_results = 128 
  
-- connection functions 
local function connect( ) 
    -- retrieve the settings 
    local server = get( "server" ) or "localhost" 
local user = get( "user" ) or "root" 
local password = get( "password" ) or "" 
local db = get( "database" ) or "mta" 
local port = get( "port" ) or 3306 
local socket = get( "socket" ) or nil 
    
    -- connect 
    connection = mysql_connect ( server, user, password, db, port, socket ) 
    if connection then 
        if user == "root" then 
            setTimer( outputDebugString, 100, 1, "Connecting to your MySQL as 'root' is strongly discouraged.", 2 ) 
        end 
        return true 
    else 
        outputDebugString ( "Connection to MySQL Failed.", 1 ) 
        return false 
    end 
end 
  
local function disconnect( ) 
    if connection and mysql_ping( connection ) then 
        mysql_close( connection ) 
    end 
end 
  
local function checkConnection( ) 
    if not connection or not mysql_ping( connection ) then 
        return connect( ) 
    end 
    return true 
end 
  
addEventHandler( "onResourceStart", resourceRoot, 
    function( ) 
        if not mysql_connect then 
            if hasObjectPermissionTo( resource, "function.shutdown" ) then 
                shutdown( "MySQL module missing." ) 
            end 
            cancelEvent( true, "MySQL module missing." ) 
        elseif not hasObjectPermissionTo( resource, "function.mysql_connect" ) then 
            if hasObjectPermissionTo( resource, "function.shutdown" ) then 
                shutdown( "Insufficient ACL rights for mysql resource." ) 
            end 
            cancelEvent( true, "Insufficient ACL rights for mysql resource." ) 
        elseif not connect( ) then 
            if connection then 
                outputDebugString( mysql_error( connection ), 1 ) 
            end 
            
            if hasObjectPermissionTo( resource, "function.shutdown" ) then 
                shutdown( "MySQL failed to connect." ) 
            end 
            cancelEvent( true, "MySQL failed to connect." ) 
        else 
            null = mysql_null( ) 
        end 
    end 
) 
  
addEventHandler( "onResourceStop", resourceRoot, 
    function( ) 
        for key, value in pairs( results ) do 
            mysql_free_result( value.r ) 
            outputDebugString( "Query not free()'d: " .. value.q, 2 ) 
        end 
        
        disconnect( ) 
    end 
) 
  
-- 
  
function escape_string( str ) 
    if type( str ) == "string" then 
        return mysql_escape_string( connection, str ) 
    elseif type( str ) == "number" then 
        return tostring( str ) 
    end 
end 
  
local function query( str, ... ) 
    checkConnection( ) 
    
    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 = mysql_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 
        mysql_free_result( result ) 
        return false, "Unable to allocate result in pool" 
    end 
    return false, mysql_error( connection ) 
end 
  
function query_free( str, ... ) 
    if sourceResource == getResourceFromName( "runcode" ) then 
        return false 
    end 
    
    checkConnection( ) 
    
    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 = mysql_query( connection, str ) 
    if result then 
        mysql_free_result( result ) 
        return true 
    end 
    return false, mysql_error( connection ) 
end 
  
function free_result( result ) 
    if results[ result ] then 
        mysql_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 = mysql_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 = mysql_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 = mysql_affected_rows( connection ) 
        free_result( result ) 
        return rows 
    end 
    return false, error 
end 

now this comes up!

=========================================================== 
= Multi Theft Auto: San Andreas v1.3
===========================================================
= Server name      : paradise ~ Roleplay
= Server IP address:
= Server port      : 22003
=
= Log file         : .. 1.3/Server/mods/deathmatch/logs/server.log
= Maximum players  : 32
= HTTP port        : 22005
= Voice Chat       : Disabled
===========================================================
[2012-04-28 12:02:48] Resources: 212 loaded, 0 failed
[2012-04-28 12:02:48] Querying game-monitor.com master server... unavailable!
[2012-04-28 12:02:49] Querying backup master server... success!
[2012-04-28 12:02:49] MODULE: Loaded "MySQL 5.0 database module" (0.50) by "Alberto Alonso <[email protected]>"
[2012-04-28 12:02:49] MODULE: Loaded "SHA Module" (1.02) by "mabako"
[2012-04-28 12:02:49] MODULE: Loaded "MySQL 5.0 database module" (0.50) by "Alberto Alonso <[email protected]>"
[2012-04-28 12:02:49] Starting resources.....
[2012-04-28 12:02:51] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:02:51] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:02:51] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:02:51] Start up of resource sql cancelled by script
[2012-04-28 12:02:51] ERROR: Unable to start resource sql; Start up of resource cancelled by script
 
[2012-04-28 12:02:51] Start up of resource irc cancelled by script
[2012-04-28 12:02:51] ERROR: Unable to start resource irc; Start up of resource cancelled by script
 
[2012-04-28 12:02:51] WARNING: players/main.lua(Line 379) [server] setPedFrozen is deprecated and may not work in future versions. Please replace with setElementFrozen.
[2012-04-28 12:02:51] Some files in 'players' use deprecated functions.
[2012-04-28 12:02:51] Use the 'upgrade' command to perform a basic upgrade of resources.
[2012-04-28 12:02:52] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:02:52] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:02:52] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:02:52] Start up of resource sql cancelled by script
[2012-04-28 12:02:52] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:02:52] Start up of resource players cancelled by script
[2012-04-28 12:02:52] ERROR: Unable to start resource players; Start up of resource cancelled by script
 
[2012-04-28 12:02:53] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:02:53] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:02:53] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:02:53] Start up of resource sql cancelled by script
[2012-04-28 12:02:53] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:02:53] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:02:53] Start up of resource vehicles cancelled by script
[2012-04-28 12:02:53] ERROR: Unable to start resource vehicles; Start up of resource cancelled by script
 
[2012-04-28 12:02:55] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:02:55] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:02:55] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:02:55] Start up of resource sql cancelled by script
[2012-04-28 12:02:56] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:02:56] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:02:56] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:02:56] Start up of resource sql cancelled by script
[2012-04-28 12:02:56] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:02:56] Start up of resource players cancelled by script
[2012-04-28 12:02:57] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:02:57] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:02:57] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:02:57] Start up of resource sql cancelled by script
[2012-04-28 12:02:57] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:02:57] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:02:57] Start up of resource items cancelled by script
[2012-04-28 12:02:57] ERROR: Unable to start resource items; Start up of resource cancelled by script
 
[2012-04-28 12:02:59] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:02:59] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:02:59] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:02:59] Start up of resource sql cancelled by script
[2012-04-28 12:02:59] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:02:59] Start up of resource players cancelled by script
[2012-04-28 12:03:00] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:00] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:00] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:00] Start up of resource sql cancelled by script
[2012-04-28 12:03:00] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:00] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:00] Start up of resource vehicles cancelled by script
[2012-04-28 12:03:01] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:01] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:01] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:01] Start up of resource sql cancelled by script
[2012-04-28 12:03:03] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:03] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:03] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:03] Start up of resource sql cancelled by script
[2012-04-28 12:03:03] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:03] Start up of resource players cancelled by script
[2012-04-28 12:03:04] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:04] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:04] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:04] Start up of resource sql cancelled by script
[2012-04-28 12:03:04] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:04] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:04] Start up of resource items cancelled by script
[2012-04-28 12:03:05] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:05] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:05] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:05] Start up of resource sql cancelled by script
[2012-04-28 12:03:05] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:05] Start up of resource players cancelled by script
[2012-04-28 12:03:08] WARNING: shops/shop.lua(Line 57) [server] setPedFrozen is deprecated and may not work in future versions. Please replace with setElementFrozen.
[2012-04-28 12:03:08] Some files in 'shops' use deprecated functions.
[2012-04-28 12:03:08] Use the 'upgrade' command to perform a basic upgrade of resources.
[2012-04-28 12:03:09] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:09] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:09] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:09] Start up of resource sql cancelled by script
[2012-04-28 12:03:10] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:10] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:10] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:10] Start up of resource sql cancelled by script
[2012-04-28 12:03:12] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:12] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:12] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:12] Start up of resource sql cancelled by script
[2012-04-28 12:03:12] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:12] Start up of resource players cancelled by script
[2012-04-28 12:03:13] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:13] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:13] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:13] Start up of resource sql cancelled by script
[2012-04-28 12:03:13] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:13] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:13] Start up of resource items cancelled by script
[2012-04-28 12:03:14] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:14] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:14] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:14] Start up of resource sql cancelled by script
[2012-04-28 12:03:15] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:15] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:15] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:15] Start up of resource sql cancelled by script
[2012-04-28 12:03:15] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:15] Start up of resource players cancelled by script
[2012-04-28 12:03:16] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:16] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:16] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:16] Start up of resource sql cancelled by script
[2012-04-28 12:03:16] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:16] Start up of resource shops cancelled by script
[2012-04-28 12:03:17] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:17] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:17] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:17] Start up of resource sql cancelled by script
[2012-04-28 12:03:19] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:19] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:19] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:19] Start up of resource sql cancelled by script
[2012-04-28 12:03:19] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:19] Start up of resource players cancelled by script
[2012-04-28 12:03:20] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:20] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:20] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:20] Start up of resource sql cancelled by script
[2012-04-28 12:03:20] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:20] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:20] Start up of resource items cancelled by script
[2012-04-28 12:03:21] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:21] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:21] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:21] Start up of resource sql cancelled by script
[2012-04-28 12:03:21] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:21] Start up of resource players cancelled by script
[2012-04-28 12:03:21] ERROR: Unable to start resource shops; Start up of resource cancelled by script
 
[2012-04-28 12:03:23] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:23] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:23] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:23] Start up of resource sql cancelled by script
[2012-04-28 12:03:23] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:23] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:23] Start up of resource vehicles cancelled by script
[2012-04-28 12:03:24] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:24] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:24] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:24] Start up of resource sql cancelled by script
[2012-04-28 12:03:25] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:25] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:25] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:25] Start up of resource sql cancelled by script
[2012-04-28 12:03:26] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:26] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:26] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:26] Start up of resource sql cancelled by script
[2012-04-28 12:03:26] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:26] Start up of resource players cancelled by script
[2012-04-28 12:03:28] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:28] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:28] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:28] Start up of resource sql cancelled by script
[2012-04-28 12:03:28] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:28] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:28] Start up of resource items cancelled by script
[2012-04-28 12:03:29] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:29] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:29] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:29] Start up of resource sql cancelled by script
[2012-04-28 12:03:30] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:30] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:30] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:30] Start up of resource sql cancelled by script
[2012-04-28 12:03:30] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:30] Start up of resource players cancelled by script
[2012-04-28 12:03:31] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:31] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:31] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:31] Start up of resource sql cancelled by script
[2012-04-28 12:03:31] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:31] Start up of resource shops cancelled by script
[2012-04-28 12:03:32] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:32] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:32] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:32] Start up of resource sql cancelled by script
[2012-04-28 12:03:33] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:33] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:33] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:33] Start up of resource sql cancelled by script
[2012-04-28 12:03:34] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:34] Start up of resource players cancelled by script
[2012-04-28 12:03:35] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:35] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:35] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:35] Start up of resource sql cancelled by script
[2012-04-28 12:03:35] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:35] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:35] Start up of resource items cancelled by script
[2012-04-28 12:03:36] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:36] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:36] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:36] Start up of resource sql cancelled by script
[2012-04-28 12:03:36] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:36] Start up of resource players cancelled by script
[2012-04-28 12:03:37] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:37] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:37] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:37] Start up of resource sql cancelled by script
[2012-04-28 12:03:37] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:37] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:37] Start up of resource vehicles cancelled by script
[2012-04-28 12:03:38] ERROR: Unable to connect to mysql: (2003) Can't connect to MySQL server on 'localhost' (10061)
[2012-04-28 12:03:38] ERROR: sql\mysql.lua:44: Connection to MySQL Failed.
[2012-04-28 12:03:38] Server shutdown as requested by resource sql (MySQL failed to connect.)
[2012-04-28 12:03:38] Start up of resource sql cancelled by script
[2012-04-28 12:03:38] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:38] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:38] Start up of resource vehicles cancelled by script
[2012-04-28 12:03:38] ERROR: exports: Call to non-running server resource (sql) [string "?"]
[2012-04-28 12:03:38] Start up of resource maps cancelled by script
[2012-04-28 12:03:38] ERROR: Unable to start resource maps; Start up of resource cancelled by script
Link to comment
local server = get( "server" ) or "localhost" 
local user = get( "user" ) or "root" 
local password = get( "password" ) or "" 
local db = get( "database" ) or "mta" 
local port = get( "port" ) or 3306 
local socket = get( "socket" ) or nil 

These are your MySQL details the server is trying to connect to, compare them with yours.

Link to comment
local server = get( "server" ) or "localhost" 
local user = get( "user" ) or "root" 
local password = get( "password" ) or "" 
local db = get( "database" ) or "mta" 
local port = get( "port" ) or 3306 
local socket = get( "socket" ) or nil 

These are your MySQL details the server is trying to connect to, compare them with yours.

this is my thing , i havent port forwarded yet . Could that be a problem? cause i only want it to be lan so i can edit stuff and that .

--[[ 
Copyright (c) 2010 MTA: Paradise 
  
  
  
This program is free software; you can redistribute it and/or modify 
it under the terms of the GNU General Public License as published by 
the Free Software Foundation; either version 3 of the License, or 
(at your option) any later version. 
  
This program is distributed in the hope that it will be useful, 
but WITHOUT ANY WARRANTY; without even the implied warranty of 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
GNU General Public License for more details. 
  
You should have received a copy of the GNU General Public License 
along with this program. If not, see <http://www.gnu.org/licenses/>. 
]] 
  
local connection = nil 
local connection = nil 
local null = nil 
local results = { } 
local max_results = 128 
  
-- connection functions 
local function connect( ) 
    -- retrieve the settings 
   local server = get( "server" ) or "localhost" 
local user = get( "user" ) or "root" 
local password = get( "password" ) or "" 
local db = get( "database" ) or "mta" 
local port = get( "port" ) or 3306 
local socket = get( "socket" ) or nil 
    
    -- connect 
    connection = mysql_connect ( server, user, password, db, port, socket ) 
    if connection then 
        if user == "root" then 
            setTimer( outputDebugString, 100, 1, "Connecting to your MySQL as 'root' is strongly discouraged.", 2 ) 
        end 
        return true 
    else 
        outputDebugString ( "Connection to MySQL Failed.", 1 ) 
        return false 
    end 
end 
  
local function disconnect( ) 
    if connection and mysql_ping( connection ) then 
        mysql_close( connection ) 
    end 
end 
  
local function checkConnection( ) 
    if not connection or not mysql_ping( connection ) then 
        return connect( ) 
    end 
    return true 
end 
  
addEventHandler( "onResourceStart", resourceRoot, 
    function( ) 
        if not mysql_connect then 
            if hasObjectPermissionTo( resource, "function.shutdown" ) then 
                shutdown( "MySQL module missing." ) 
            end 
            cancelEvent( true, "MySQL module missing." ) 
        elseif not hasObjectPermissionTo( resource, "function.mysql_connect" ) then 
            if hasObjectPermissionTo( resource, "function.shutdown" ) then 
                shutdown( "Insufficient ACL rights for mysql resource." ) 
            end 
            cancelEvent( true, "Insufficient ACL rights for mysql resource." ) 
        elseif not connect( ) then 
            if connection then 
                outputDebugString( mysql_error( connection ), 1 ) 
            end 
            
            if hasObjectPermissionTo( resource, "function.shutdown" ) then 
                shutdown( "MySQL failed to connect." ) 
            end 
            cancelEvent( true, "MySQL failed to connect." ) 
        else 
            null = mysql_null( ) 
        end 
    end 
) 
  
addEventHandler( "onResourceStop", resourceRoot, 
    function( ) 
        for key, value in pairs( results ) do 
            mysql_free_result( value.r ) 
            outputDebugString( "Query not free()'d: " .. value.q, 2 ) 
        end 
        
        disconnect( ) 
    end 
) 
  
-- 
  
function escape_string( str ) 
    if type( str ) == "string" then 
        return mysql_escape_string( connection, str ) 
    elseif type( str ) == "number" then 
        return tostring( str ) 
    end 
end 
  
local function query( str, ... ) 
    checkConnection( ) 
    
    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 = mysql_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 
        mysql_free_result( result ) 
        return false, "Unable to allocate result in pool" 
    end 
    return false, mysql_error( connection ) 
end 
  
function query_free( str, ... ) 
    if sourceResource == getResourceFromName( "runcode" ) then 
        return false 
    end 
    
    checkConnection( ) 
    
    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 = mysql_query( connection, str ) 
    if result then 
        mysql_free_result( result ) 
        return true 
    end 
    return false, mysql_error( connection ) 
end 
  
function free_result( result ) 
    if results[ result ] then 
        mysql_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 = mysql_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 = mysql_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 = mysql_affected_rows( connection ) 
        free_result( result ) 
        return rows 
    end 
    return false, error 
end 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...