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)

Giving a Fuck? Nope, That isn't in My Skill Set

castie11.png

Posted

Debug it like this:

outputChatBox ( x ) 

etc..

after that

outputChatBox ( tostring(totalDist) ) 

Why debugging the cordinates?

Because it may not excist.

Sometimes I dream about cheese

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

Giving a Fuck? Nope, That isn't in My Skill Set

castie11.png

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?

Sometimes I dream about cheese

Posted

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

and is just output on chatbox the false

Giving a Fuck? Nope, That isn't in My Skill Set

castie11.png

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

Sometimes I dream about cheese

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

Giving a Fuck? Nope, That isn't in My Skill Set

castie11.png

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.

CiTLh.png

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