K4stic Posted April 10, 2013 Posted April 10, 2013 totalDist = getDistanceBetweenPoints3D ( x, y, z, x2, y2, z2 ) paycheck = math.floor(tonumber(totalDist*100 )) totalPay = givePlayerMoney ( hitElement, (paycheck) ) it says me line 2: attempt to perform arithmetic on giobal 'totalDist' (a boolean value)
denny199 Posted April 10, 2013 Posted April 10, 2013 Debug it like this: outputChatBox ( x ) etc.. after that outputChatBox ( tostring(totalDist) ) Why debugging the cordinates? Because it may not excist.
K4stic Posted April 10, 2013 Author Posted April 10, 2013 (edited) output me false at chatbox code of cordinates+the previus code local x, y, z = getElementPosition( player ) local x2, y2, z2 = unpackbriefmark ( ) totalDist = getDistanceBetweenPoints3D ( x, y, z, x2, y2, z2 ) outputChatBox ( tostring(totalDist) ) paycheck = math.floor(tonumber(totalDist*100 )) totalPay = givePlayerMoney ( hitElement, (paycheck) ) Edited April 10, 2013 by Guest
denny199 Posted April 10, 2013 Posted April 10, 2013 What outputs false? The cordinates or the distance, as I said before, debug the x2, y2, z2 to, and the x, y, z. Any change of showing the unpackbriefmark function?
K4stic Posted April 10, 2013 Author Posted April 10, 2013 yes is working all only this not working the bug is only on getDistanceBetweenPoints3D and is just output on chatbox the false
denny199 Posted April 10, 2013 Posted April 10, 2013 Returns a float containing the distance between the two points as a float. Returns false if an argument passed was invalid. Are you sure that the script function is triggered by a "player" ?
K4stic Posted April 10, 2013 Author Posted April 10, 2013 yes because then i remove the 3d distange and adding just money then it works but then using 3d distange it bugged only to that line
TAPL Posted April 10, 2013 Posted April 10, 2013 output me false at chatboxcode of cordinates+the previus code local x, y, z = getElementPosition( player ) local x2, y2, z2 = unpackbriefmark ( ) totalDist = getDistanceBetweenPoints3D ( x, y, z, x2, y2, z2 ) outputChatBox ( tostring(totalDist) ) paycheck = math.floor(tonumber(totalDist*100 )) totalPay = givePlayerMoney ( hitElement, (paycheck) ) You're using player at line 1 and hitElement at line 6. i guess this is the problem.
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