Jump to content

setPlayerName problem


Recommended Posts

Hi! (Sorry for my bad english :( )

I got some problem whit the setPlayerName.

function onLogin ( player, user, pass ) 
    handler = mysql_connect( host, username, password, db ) 
    local login = mysql_query(handler,"SELECT * FROM account_data 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 
            local adat = mysql_fetch_assoc(login) 
            triggerClientEvent( player, "closeWindow", getRootElement() ) 
            outputChatBox("* Login succes! Welcome "..adat['AccountName'].."!", player, 255, 0, 0) 
            spawnPlayer( player, adat['x'], adat['y'], adat['z'], 0, JoinSkin )  
            fadeCamera( player, true ) 
            setCameraTarget( player, player ) 
            giveWeapon( player, joinWeapon, joinAmmo ) 
            setPlayerMoney( player, adat['penz'] ) 
            setPedArmor ( player, adat['armor'] ) 
            setElementHealth ( player, adat['hp'] ) 
            setPlayerName ( source , adat['IGName']) 
        else 
            outputChatBox("* Login failed!", player, 255, 0, 0) 
        end 
        mysql_free_result(login) 
    end 
end 

Everything working fine , i get the money,hp,armor... but my name still the original. No error message nothing. I trying to search for answers but i can't fix it. I'm very beginner somebody explain to me simple what's wrong :cry:

Thanks

Edited by Guest
Link to comment

oops Thats just a fail. I trying it whit player too but the same problem :(

Here the client side maybe it's help to find out what's the problem:

(user_edit_l = the player login name pw_edit_l = the password)

function login_player ( source ) 
        triggerServerEvent ( "onLogin", getRootElement(), getLocalPlayer(), guiGetText(user_edit_l), guiGetText(pw_edit_l) ) 
end 
addEventHandler("onClientGUIClick", login_btn_l, login_player,false) 

And the i forgot the adEvent

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