-Blaze- Posted February 20, 2016 Share Posted February 20, 2016 Hey, I'm trying to make some peds ( stored in a table ) , follow me. it works , if i have more than 1 of them following me , eg. 4 , all 4 don't follow me . only 1 follows , and the rest run away in random directions. Maybe somethings wrong with my code? setTimer( function() for i, animal in ipairs(allAI) do -- Loop every ped if getElementData ( animal, "tiger") == true then -- if it's a tiger local tiger = animal if getElementData( tiger, "state") == "hunting" then local prey = getElementData( tiger, "prey") if isElement( prey ) then local pX, pY, pZ = getElementPosition(tiger) local aX, aY, aZ = getElementPosition(prey) local dis = getDistanceBetweenPoints3D(pX, pY, pZ, aX, aY, aZ) -- run = block [ped] anim[run_player] -- walk = block[ped] anim[WALK_player] -- sprint = block[ped] anim[sprint_civi] if (dis > 20) then setPedAnimation ( tiger) elseif (dis <= 20 and dis>10) then setPedAnimation ( tiger, "ped", "sprint_civi",-1,true,true,true) setPedRotation( tiger, 360 - math.deg ( math.atan2 ( ( aX - pX ), ( aY - pY ) ) ) % 360 ) elseif (dis <= 10 and dis>3) then setPedAnimation ( tiger, "ped", "run_player",-1,true,true,true) setPedRotation( tiger, 360 - math.deg ( math.atan2 ( ( aX - pX ), ( aY - pY ) ) ) % 360 ) elseif (dis <= 3 and dis>2) then setPedAnimation ( tiger, "ped", "WALK_player",-1,true,true,true) setPedRotation( tiger, 360 - math.deg ( math.atan2 ( ( aX - pX ), ( aY - pY ) ) ) % 360 ) elseif (dis <= 2) then setPedAnimation ( tiger) triggerClientEvent(root, "fire", root, tiger,true,pX, pY, pZ, aX, aY, aZ) setPedRotation( tiger, 360 - math.deg ( math.atan2 ( ( aX - pX ), ( aY - pY ) ) ) % 360 ) end else setPedAnimation ( tiger) end end end end end, 200, 0) Any Help? Link to comment
manawydan Posted February 25, 2016 Share Posted February 25, 2016 i dont see erros, mta bug? Link to comment
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