Jump to content

Please help


Recommended Posts

Hello i find my old scriprs and i cant use it anymore because outdated and i thinking to remake it but i stock on some parts please help , about how to replace to the new mysql part

i try it on some one but still not works ;(

-- Default 
host = "127.0.0.1" -- Database Host 
username = "root" -- Database Username 
password = "" -- Database Password 
db = "accounts" -- Database ( Where you got your tables ) 
  
handler = dbConnect("mysql", host, username, password, db ) 
  
if handler then 
    outputChatBox("sikeres csatlakozas") else 
    outputChatBox("nem sikerult csatlakozni a mysql hez!") 
end 
  
addEventHandler("onPlayerJoin", getRootElement(), 
    function() 
        triggerClientEvent(source, "onJoin", getRootElement()) 
    end 
) 
  
function onLogin ( player, user, pass ) 
    handler = dbConnect("mysql", host, username, password, db ) 
    local login = dbQuery(handler,"SELECT * FROM accounts WHERE AccountName = '"..mysql_escape_string( handler, user ).."' AND Password = '"..mysql_escape_string( handler, md5(pass) ).."';") 
    if login then 
        local rows = mysql_num_rows(login) 
        if rows == 1 then 
            triggerClientEvent( player, "closeWindow", getRootElement() ) 
            outputChatBox("* You successfully logged in your account!", player, 255, 255, 255) 
            spawnPlayer( player, 0,0,3 )  
            fadeCamera( player, true ) 
            setCameraTarget( player, player ) 
        else 
            outputChatBox("* Login failed!", player, 255, 255, 255) 
        end 
        mysql_free_result(login) 
    end 
end 
addEvent( "onLogin", true ) 
addEventHandler( "onLogin", getRootElement(), onLogin ) 
  

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...