Jump to content

Boolean with number


Drakath

Recommended Posts

Can someone tell me why do I get this error:

ERROR: rotation_check\server.lua:6: attempt to compare number with boolean

local x, y, z = getElementPosition(thePlayer) 
local px, py, pz = getElementPosition(ped) 
local rx,ry,rz = getElementRotation( ped ) 
local formula = tonumber((360 - math.deg(math.atan2((x - px), (y - py)))) % 360)+1 
if rz and formula then 
if not tonumber(rz) > tonumber(formula) then 
outputChatBox("Looking", root) 
else 
outputChatBox("Not looking", root) 
end 
end 

thePlayer and ped do exist.

Link to comment
local x, y, z = getElementPosition(thePlayer) 
local px, py, pz = getElementPosition(ped) 
local rx,ry,rz = getElementRotation( ped ) 
local formula = tonumber((360 - math.deg(math.atan2((x - px), (y - py)))) % 360)+1 
outputChatBox ( type ( rz ) .. type ( formula ) ) 
if rz and formula then 
if not tonumber(rz) > tonumber(formula) then 
outputChatBox("Looking", root) 
else 
outputChatBox("Not looking", root) 
end 
end 

Check what it outptuts on chatbox.

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