require"lib.moonloader"
require"lib.sampfuncs"
local Matrix3X3 = require "matrix3x3"
local Vector3D = require "vector3d"
local font_flag = require('moonloader').font_flag
local my_font = renderCreateFont('Verdana', 12)
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
while true do wait(0)
if isKeyDown(VK_RBUTTON) then
local sx, sy = getCursorPos()
local sw, sh = getScreenResolution()
if sx >= 0 and sy >= 0 and sx < sw and sy < sh then
local posX, posY, posZ = convertScreenCoordsToWorld3D(sx, sy, 700.0)
local camX, camY, camZ = getActiveCameraCoordinates()
local result, colpoint = processLineOfSight(camX, camY, camZ, posX, posY, posZ, true, true, false, true, false, false, false)
if result and colpoint.entity ~= 0 then
local normal = colpoint.normal
local pos = Vector3D(colpoint.pos[1], colpoint.pos[2], colpoint.pos[3]) - (Vector3D(normal[1], normal[2], normal[3]) * 0.1)
local zOffset = 300
if normal[3] >= 0.5 then zOffset = 1 end
local result, colpoint2 = processLineOfSight(pos.x, pos.y, pos.z + zOffset, pos.x, pos.y, pos.z - 0.3, true, true, false, true, false, false, false)
if result then
pos = Vector3D(colpoint2.pos[1], colpoint2.pos[2], colpoint2.pos[3] + 1)
local positionX, positionY, positionZ = getCharCoordinates(PLAYER_PED)
local str = positionX .. ", " .. positionY .. ", " .. positionZ
renderFontDrawText(my_font, pos.x..' '..pos.y..' '..pos.z, 10, 400, 0xFFFFFFFF)
renderFontDrawText(my_font,str..' :Мои координаты', 10, 450, 0xFFFFFFFF)
end
end
end
end
end
end