scaryface87 Posted August 8, 2015 Posted August 8, 2015 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) end addCommandHandler("takeped",removeped) I wanna make something like that (the bold 5 should be lowered by -1 once i do /takeped Thank you in advance,
Dealman Posted August 9, 2015 Posted August 9, 2015 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now