local activ = false
local font = renderCreateFont('ShellyAllegroC', 6, 5)
function main()
repeat wait(0) until isSampAvailable()
sampRegisterChatCommand('rmusor',function()
activ = not activ
printString('MUSOR-RENDER '..(activ and '~g~enable' or '~r~disable'), 1500)
end)
while true do
wait(0)
if activ then
for _, obj in pairs(getAllObjects()) do
if getObjectModel(obj) == 852 then
if isObjectOnScreen(obj) then
local res, x1, y1, z1 = getObjectCoordinates(obj)
if res then
local x, y, z = getCharCoordinates(PLAYER_PED)
local dist = math.floor(getDistanceBetweenCoords3d(x, y, z, x1, y1, z1))
local c1, c2 = convert3DCoordsToScreen(x, y, z)
local o1, o2 = convert3DCoordsToScreen(x1, y1, z1)
renderDrawLine(c1, c2, o1, o2, 1, 0xFF2ACAEA)
renderFontDrawText(font, ("{FF4500}Достанция %0.2f"):format(dist), o1, o2, -1)
end
end
end
end
end
end
end