Jump to content

Races +1 (client)


[DMC]

Recommended Posts

function addStatsData()  
    setElementData(localPlayer,"Race Loses",0) 
end 
addEventHandler("onClientPlayerWasted", getLocalPlayer(), addStatsData) 

Well im using this to set in a label the amount of DM's lost

But when i die it sets to 0 and when i change 0 to 5 it sets to 5

My question is how can i do +1 every time i die :|

Link to comment
1.) dont forget about else i've written

2.) https://wiki.multitheftauto.com/wiki/GetElementData

3.) think!

4.) if x ~= nil and x ~= false then -- until you come with new question..

function addStatsData()  
    setElementData(localPlayer,"Race Loses", +1) 
end 
addEventHandler("onClientPlayerWasted", getLocalPlayer(), addStatsData) 
  

Like u did + i tried that before but it didnt work. but im sure it needs to work :S

cuz i tried +1 before and then it worked but now it doesnt anymore

Link to comment

argh argh....

Should i give you link to lua tutorial and debugging tutorial? Just check other topics - every 5 messages i'm posting these links but nobody even cares to CLICK those links:/

  
function addStatsData()  
  x = getElementData(localPlayer,"Race Loses") 
  if x ~= nil and x ~= false then 
    setElementData (localPlayer,"Race Loses", tonumber(x)+1) 
  else 
    setElementData (localPlayer,"Race Loses", 0) 
  end 
end 
addEventHandler("onClientPlayerWasted", getLocalPlayer(), addStatsData) 
  

you just got to my personal blacklist of ppl not trying to think, which means i'm not interested in your topics anymore - if you care..

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