Jump to content

calculate with accountdata


maarten123

Recommended Posts

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 :D

Script:

local playeraccount = getPlayerAccount ( source ) 
local playerpoints = getAccountData ( playeraccount, "DD.Points" )  +1 
setAccountData ( playeraccount, "DD.points", playerpoints ) 

Link to comment

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
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 :D 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 :P

Link to comment

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
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 :D

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...