xXMADEXx Posted February 21, 2013 Posted February 21, 2013 Hey everyone! I got the legalsystem to work, but now i am editing the way it arrests and the distance stuff. I am trying to make the prisoner warp to the cop, but when the prisoner warps, he will not move at all. I am not sure how to fix this problem. Thanks --FORCES A PRISONER TO FOLLOW THE COP function walktheprisoner(thecop, theprisoner) if (getElementData ( theprisoner, "currentstatus" ) == "underarrest") and (getPedOccupiedVehicle ( theprisoner ) == false ) then local copx, copy, copz = getElementPosition ( thecop ) local prisonerx, prisonery, prisonerz = getElementPosition ( theprisoner ) copangle = ( 360 - math.deg ( math.atan2 ( ( copx - prisonerx ), ( copy - prisonery ) ) ) ) % 360 setPedRotation ( theprisoner, copangle ) setCameraTarget ( theprisoner, theprisoner ) local dist = getDistanceBetweenPoints2D ( copx, copy, prisonerx, prisonery ) if ( dist > 16 ) then setControlState ( theprisoner, "sprint", false ) setControlState ( theprisoner, "walk", false ) setControlState ( theprisoner, "forwards", false ) setControlState ( theprisoner, "jump", false ) setElementPosition(theprisoner, copx, copy+0.5, copz+1) setPedRotation ( theprisoner, copangle ) elseif ( dist > 12 ) then setControlState ( theprisoner, "sprint", true ) setControlState ( theprisoner, "walk", false ) setControlState ( theprisoner, "forwards", true ) setControlState ( theprisoner, "jump", false ) local zombify = setTimer ( walktheprisoner, 500, 1, thecop, theprisoner ) elseif ( dist > 6 ) then setControlState ( theprisoner, "sprint", false ) setControlState ( theprisoner, "walk", false ) setControlState ( theprisoner, "forwards", true ) setControlState ( theprisoner, "jump", false ) local zombify = setTimer ( walktheprisoner, 500, 1, thecop, theprisoner ) elseif ( dist > 1.5 ) then setControlState ( theprisoner, "sprint", false ) setControlState ( theprisoner, "walk", true ) setControlState ( theprisoner, "forwards", true ) setControlState ( theprisoner, "jump", false ) local zombify = setTimer ( walktheprisoner, 500, 1, thecop, theprisoner ) elseif ( dist < 1.5 ) then setControlState ( theprisoner, "sprint", false ) setControlState ( theprisoner, "walk", false ) setControlState ( theprisoner, "forwards", false ) setControlState ( theprisoner, "jump", false ) local zombify = setTimer ( walktheprisoner, 500, 1, thecop, theprisoner ) end end end Then, when i do this, he does nothing but run forward. Dosn't rotate. setControlState ( theprisoner, "sprint", false) setControlState ( theprisoner, "walk", true) setControlState ( theprisoner, "forwards", false ) setControlState ( theprisoner, "jump", false )
TAPL Posted February 21, 2013 Posted February 21, 2013 That's because you forgot to put the timer below setElementPosition. local zombify = setTimer ( walktheprisoner, 500, 1, thecop, theprisoner )
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