I guess you didn't check them otherwise you would have understood what I'm talking about.
addEventHandler ( "onClientRender", g_Root,
function()
local x,y,z = getCameraMatrix()
for player in pairs(nametags) do
while true do
if not isPedInVehicle(player) or isPedDead(player) then break end
local vehicle = getPedOccupiedVehicle(player)
local px,py,pz = getElementPosition ( vehicle )
local pdistance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz )
if pdistance <= NAMETAG_DISTANCE then
local sx,sy = getScreenFromWorldPosition ( px, py, pz+0.95, 0.06 )
if not sx or not sy then break end
local scale = 1/(NAMETAG_SCALE * (pdistance / NAMETAG_DISTANCE))
local alpha = ((pdistance - NAMETAG_ALPHA_DISTANCE) / NAMETAG_ALPHA_DIFF)
alpha = (alpha < 0) and NAMETAG_ALPHA or NAMETAG_ALPHA-(alpha*NAMETAG_ALPHA)
scale = math.evalCurve(maxScaleCurve,scale)
local textscale = math.evalCurve(textScaleCurve,scale)
local textalpha = math.evalCurve(textAlphaCurve,alpha)
local outlineThickness = NAMETAG_OUTLINE_THICKNESS*(scale)
local r,g,b = 255,255,255
local team = getPlayerTeam(player)
if team then
r,g,b = getTeamColor(team)
end
local offset = (scale) * NAMETAG_TEXT_BAR_SPACE/2
dxDrawText ( getPlayerName(player), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default", "center", "bottom", false, false, false )
end
break
end
end
end
)
And you can do the same like that:
local playersUsingMic = {}
local x, y = guiGetScreenSize ( )
local sx, sy = 1600, 900
function onStartVoiceChat()
local myIndex = getMyValue(source)
if (not myIndex or not playersUsingMic[myIndex]) then
local p_id = getElementData (source, "ID") or "0"
table.insert(playersUsingMic, {source, p_id})
end
end
addEventHandler("onClientPlayerVoiceStart", root, onStartVoiceChat)
function onStopVoiceChat()
local myIndex = getMyValue(source)
if ( myIndex ) then
table.remove(playersUsingMic, myIndex)
end
end
addEventHandler("onClientPlayerVoiceStop", root, onStopVoiceChat)
function drawText()
if (#playersUsingMic > 0) then
for i, v in ipairs(playersUsingMic) do
local x, y, z = getElementPosition(v[1])
local x2, y2, z2 = getElementPosition(localPlayer)
local distance = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2)
if (distance <= 15) then
-- Your dx functions
end
end
end
end
addEventHandler("onClientRender", root, drawText)
function getMyValue(player)
for i, v in ipairs(playersUsingMic) do
if v[1] == player then
return i
end
end
end