Jump to content

removeElementData value


Recommended Posts

Hello ,

I would like to remove the value in a elementdata

What i mean is this thing bellow

setElementData(thePlayer,"peds",[b]5[/b]) -- settng the elementdata 
function removePed() 
removeElementData(thePlayer,"peds",-1) -- Lowering the last value with -1 (cant get it to work like this) 

I wanna make something like that (the bold 5 should be lowered by -1 once i do /takeped

Thank you in advance,

Link to comment

That would remove the value(read the syntax thoroughly on the wiki. It has 2 parameters, you can't add a third and expect it to magically know what you want it to do). If you want to decrease the value you have to use getElementData and then setElementData again.

setElementData(thePlayer, "peds", 5) 
local theValue = getElementData(thePlayer, "peds") -- If successful, theValue should be 5. 
setElementData(thePlayer, "peds", theValue-1) -- Decrease previous value by 1. 

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