Jump to content

Variable question


Snoozy

Recommended Posts

Yea I realized that it was tonumber that was required tho now I've come across a similar problem on like a few lines later.

The whole thing I'm currently having trouble with in case you don't know yet is a enter and exit system, the enter system works now and you can enter.

However now theres a problem in exiting.

local int = BizInfo[getElementData(source,"BizEntered")].interior 
if getDistanceBetweenPoints3D(x,y,z,IntInfo[int].X,IntInfo[int].Y,IntInfo[int].Z) <= 3 then 

I've tried there with tonumber, tostring and toboolean but it wont work I just always get the:

[2011-05-27 08:53:29] ERROR: boulevard\business\server.lua:67: attempt to index field '?' (a nil value)

Link to comment

Okay now after some testing again and changing I came to a new error which is:

[2011-05-27 10:45:58] WARNING: boulevard\business\server.lua:72: Bad argument @ 'getDistanceBetweenPoints3D'

[2011-05-27 10:45:58] ERROR: boulevard\business\server.lua:72: attempt to compare boolean with number

  
local b = tonumber(getElementData(source,"BizEntered")) 
            local int = tonumber(BizInfo[b].Interior) 
            local x,y,z = getElementPosition(source) 
            local pX = getElementData(IntInfo[int].Pickup,"PosX") 
            local pY = getElementData(IntInfo[int].Pickup,"PosY") 
            local pZ = getElementData(IntInfo[int].Pickup,"PosZ") 
            if getDistanceBetweenPoints3D(x,y,z,pX,pY,pZ) <= 3 then 

That is the code used for line 72 which is the last shown the getDistanceBetween

Link to comment

pX, pY, and/or pZ is false

note that if its not nil it means syncing variables works, just one function in the other side returned false, not number(this mostly appears when trying to get some number out of function with invalid object pointer, or trying to get some ped's vehicle info while ped is on foot.)

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