local target = false
function main()
while not isSampAvailable() do wait(0) end
sampRegisterChatCommand("target", function()
target = not target
end)
while true do
wait(0)
if target then
for i, v in ipairs(getAllChars()) do
if v ~= PLAYER_PED then
local x,y,z = getCharCoordinates(v)
renderTargetBox(x,y,z, 1,2)
end
end
end
end
end
function renderTargetBox(x, y, z, coefZUP, coefZDOWN,color) -- x,y,z - центр отрисовки coefUP and coefZDOWN - коэффициент поднятия верхнего уровня и опускания нижнего color - цвет в формате ARGB, если оставить его пустым будет просто зеленый цвет
if color == nil then color = 0xAA00CC00 end
if isPointOnScreen(x,y,z,0) then
local mx, my, mz = getCharCoordinates(1)
local radius = 150
local coef = getDistanceBetweenCoords3d(mx,my,mz,x,y,z)
local coef2 = getDistanceBetweenCoords3d(mx,my,mz,x,y,z)
local coef = coef-(coef*2)
local coef2 = coef2-(coef2*2)
if coef > -25 then
coef = -25
coef2 = -12
z = z + coefZUP
local cx, cy = convert3DCoordsToScreen(x,y,z)
renderDrawLine(cx+coef+60,cy,cx-coef-10,cy,3,color)
renderDrawLine(cx-coef-60,cy-3,cx+coef+10,cy-3,3,color)
renderDrawLine(cx+coef+60,cy,cx+coef+60,cy-coef,3,color)
renderDrawLine(cx-coef-60,cy,cx-coef-60,cy-coef,3,color)
z = z - coefZDOWN
local cx, cy = convert3DCoordsToScreen(x,y,z)
renderDrawLine(cx+coef+60,cy,cx-coef-10,cy,3,color)
renderDrawLine(cx-coef-60,cy-3,cx+coef+10,cy-3,3,color)
renderDrawLine(cx+coef+60,cy,cx+coef+60,cy+coef,3,color)
renderDrawLine(cx-coef-60,cy,cx-coef-60,cy+coef,3,color)
elseif coef < -25 then
coef = -1
coef2 = -55
z = z + coefZUP
local cx, cy = convert3DCoordsToScreen(x,y,z) -- верх
renderDrawLine(cx+coef+coef*5, cy, cx-coef+coef2/2.3, cy, 3,color)
renderDrawLine(cx-coef-coef*2, cy-3, cx+2+coef-coef2/3, cy-3, 3,color)
renderDrawLine(cx+coef+coef2/3, cy, cx+coef+coef2/3, cy-coef+20, 3,color)
renderDrawLine(cx-coef-coef2/3, cy, cx-coef-coef2/3, cy-coef+20, 3,color)
z = z - coefZDOWN
local cx, cy = convert3DCoordsToScreen(x,y,z) -- низ
renderDrawLine(cx+coef+coef2/2.5, cy, cx+coef+coef2/2.5, cy-coef-20, 3,color)
renderDrawLine(cx-coef-coef2/3, cy, cx-coef-coef2/3, cy-coef-20, 3,color)
renderDrawLine(cx+coef+coef*5, cy, cx-coef+coef2/2.3, cy, 3,color)
renderDrawLine(cx-coef-coef*2, cy-3, cx+2+coef-coef2/3, cy-3, 3,color)
end
end
end