Jump to content

Serious Problem


MetaGamer

Recommended Posts

I am getting this error

  
attempt to call global 'mysql_connect' (a nil value) 
  

client.lua

  
function GameModeInit() 
    con = mysql_connect("204.45.248.18", "", "", "") 
    if(con) then 
        outputChatBox("Connection Success!") 
    else 
        outputChatBox("Connection Failed!") 
    end 
end 
addEventHandler("onClientResourceStart", getRootElement(), GameModeInit) 
  

mtaserver.config

  
<!-- Specifies the module(s) which are loaded with the server. To load several modules, add more <module> 
         parameter(s). Optional parameter. --> 
        <module src="mta_mysql.dll" /> 
  

I have put mta_mysql.dll into the modules folder

I have put libmysql.dll in the server folder

I also get

  
MODULE: Loaded "MySQL 5.0 database module" (0.50) by "Alberto Alonso <[email protected]>" 
  

Might might be the problem?

Link to comment

It was trying to find if(con) function, you had forgotten one space between them.

Also I fixed the getRootElement() thing, because otherwise it would of done this script everytime when you start any resource. This new one will do it only if it's this specific resource.

  
function GameModeInit() 
    local con = mysql_connect("204.45.248.18", "", "", "") 
    if (con) then 
        outputChatBox("Connection Success!") 
    else 
        outputChatBox("Connection Failed!") 
    end 
end 
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), GameModeInit) 

Edited by Guest
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...