dugasz1 Posted May 8, 2013 Share Posted May 8, 2013 (edited) 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 Thanks Edited May 8, 2013 by Guest Link to comment
Castillo Posted May 8, 2013 Share Posted May 8, 2013 setPlayerName ( source , adat['IGName']) You are using 'source' there, but on your other functions you use 'player'. Link to comment
dugasz1 Posted May 8, 2013 Author Share Posted May 8, 2013 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
iPrestege Posted May 8, 2013 Share Posted May 8, 2013 triggerServerEvent ( "onLogin", getRootElement(), getLocalPlayer(), guiGetText(user_edit_l), guiGetText(pw_edit_l) ) Should Be : triggerServerEvent ( "onLogin", getLocalPlayer(), guiGetText(user_edit_l), guiGetText(pw_edit_l) ) Link to comment
dugasz1 Posted May 8, 2013 Author Share Posted May 8, 2013 Now i got an error message: WARNING: sawmode\sawmode.lua:48 Bad argument @ 'md5' ERORR: sawmode\sawmode.lua:48 Bad argument #2 to 'mysql_escape_string' <string expected got boolean> Link to comment
dugasz1 Posted May 8, 2013 Author Share Posted May 8, 2013 huu Sorry, i fixed the problem. I saw a server where we can use space to my character name but it don't support space in the setPlayerName Link to comment
Renkon Posted May 8, 2013 Share Posted May 8, 2013 huu Sorry, i fixed the problem. I saw a server where we can use space to my character name but it don't support space in the setPlayerName That're nametags. Link to comment
dugasz1 Posted May 9, 2013 Author Share Posted May 9, 2013 I know it isnt change the name in settings(it's good for me now) but i doesen't know how i can call it. Link to comment
Castillo Posted May 9, 2013 Share Posted May 9, 2013 You can change their nametag text with: setPlayerNametagText It won't change the display name on chat though. Link to comment
dugasz1 Posted May 12, 2013 Author Share Posted May 12, 2013 Now i know how make the server to use space in the names. Thanks for help 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