SoulEaterX Posted January 27, 2013 Share Posted January 27, 2013 I have DD server, and in scoreboard have score column. If player is the last survivor, he win 5 points. And its work, but when player leaves server and enters again, point disappear. Can someone help me to save this point in player account? Thanks Link to comment
SoulEaterX Posted January 28, 2013 Author Share Posted January 28, 2013 exports.scoreboard:scoreboardAddColumn( "score" ) function xcore () zcore = getElementData(source,"score") or 0 setElementData(source,"score",zcore+5) end addEvent("onPlayerWasted",true) addEventHandler("onPlayerWasted",getRootElement(),xcore) Link to comment
Vision Posted January 28, 2013 Share Posted January 28, 2013 exports.scoreboard:scoreboardAddColumn( "score" ) function xcore () zcore = getElementData ( source, "score" ) or 0 setElementData ( source, "score", zcore + 5 ) end addEvent("onPlayerWasted",true) addEventHandler("onPlayerWasted",getRootElement(),xcore) addEventHandler ( 'onPlayerQuit', root, function ( ) local account = getPlayerAccount ( source ) local getScore = getElementData ( source, 'score' ) or 0 if ( account ) and not ( isGuestAccount ( account ) ) then setAccountData ( account, 'scoreSave', getScore ) end end ) addEventHandler ( 'onPlayerLogin', root, function ( _, account ) if ( account ) then local scoreLoad = getAccountData ( account, 'scoreSave' ) if ( scoreLoad ) then setElementData ( source, 'score', scoreLoad ) end end end ) Link to comment
Blaawee Posted January 29, 2013 Share Posted January 29, 2013 why did you add a new event and that it's already exist ! 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