maarten123 Posted September 11, 2010 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 )
dzek (varez) Posted September 11, 2010 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! Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
maarten123 Posted September 11, 2010 Author 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
dzek (varez) Posted September 11, 2010 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) Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
maarten123 Posted September 11, 2010 Author 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
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