Jump to content

Help Please?


Lloyd Logan

Recommended Posts

Hey, the errors of this code are; Attemp to call global findRotation 'a nil value'?

  
local xa, ya, za = getElementPosition(marker1) 
local xb, yb, zb = getElementPosition(marker2) 
  
function walking(walking) 
    setElementRotation(johnny, findRotation(xa, ya, xb, ya)) 
    setPedAnimation( johnny, "ped", "WOMAN_walknorm") 
end 

Link to comment
function findRotation(x1,y1,x2,y2) 
  
  local t = -math.deg(math.atan2(x2-x1,y2-y1)) 
  if t < 0 then t = t + 360 end; 
  return t; 
  
end 
  
local xa, ya, za = getElementPosition(marker1) 
local xb, yb, zb = getElementPosition(marker2) 
  
function walking(walking) 
    setElementRotation(johnny, findRotation(xa, ya, xb, ya)) 
    setPedAnimation( johnny, "ped", "WOMAN_walknorm") 
end 

How difficult it is to understand this?

Edit:

Also setElementRotation required 3 arguments, while findRotation return one argument only.

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