Then, you should have told us that before.
function dxDrawColorText(str, ax, ay, bx, by, color, scale, font)
local pat = "(.-)#(%x%x%x%x%x%x)"
local s, e, cap, col = str:find(pat, 1)
local last = 1
while s do
if cap == "" and col then color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), 255) end
if s ~= 1 or cap ~= "" then
local w = dxGetTextWidth(cap, scale, font)
dxDrawText(cap, ax, ay, ax + w, by, color, scale, font, "center", "bottom", false, false, false )
ax = ax + w
color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), 255)
end
last = e + 1
s, e, cap, col = str:find(pat, last)
end
if last <= #str then
cap = str:sub(last)
local w = dxGetTextWidth(cap, scale, font)
dxDrawText(cap, ax, ay, ax + w, by, color, scale, font, "center", "bottom", false, false, false )
end
end
function drawPlayerTags()
for i,v in ipairs(getElementsByType("player")) do
if not v == getLocalPlayer() then
local name = getPlayerName(v)
local x,y,z = getElementPosition(v)
local cx,cy,cz = getCameraMatrix()
if isLineOfSightClear(cx,cy,cz,x,y,z,true,true,false,true,false,true,false,v) then
if getDistanceBetweenPoints3D(cx,cy,cz,x,y,z) <= 45 then
local px,py = getScreenFromWorldPosition(x,y,z+0.3,0.06)
if px then
r,g,b = getPlayerNametagColor(v)
dxDrawColorText(name, px-60, py, px, py, tocolor(r, g, b, 255), 2, "default")
end
end
end
end
end
end
addEventHandler("onClientRender",getRootElement(),drawPlayerTags)
There, it works fine here, should work "there" too.
And please, don't think we're your "slaves" our something like that