local jeepDX = 0 local jeepDY = 0 local jeepDZ = 0 local jeepDist = 101 local ani = 0 local distance = 100 --ShowEntity = 0 function carmoving2_init(e) GravityOff(e) CollisionOff(e) ani = 0 end function carmoving2_main(e) if g_Entity[2] ~= nil then jeepDX = g_Entity[2]['x'] - g_Entity[e]['x']; jeepDY = g_Entity[2]['y'] - g_Entity[e]['y']; jeepDZ = g_Entity[2]['z'] - g_Entity[e]['z']; jeepDist = math.sqrt(math.abs(jeepDX^2)+math.abs(jeepDY^2)+math.abs(jeepDZ^2)) if ani <= 1 then MoveForward(e,600) ModulateSpeed(e,3.0) PlaySound(e,0) SetAnimationFrames(e,5,15) PlayAnimation(e) else StopAnimation(e) StopSound(e) CollisionOn(e) GravityOn(e) end if jeepDist < distance then ani = 1 elseif jeepDist > distance and ani == 1 then ani = 2 end end end