Sign in to follow this  
MetaGamer

Math Problem

Recommended Posts

In this code

  
                local posX , posY , posZ = getElementPosition ( player ) 
        local posX2 , posY2 , posZ2 = getElementPosition ( curTarget ) 
        local rotation = math.deg ( math.atan2 ( posX2 - posX , posY2 - posY ) ) % 360 
        setElementRotation ( player , 0 , 0 , 360 - rotation ) 
        setCameraTarget ( player ) 
        local distance = getDistanceBetweenPoints2D(posX2, posY2, posX, posY) 
        if distance > 22 then 
            setElementData(player, "arrest", false) 
            setElementData(player, "arrester", "") 
            showCursor(false) 
            toggleAllControls(true) 
            removeEventHandler ( "onClientRender" , getRootElement() , setPlayerFollowPlayer ) 
        elseif distance > 12 then 
            setControlState("sprint", true) 
            setControlState("walk", false) 
            setControlState("forwards", true) 
        elseif distance > 6 then 
            setControlState("sprint", false) 
            setControlState("walk", false) 
            setControlState("forwards", true) 
        elseif distance > 1.5 then 
            setControlState("sprint", false) 
            setControlState("walk", true) 
            setControlState("forwards", true) 
        elseif distance < 1.5 then 
            setControlState("sprint", false) 
            setControlState("walk", false) 
            setControlState("forwards", false) 
        end 
  

The player is running backwards not forward. How can I make him run forward instead of backwards?

Share this post


Link to post

Hmm, odd.

You could try turning the guy the other way, so he runs towards you, but I guess that might seem a little weird too.

I am not entirely sure why he runs backwards :S

Share this post


Link to post

I don't really suggest it for an online server, because if arrested players continually run backwards, it is going to look somewhat strange :/

Share this post


Link to post

I thought it would be on a timer or something, but I don't know much about players following players, so I cannot be greatly of assistance.

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.