Ted Claberling Posted July 13, 2018 Share Posted July 13, 2018 Hi, I am using a login panel that player must give a username and password to it and Register then he/she can login.but my problem is his NickName in tab is what he set in MTA Settings i want it to be that name that he Registered with. ( my login panel use xml for save datas...) Link to comment
Galactix Posted July 13, 2018 Share Posted July 13, 2018 You need to modify the default scoreboard resource in order to replace the name shown by the actual name of the account used by the player. Link to comment
Ted Claberling Posted July 13, 2018 Author Share Posted July 13, 2018 20 minutes ago, Galactix said: You need to modify the default scoreboard resource in order to replace the name shown by the actual name of the account used by the player. can you explain more? i need to add some code lines or i need to change some configs? Link to comment
Galactix Posted July 13, 2018 Share Posted July 13, 2018 (edited) function setNickToAccount() local account = getPlayerAccount(source) local accountName = getAccountName(account) setPlayerName(source, accountName) end addEventHandler("onPlayerLogin", setNickToAccount) Put this in any script and you should have the result expected. Edited July 13, 2018 by Galactix 1 Link to comment
Ted Claberling Posted July 13, 2018 Author Share Posted July 13, 2018 (edited) 44 minutes ago, Galactix said: function setNickToAccount local account= getPlayerAccount(source) local accountName = getAccountName(account) setPlayerName(source, accountName) end addEventHandler("onPlayerLogin", getRootElement(), setNickToAccount) Put this in any script and you should have the result expected. expected near local error function setNickToAccount local account = getPlayerAccount(source) local accountName = getAccountName(account) setPlayerName(source, accountName) end addEventHandler("onPlayerLogin", getRootElement(), setNickToAccount) addEventHandler("onPlayerChangeNick", getRootElement(), function() cancelEvent(); end ); also it is whole the code Edited July 13, 2018 by Ted Claberling Link to comment
Galactix Posted July 13, 2018 Share Posted July 13, 2018 function setNickToAccount() local account = getPlayerAccount(source) local accountName = getAccountName(account) setPlayerName(source, accountName) end addEventHandler("onPlayerLogin", setNickToAccount) Link to comment
Ted Claberling Posted July 13, 2018 Author Share Posted July 13, 2018 (edited) 14 minutes ago, Galactix said: function setNickToAccount() local account = getPlayerAccount(source) local accountName = getAccountName(account) setPlayerName(source, accountName) end addEventHandler("onPlayerLogin", setNickToAccount) Bad Arugment Error Edited July 13, 2018 by Ted Claberling Link to comment
kieran Posted July 13, 2018 Share Posted July 13, 2018 You are adding event handler wrong, change the last line to addEventHandler("onPlayerLogin", root, setNickToAccount), please look at addEventHandler page on wiki, it explains why you use an element at argument 2. 1 Link to comment
Ted Claberling Posted July 13, 2018 Author Share Posted July 13, 2018 2 minutes ago, kieran said: You are adding event handler wrong, change the last line to addEventHandler("onPlayerLogin", root, setNickToAccount), please look at addEventHandler page on wiki, it explains why you use an element at argument 2. tnx it fixed <3 Link to comment
kieran Posted July 13, 2018 Share Posted July 13, 2018 You seem like a new scripter, so one more thing... Check IIYAMA's topic where he explains the element tree, it is very useful. 1 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