maarten123 Posted September 11, 2010 Share Posted September 11, 2010 Hi, i have a question about calculate with accountdata. i wanna make a stats script for MTA Race, so this script must be add a point. but, that isn't work Can anyone help me out? Greetings Maarten123 Sorry for my bad english, I'm dutch Script: local playeraccount = getPlayerAccount ( source ) local playerpoints = getAccountData ( playeraccount, "DD.Points" ) +1 setAccountData ( playeraccount, "DD.points", playerpoints ) Link to comment
dzek (varez) Posted September 11, 2010 Share Posted September 11, 2010 when no points is set - default value will be "false" and you cant add 1 to "false". local playeraccount = getPlayerAccount (source) local playerpoints = getAccountData(playeraccount, "DD.Points") if (playerpoints==false or playerpoints==nil) then playerpoints=0 end setAccountData (playeraccount, "DD.points", playerpoints) you also should check if playeraccount is valid! Link to comment
maarten123 Posted September 11, 2010 Author Share Posted September 11, 2010 when no points is set - default value will be "false"and you cant add 1 to "false". local playeraccount = getPlayerAccount (source) local playerpoints = getAccountData(playeraccount, "DD.Points") if (playerpoints==false or playerpoints==nil) then playerpoints=0 end setAccountData (playeraccount, "DD.points", playerpoints) you also should check if playeraccount is valid! ok thanks but this is the issue local playerpoints = getAccountData(playeraccount, "DD.Points") +1 i gonna add one point one if you win a DD or DM Link to comment
dzek (varez) Posted September 11, 2010 Share Posted September 11, 2010 whoops, i forgot about adding 1 point.. local playeraccount = getPlayerAccount (source) local playerpoints = getAccountData(playeraccount, "DD.Points") if (playerpoints==false or playerpoints==nil) then playerpoints=0 end playerpoints = playerpoints + 1 setAccountData (playeraccount, "DD.points", playerpoints) Link to comment
maarten123 Posted September 11, 2010 Author Share Posted September 11, 2010 whoops, i forgot about adding 1 point.. local playeraccount = getPlayerAccount (source) local playerpoints = getAccountData(playeraccount, "DD.Points") if (playerpoints==false or playerpoints==nil) then playerpoints=0 end playerpoints = playerpoints + 1 setAccountData (playeraccount, "DD.points", playerpoints) Nice, thanks 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