hey guys
i have this fp script
player = getLocalPlayer()
function findRot(x1, y1, x2, y2)
local t = -math.deg(math.atan2(x2 - x1, y2 - y1))
return t < 0 and t + 360 or t
end
addEventHandler("onClientRender", getRootElement(),
function()
local x, y, z = getPedBonePosition(player, 6)
setCameraMatrix(x, y, z)
end
)
addEventHandler("onClientCursorMove", getRootElement(),
function(_, _, _, _, wX, wY, wZ)
local x, y, z = getPedBonePosition(player, 6)
setPedRotation(player, findRot(x, y, wX, wY))
end
)
the problem is, when i move the mouse my rotation is reset . how do i fix it?