micheal1230 Posted January 11, 2012 Share Posted January 11, 2012 (edited) Well When I Try To Register To MY Server It Says In Console, server event trigger register but event not added. Can you tell me how to fix this. I Removed The SQL Server passwords and stuff like that SQL resource Meta: <meta> <info author="vG MTA Scripting Team" type="script" description="MySQL"/> <script src="s_mysql.lua" type="server"/> <export function="getMySQLUsername" type="server"/> <export function="getMySQLPassword" type="server"/> <export function="getMySQLDBName" type="server"/> <export function="getMySQLHost" type="server"/> <export function="getMySQLPort" type="server"/> <!-- above is legacy --> <script src="connection.lua" type="server" /> <export function="ping" type="server" http="false" /> <export function="escape_string" type="server" http="false" /> <export function="query" type="server" http="false" /> <export function="unbuffered_query" type="server" http="false" /> <export function="query_free" type="server" http="false" /> <export function="fetch_assoc" type="server" http="false" /> <export function="rows_assoc" type="server" http="false" /> <export function="free_result" type="server" http="false" /> <export function="result" type="server" http="false" /> <export function="num_rows" type="server" http="false" /> <export function="query_fetch_assoc"type="server" http="false" /> <export function="query_rows_assoc" type="server" http="false" /> <export function="insert_id" type="server" http="false" /> <export function="query_rows_assoc" type="server" http="false" /> <export function="query_insert_free"type="server" http="false" /> <export function="escape_string" type="server" http="false" /> <export function="debugMode" type="server" http="false" /> <export function="returnQueryStats" type="server" http="false" /> </meta> s_mysql.lua : -- connection settings local hostname = "localhost" local username = "server" local password = "Y2wLDarPPRUReaTQ" local database = "rpserver" local port = tonumber( get( "port" ) ) or 3306 -- global things. local MySQLConnection = nil local resultPool = { } local sqllog = false local countqueries = 0 -- connectToDatabase - Internal function, to spawn a DB connection function connectToDatabase(res) MySQLConnection = mysql_connect(hostname, username, password, database, port) if (not MySQLConnection) then if (res == getThisResource()) then cancelEvent(true, "Cannot connect to the database.") end return nil end return nil end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), connectToDatabase, false) -- destroyDatabaseConnection - Internal function, kill the connection if theres one. function destroyDatabaseConnection() if (not MySQLConnection) then return nil end mysql_close(MySQLConnection) return nil end addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), destroyDatabaseConnection, false) -- do something usefull here function logSQLError(str) local message = str or 'N/A' outputDebugString("MYSQL ERROR "..mysql_errno(MySQLConnection) .. ": " .. mysql_error(MySQLConnection)) exports['logs']:logMessage("MYSQL ERROR ! [QUERY] " .. message .. " [ERROR] " .. mysql_errno(MySQLConnection) .. ": " .. mysql_error(MySQLConnection), 24) end function getFreeResultPoolID() local size = #resultPool if (size == 0) then return 1 end for index, query in ipairs(resultPool) do if (query == nil) then return index end end return (size + 1) end ------------ EXPORTED FUNCTIONS --------------- function ping() if (mysql_ping(MySQLConnection) == false) then -- FUU, NO MOAR CONNECTION destroyDatabaseConnection() connectToDatabase(nil) if (mysql_ping(MySQLConnection) == false) then logSQLError() return false end return true end return true end function escape_string(str) if (ping()) then return mysql_escape_string(MySQLConnection, str) end return false end function query(str) if sqllog then exports['logs']:logMessage(str, 24) end countqueries = countqueries + 1 if (ping()) then local result = mysql_query(MySQLConnection, str) if (not result) then logSQLError(str) return false end local resultid = getFreeResultPoolID() resultPool[resultid] = result return resultid end return false end function unbuffered_query(str) if sqllog then exports['logs']:logMessage(str, 24) end countqueries = countqueries + 1 if (ping()) then local result = mysql_unbuffered_query(MySQLConnection, str) if (not result) then logSQLError(str) return false end local resultid = getFreeResultPoolID() resultPool[resultid] = result return resultid end return false end function query_free(str) local queryresult = query(str) if not (queryresult == false) then free_result(queryresult) return true end return false end function rows_assoc(resultid) if (not resultPool[resultid]) then return false end return mysql_rows_assoc(resultPool[resultid]) end function fetch_assoc(resultid) if (not resultPool[resultid]) then return false end return mysql_fetch_assoc(resultPool[resultid]) end function free_result(resultid) if (not resultPool[resultid]) then return false end mysql_free_result(resultPool[resultid]) table.remove(resultPool, resultid) return nil end -- incase a nub wants to use it, FINE function result(resultid, row_offset, field_offset) if (not resultPool[resultid]) then return false end return mysql_result(resultPool[resultid], row_offset, field_offset) end function num_rows(resultid) if (not resultPool[resultid]) then return false end return mysql_num_rows(resultPool[resultid]) end function insert_id() return mysql_insert_id(MySQLConnection) or false end function query_fetch_assoc(str) local queryresult = query(str) if not (queryresult == false) then local result = fetch_assoc(queryresult) free_result(queryresult) return result end return false end function query_rows_assoc(str) local queryresult = query(str) if not (queryresult == false) then local result = rows_assoc(queryresult) free_result(queryresult) return result end return false end function query_insert_free(str) local queryresult = query(str) if not (queryresult == false) then local result = insert_id() free_result(queryresult) return result end return false end function escape_string(str) return mysql_escape_string(MySQLConnection, str) end function debugMode() if (sqllog) then sqllog = false else sqllog = true end return sqllog end function returnQueryStats() return countqueries -- maybe later more end Edited January 11, 2012 by Guest Link to comment
Castillo Posted January 11, 2012 Share Posted January 11, 2012 You mean it says: "Client triggered server side event but event is not added server side.", something like that? Link to comment
ThaD4N13L Posted January 11, 2012 Share Posted January 11, 2012 Michael you need to download XAMMP from google look on google there should be a link then once installed type in your browser localhost it should show up this XAMMp click on phpmyadmin then make a database call it MTA:SA and in the s_mysql.lua change it to this -- connection settings local hostname = "localhost" local username = "root" local password = "" local database = "mta" local port = tonumber( get( "port" ) ) or 3306 and the connection.lua to some of these things above almost make a database called mta and import the file. Enjoy Link to comment
micheal1230 Posted January 11, 2012 Author Share Posted January 11, 2012 You mean it says: "Client triggered server side event but event is not added server side.", something like that? Yeah Thats What Comes Up, ill Come Back And Tell You If It Worked Edit: No Its Hasnt Worked Same Problem -- connection settings local hostname = "localhost" local username = "server" local password = "Y2wLDarPPRUReaTQ" local database = "rpserver" local port = tonumber( get( "port" ) ) or 3306 -- global things. local MySQLConnection = nil local resultPool = { } local sqllog = false local countqueries = 0 -- connectToDatabase - Internal function, to spawn a DB connection function connectToDatabase(res) MySQLConnection = mysql_connect(hostname, username, password, database, port) if (not MySQLConnection) then if (res == getThisResource()) then cancelEvent(true, "Cannot connect to the database.") end return nil end return nil end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), connectToDatabase, false) -- destroyDatabaseConnection - Internal function, kill the connection if theres one. function destroyDatabaseConnection() if (not MySQLConnection) then return nil end mysql_close(MySQLConnection) return nil end addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), destroyDatabaseConnection, false) -- do something usefull here function logSQLError(str) local message = str or 'N/A' outputDebugString("MYSQL ERROR "..mysql_errno(MySQLConnection) .. ": " .. mysql_error(MySQLConnection)) exports['logs']:logMessage("MYSQL ERROR ! [QUERY] " .. message .. " [ERROR] " .. mysql_errno(MySQLConnection) .. ": " .. mysql_error(MySQLConnection), 24) end function getFreeResultPoolID() local size = #resultPool if (size == 0) then return 1 end for index, query in ipairs(resultPool) do if (query == nil) then return index end end return (size + 1) end ------------ EXPORTED FUNCTIONS --------------- function ping() if (mysql_ping(MySQLConnection) == false) then -- FUU, NO MOAR CONNECTION destroyDatabaseConnection() connectToDatabase(nil) if (mysql_ping(MySQLConnection) == false) then logSQLError() return false end return true end return true end function escape_string(str) if (ping()) then return mysql_escape_string(MySQLConnection, str) end return false end function query(str) if sqllog then exports['logs']:logMessage(str, 24) end countqueries = countqueries + 1 if (ping()) then local result = mysql_query(MySQLConnection, str) if (not result) then logSQLError(str) return false end local resultid = getFreeResultPoolID() resultPool[resultid] = result return resultid end return false end function unbuffered_query(str) if sqllog then exports['logs']:logMessage(str, 24) end countqueries = countqueries + 1 if (ping()) then local result = mysql_unbuffered_query(MySQLConnection, str) if (not result) then logSQLError(str) return false end local resultid = getFreeResultPoolID() resultPool[resultid] = result return resultid end return false end function query_free(str) local queryresult = query(str) if not (queryresult == false) then free_result(queryresult) return true end return false end function rows_assoc(resultid) if (not resultPool[resultid]) then return false end return mysql_rows_assoc(resultPool[resultid]) end function fetch_assoc(resultid) if (not resultPool[resultid]) then return false end return mysql_fetch_assoc(resultPool[resultid]) end function free_result(resultid) if (not resultPool[resultid]) then return false end mysql_free_result(resultPool[resultid]) table.remove(resultPool, resultid) return nil end -- incase a nub wants to use it, FINE function result(resultid, row_offset, field_offset) if (not resultPool[resultid]) then return false end return mysql_result(resultPool[resultid], row_offset, field_offset) end function num_rows(resultid) if (not resultPool[resultid]) then return false end return mysql_num_rows(resultPool[resultid]) end function insert_id() return mysql_insert_id(MySQLConnection) or false end function query_fetch_assoc(str) local queryresult = query(str) if not (queryresult == false) then local result = fetch_assoc(queryresult) free_result(queryresult) return result end return false end function query_rows_assoc(str) local queryresult = query(str) if not (queryresult == false) then local result = rows_assoc(queryresult) free_result(queryresult) return result end return false end function query_insert_free(str) local queryresult = query(str) if not (queryresult == false) then local result = insert_id() free_result(queryresult) return result end return false end function escape_string(str) return mysql_escape_string(MySQLConnection, str) end function debugMode() if (sqllog) then sqllog = false else sqllog = true end return sqllog end function returnQueryStats() return countqueries -- maybe later more end Link to comment
Castillo Posted January 11, 2012 Share Posted January 11, 2012 That error means that one of your resources is trying to trigger a event to the server side, but the server side doesn't has it. Link to comment
micheal1230 Posted January 11, 2012 Author Share Posted January 11, 2012 That error means that one of your resources is trying to trigger a event to the server side, but the server side doesn't has it. So Basicly The Register System Doesnt Work? Or It Doesnt Have One? It Has A Acc. System Link to comment
Castillo Posted January 11, 2012 Share Posted January 11, 2012 Sounds like you got missing server side. Link to comment
micheal1230 Posted January 11, 2012 Author Share Posted January 11, 2012 Solid Can You Tell Me How To Fix This? Because One One By Del Is Not Working. My Skype Is micheal.jones74 Here iS Server Sides In Acc System local salt = "vgrpkeyscotland" mysql = exports.mysql -- //////////////////////////////////// -- // MYSQL // -- //////////////////////////////////// sqlUsername = exports.mysql:getMySQLUsername() sqlPassword = exports.mysql:getMySQLPassword() sqlDB = exports.mysql:getMySQLDBName() sqlHost = exports.mysql:getMySQLHost() sqlPort = exports.mysql:getMySQLPort() handler = mysql_connect(sqlHost, sqlUsername, sqlPassword, sqlDB, sqlPort) function checkMySQL() if not (mysql_ping(handler)) then handler = mysql_connect(sqlHost, sqlUsername, sqlPassword, sqlDB, sqlPort) end end setTimer(checkMySQL, 300000, 0) function closeMySQL() if (handler) then mysql_close(handler) handler = nil end end addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), closeMySQL) -- //////////////////////////////////// -- // MYSQL END // -- //////////////////////////////////// addEvent("attemptRegister", true) addEventHandler("attemptRegister", getRootElement(), function ( username, password ) if not (string.len(password) < 5) then local password = md5(salt .. password) local safeusername = mysql:escape_string(username) local safepassword = mysql:escape_string(password) local result = mysql:query_fetch_assoc("SELECT username FROM accounts WHERE username = '" .. safeusername .. "'") if not (result) then local newquery = mysql:query_free("INSERT INTO accounts SET username = '" .. safeusername .. "', password = '" .. safepassword .. "', registerdate=NOW() ") if (newquery) then local newAppState = mysql:query_free("UPDATE accounts SET appstate = '3' WHERE username = '" .. safeusername .. "'") triggerClientEvent(source, "informRegister1", source) else outputChatBox("Error - 007.", source, 255, 0, 0) end else triggerClientEvent(source, "informRegister2", source) end else triggerClientEvent(source, "informRegister3", source) end end ) Link to comment
AGENT_STEELMEAT Posted January 11, 2012 Share Posted January 11, 2012 Your using an outdated, stolen resource. Therefore, you deserve no help at all. -.- Link to comment
Castillo Posted January 11, 2012 Share Posted January 11, 2012 I'm not sure, but that is not complete. Maybe you got a fake vG copy? . Link to comment
micheal1230 Posted January 11, 2012 Author Share Posted January 11, 2012 Its Vedic I Brought It For 50USD But He No Provide Help Link to comment
AGENT_STEELMEAT Posted January 11, 2012 Share Posted January 11, 2012 50USD You bought a stolen script that was already leaked publicly. Congrats! Hey, maybe you'll get lucky and uncover some of the secret backdoors in the script before anyone else does! Link to comment
micheal1230 Posted January 11, 2012 Author Share Posted January 11, 2012 But there must still be a way to fix it and where can i find this "leaked" Script Link to comment
ThaD4N13L Posted January 12, 2012 Share Posted January 12, 2012 Lol it was Created by a few people mount did not join Development till the Project was after 1.0 by the 3.0.2 time When Daniels or Fenix left all the old devs left so Daniels left MTA and gave the script to Vedic and gave it out I think. Link to comment
Charlie_Jefferson Posted January 12, 2012 Share Posted January 12, 2012 Vedic's script is NOT stolen, it has been edited, in very many ways, such as account-system, items, even the authors are changed, I believe. (my statement fails... If you edit a script that isn't yours it's still stolen. God darn it.) Link to comment
micheal1230 Posted January 12, 2012 Author Share Posted January 12, 2012 Here I Think i Found The Problem Im Not Sure Though Link to comment
micheal1230 Posted January 12, 2012 Author Share Posted January 12, 2012 Hey I Think I Found The Problem Link to comment
Langford Posted January 13, 2012 Share Posted January 13, 2012 How can you please help me if your problem has fixed even im also facing the same problem 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