Norhy Posted January 4, 2013 Share Posted January 4, 2013 Hey guys, i have this code: function saveWins ( ) local account = getPlayerAccount ( source ) if ( account ) and not isGuestAccount ( account ) then local wins = getElementData ( source, "wins" ) or 0 setAccountData ( account, "flatout.wins", wins ) end end addEventHandler ( "onPlayerQuit", getRootElement ( ), saveWins ) function loadWins ( _, account ) if ( account ) then local wins = getAccountData ( account, "flatout.wins" ) if ( wins ) then setAccountData ( account, wins ) end end end addEventHandler ( "onPlayerLogin", getRootElement ( ), loadWins ) I don't get any error. When i finish a map, i get +1 win, and when i type /wins it shows i have that amount of wins, but when i disconnect and login i have 0 wins, so it will reset everytime. How to fix that? I was using the wiki, and i don't have any errors/warnings. Link to comment
TAPL Posted January 4, 2013 Share Posted January 4, 2013 addEventHandler("onPlayerQuit", root, function() local account = getPlayerAccount(source) if (account) and not isGuestAccount(account) then local wins = getElementData(source, "wins" ) or 0 setAccountData(account, "flatout.wins", wins) end end) addEventHandler("onPlayerLogin", root, function(_, account) local wins = getAccountData(account, "flatout.wins") or 0 if (wins) then setElementData(source, "wins", wins) end end) Link to comment
TAPL Posted January 4, 2013 Share Posted January 4, 2013 Did you put it server side in meta? Are you sure that your data name is "wins"? Link to comment
Norhy Posted January 4, 2013 Author Share Posted January 4, 2013 Okay, i've got a problem. I was normally playing a map with checkpoints, i've got 1 win and 100 points when i finished. We wanted to test a DD map with my friends, so no chceckpoints. Once i destroyed all and was first, i didn't got any points and a win. How to make it possible so i will get points and a win at DD too? Not only at checkpoint races.. 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