jingzhi Posted March 27, 2015 Share Posted March 27, 2015 Hey guys i am trying triggerclient to dxdraw a text here is the script server addEvent("register",true) addEvent("login",true) function register(username,password,player) local newaccount = addAccount(username,password) local username = username local password = password if newaccount ~= false then logIn(player,newaccount,password) setElementData(player,"username",username) setElementData(player,"password",password) triggerClientEvent(player,"successfulregistered",resourceRoot) else triggerClientEvent(player,"accountalreadyexist",resourceRoot) end end addEventHandler("register",root,register) client dxDrawText(""..getElementData(localPlayer,"username").."", 1008, 105, 1232, 142, tocolor(255, 255, 255, 255), 0.70, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText(""..getElementData(localPlayer,"password").."", 1008, 152, 1232, 189, tocolor(255, 255, 255, 255), 0.70, "bankgothic", "left", "top", false, false, false, false, false) end and the error : line 1 of client script : "attempt to concatenate a boolean value" Please help guys! Thank you very much Link to comment
Addlibs Posted March 27, 2015 Share Posted March 27, 2015 1) getElementData(localPlayer, "username") returns a boolean value (most probably 'false'). 'false [bool]' cannot be concatenated (joined up) with a string, unless you tostring() it, e.g. ""..tostring(getElementData(localPlayer, "username")).."" 2) It seems redundant (and probably inefficient) to concatenate a value to 2 empty strings... You could just go ahead and type getElementData(localPlayer,"username") instead of ""..getElementData(localPlayer,"username").."" I'm assuming you've shared a section of the code (some lines seem to be pleonastic, or do not have a starting point — e.g. you have an 'end' which doesn't start anywhere) as it doesn't seem one bit complete. Link to comment
jingzhi Posted March 28, 2015 Author Share Posted March 28, 2015 1) getElementData(localPlayer, "username") returns a boolean value (most probably 'false'). 'false [bool]' cannot be concatenated (joined up) with a string, unless you tostring() it, e.g. ""..tostring(getElementData(localPlayer, "username")).."" 2) It seems redundant (and probably inefficient) to concatenate a value to 2 empty strings... You could just go ahead and type getElementData(localPlayer,"username") instead of ""..getElementData(localPlayer,"username").."" I'm assuming you've shared a section of the code (some lines seem to be pleonastic, or do not have a starting point — e.g. you have an 'end' which doesn't start anywhere) as it doesn't seem one bit complete. Hey yes i am wondering why it will return a boolean , and this is not the full script Link to comment
Ryancit2 Posted March 28, 2015 Share Posted March 28, 2015 Why don't you try fetching account name from serverside? like in server part add this: local acc = getAccountName(getPlayerAccount(source)) I prefer this one because its the better way instead of using element data. Link to comment
jingzhi Posted March 28, 2015 Author Share Posted March 28, 2015 Why don't you try fetching account name from serverside? like in server part add this: local acc = getAccountName(getPlayerAccount(source)) I prefer this one because its the better way instead of using element data. Before I put them as elementdata, i tryed to pass them down by putting them in the arguments of triggerclientevent, but it says that its nil, i will try this out, i will tell you if it works Link to comment
jingzhi Posted March 28, 2015 Author Share Posted March 28, 2015 Why don't you try fetching account name from serverside? like in server part add this: local acc = getAccountName(getPlayerAccount(source)) I prefer this one because its the better way instead of using element data. Hey ryan but how about the password? I also want to show the player the password for his acc Link to comment
Ryancit2 Posted March 28, 2015 Share Posted March 28, 2015 In that case, you'll have to learn database a bit, then loop through mta's default database and that too, contains protected forms of passwords, i guess that protection is called md5 or something: Link to comment
Addlibs Posted March 28, 2015 Share Posted March 28, 2015 You can't really un-hash MD5. Link to comment
TAPL Posted March 28, 2015 Share Posted March 28, 2015 It's not MD5 and you can't even access internal.db with normal way. Link to comment
jingzhi Posted March 28, 2015 Author Share Posted March 28, 2015 In that case, you'll have to learn database a bit, then loop through mta's default database and that too, contains protected forms of passwords, i guess that protection is called md5 or something: I see, ty Ryan, do you recommend SQLlite? Link to comment
xXMADEXx Posted March 28, 2015 Share Posted March 28, 2015 In that case, you'll have to learn database a bit, then loop through mta's default database and that too, contains protected forms of passwords, i guess that protection is called md5 or something: I see, ty Ryan, do you recommend SQLlite? SQLite or MySQL will work the same. SQLite is better if you don't want to install other software (XAMPP/WAMP/etc..), however you would have to download the file if you want to view it. MySQL is better if you want to be able to access your database through a website, but it requires a little more setup, and it may not be as fast as SQLite. Link to comment
Ryancit2 Posted March 29, 2015 Share Posted March 29, 2015 Check out my post regarding SQLite vs MySQL: https://forum.multitheftauto.com/viewtopic.php?f ... 42#p772442 Also, @xXMADEXx if i'm not wrong, a MySQL connection can also be obtained online (apart from offline XAMPP, etc) by having a free domain from any free webhost right? Like hostinger or 00webhost. Link to comment
jingzhi Posted March 29, 2015 Author Share Posted March 29, 2015 Check out my post regarding SQLite vs MySQL: https://forum.multitheftauto.com/viewtopic.php?f ... 42#p772442Also, @xXMADEXx if i'm not wrong, a MySQL connection can also be obtained online (apart from offline XAMPP, etc) by having a free domain from any free webhost right? Like hostinger or 00webhost. Thank you very much, ryan, I have a little extra problem, of your Live Weather script, how do you fetch the weathr info from a website? Thanks Link to comment
jingzhi Posted March 29, 2015 Author Share Posted March 29, 2015 In that case, you'll have to learn database a bit, then loop through mta's default database and that too, contains protected forms of passwords, i guess that protection is called md5 or something: I see, ty Ryan, do you recommend SQLlite? SQLite or MySQL will work the same. SQLite is better if you don't want to install other software (XAMPP/WAMP/etc..), however you would have to download the file if you want to view it. MySQL is better if you want to be able to access your database through a website, but it requires a little more setup, and it may not be as fast as SQLite. I see, thank you very much, is there a tutorial of setting up MySQL in the forum? Link to comment
Ryancit2 Posted March 29, 2015 Share Posted March 29, 2015 Check out the wiki topics: https://wiki.multitheftauto.com/wiki/Se ... _functions https://wiki.multitheftauto.com/wiki/Modules/MTA-MySQL Link to comment
WhoAmI Posted March 29, 2015 Share Posted March 29, 2015 I prefer NOT to use MySQL module. They are not that good anymore. Use db functions instead. Link to comment
jingzhi Posted March 29, 2015 Author Share Posted March 29, 2015 Check out the wiki topics:https://wiki.multitheftauto.com/wiki/Se ... _functions https://wiki.multitheftauto.com/wiki/Modules/MTA-MySQL Ty, can you also tell me how does your Live Weather script fetch info from internet? Link to comment
Ryancit2 Posted March 30, 2015 Share Posted March 30, 2015 You can see that within resource archive, its not compiled + it contains PHP source file aswell, that will teach you what you exactly wanna know Link to comment
jingzhi Posted March 30, 2015 Author Share Posted March 30, 2015 You can see that within resource archive, its not compiled + it contains PHP source file aswell, that will teach you what you exactly wanna know Thank you very very much Link to comment
Ryancit2 Posted March 30, 2015 Share Posted March 30, 2015 You can see that within resource archive, its not compiled + it contains PHP source file aswell, that will teach you what you exactly wanna know Thank you very very much You are welcomed. 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