Jump to content

Races +1 (client)


[DMC]

Recommended Posts

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

logo_left.png
Posted

omg.. its too easy to ask o_O

and was asked 10000000000000 times..

make script from these ( i did not follow syntax etc, and it can have some typos)

  
x = getElementData 
if not nil and not false 
setElementData (..., x+1) 
else 
setElementData(...,0) 
end 
  

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

looks complicated

function addStatsData()  
x = getElementData 
if not nil and not false 
setElementData (localPlayer,"Race Loses", x+1) 
end 
addEventHandler("onClientPlayerWasted", getLocalPlayer(), addStatsData) 
  

i tried this

logo_left.png
Posted

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

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

logo_left.png
Posted

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

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 (edited)

:cry:

srry maybe u can give me those links here again and i will try to think and learn more about lua

Edited by Guest
logo_left.png
Posted

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

i think this was easier,

if getElementData(localPlayer,"Race Loses") then 
setElementData(localPlayer,"Race Loses",tonumber(getElementData(localPlayer,"Race Loses"))+1)    
else 
setElementData(localPlayer,"Race Loses",1) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

same thing but looks more confusing for me (but eliminate my mistake when after first death Loses are set to 0 instead of 1)

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

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