Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Created by Smokahontas.
- bindKey("mouse2", "down", function()
- local fov = 90
- local enemies = getElementsByType("player")
- for _,enemy in ipairs(enemies) do
- if enemy ~= localPlayer and getElementData(enemy, "player:logedin") then
- local x, y = getScreenFromWorldPosition(enemy.position)
- if x and y then
- if isLineOfSightClear(localPlayer.position, enemy.position, true, true, true, false, false) then
- local fovDistance = 6*(screenSize.x/1920)
- local distanceX = math.abs(screenSize.x/2 - x)
- local distanceY = math.abs(screenSize.y/2 - y)
- if distanceX < fovDistance and distanceY < fovDistance then
- local angle = math.deg(math.atan2(distanceY, distanceX))
- if angle < fov then
- setCameraMatrix(localPlayer.position, enemy.position)
- break
- end
- end
- end
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement