Jump to content

calculate with accountdata


maarten123

Recommended Posts

Posted

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 ) 

Posted

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)!

Posted
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

Posted

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)!

Posted
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

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...