Shania Posted November 25, 2016 Posted November 25, 2016 Hey Guys can you tell me what is wrong this? function makeTargetFollow ( target ) if ( target ) and ( getElementType(target) == "player" ) then local x,y,z = getElementPosition( source ) local tx,ty,tz = getElementPosition( target ) if ( getDistanceBetweenPoints3D( x,y,z,tx,ty,tz ) <= 7 ) then toggleAllControls( target, false ) setControlState( target, "forwards", true) setTimer( updateRotation, 500, 0, source, target ) end end end addEventHandler( "onPlayerTarget", root, makeTargetFollow ) function updateRotation( player, target ) if ( isElement(player) ) and ( isElement(target) ) then local x,y = getElementPosition( player ) local tx,ty = getElementPosition( target ) local rot = findRotation(tx,ty,x,y) setElementRotation ( target, 0, 0, rot ) end end 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
ViRuZGamiing Posted November 25, 2016 Posted November 25, 2016 What happens and is there a debugscript 3 error?
Shania Posted November 25, 2016 Author Posted November 25, 2016 4 minutes ago, ViRuZGamiing said: What happens and is there a debugscript 3 error? its not working
ViRuZGamiing Posted November 25, 2016 Posted November 25, 2016 1 minute ago, Shania said: its not working Try putting output's in your code and see where it runs and where it doesn't
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now