@koragg try this:
local AngX, AngZ, specdis, ticks, ticks2, speed, specon = 0, 0, 0, 0, 1, 0.8, nil
function MoveMouse(rx, ry, x, y)
if not isCursorShowing() then
local sx, sy = guiGetScreenSize()
ticks = getTickCount()
ticks2 = 1
AngX = (AngX + (x - (sx/2))/10) % 360
AngZ = (AngZ + (y - (sy/2))/10) % 360
if AngZ > 180 then
if AngZ < 315 then AngZ = 315 end
else
if AngZ > 45 then AngZ = 45 end
end
end
end
function RenderVeiw()
if not specon then
removeEventHandler("onClientPreRender", getRootElement(), RenderVeiw)
removeEventHandler("onClientCursorMove", getRootElement(), MoveMouse)
return 1
end
local ox, oy, oz
local x, y, z = getElementPosition(specon)
if ticks+10000 < getTickCount() then
local fixAngle = 360
if getKeyState("Q") == true then fixAngle = 270 end
if getKeyState("E") == true then fixAngle = 90 end
if getKeyState("Q") == true and getKeyState("E") == true or getKeyState("mouse3") == true then fixAngle = 180 end
local rx, ry, rz = getElementRotation(specon)
local dis = AngX-(fixAngle-rz)
local dis1 = math.abs(dis)
local zdis = (35-AngZ)
if AngZ < 360 and AngZ > 270 then zdis = 35+(360-AngZ) end
if math.abs(zdis) > speed then zdis = zdis*(speed/math.abs(zdis)) end
if dis1 > 30 then
if speed < 4 then speed = speed + 0.8 end
end
if dis1 < 30 then
if speed > 0.8 then speed = speed - 0.8 end
end
if dis1 > speed then dis = dis*(speed/dis1) end
if dis1 < speed and math.abs(zdis) < speed and ticks2 == 1 then
ticks2 = 0
triggerEvent("mouseAnimationEndCamera", getRootElement())
end
AngX = AngX - dis
AngZ = AngZ + zdis
end
ox = x - math.sin(math.rad(AngX)) * specdis
oy = y - math.cos(math.rad(AngX)) * specdis
oz = z + math.tan(math.rad(AngZ)) * specdis
setCameraMatrix(ox, oy, oz, x, y, z)
end
function mouseAnimationEndCamera()
-- animation end
end
function PlayerSpecOnElement(spec, distance)
if spec == nil or distance == nil or spec == "None" then
specon = nil
specdis = 0
return 1
end
if specon then
removeEventHandler("onClientPreRender", getRootElement(), RenderVeiw)
removeEventHandler("onClientCursorMove", getRootElement(), MoveMouse)
end
specon = spec
specdis = distance
addEventHandler("onClientPreRender", getRootElement(), RenderVeiw)
addEventHandler("onClientCursorMove", getRootElement(), MoveMouse)
end
addEvent("setPlayerSpecOnElement", true)
addEventHandler("setPlayerSpecOnElement", getRootElement(), PlayerSpecOnElement)
and tell me if it work