Jump to content

help at getDistanceBetweenPoints3D


K4stic

Recommended Posts

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

Posted

Debug it like this:

outputChatBox ( x ) 

etc..

after that

outputChatBox ( tostring(totalDist) ) 

Why debugging the cordinates?

Because it may not excist.

Posted (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 by Guest
Posted

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?

Posted

yes is working all only this not working the bug is only on getDistanceBetweenPoints3D

and is just output on chatbox the false

Posted
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" ?

Posted

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

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

You're using player at line 1 and hitElement at line 6. i guess this is the problem.

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