--local nametagFont = "default"
local nametagFont = dxCreateFont( "czcionka.ttf", 20 )
if not nametagFont then nametagFont = "default-bold" end
local vopisFont = dxCreateFont( "czcionka.ttf", 20 )
if not vopisFont then vopisFont = "default-bold" end
local screenSize = Vector2(guiGetScreenSize())
local timer = false
local nametagAlpha = 175
local nametagColor =
{
r = 255,
g = 255,
b = 255
}
-- Funkcja nametag?w graczy i pojazd?w
-- zazwyczaj s? dla u?atwienia wygl?du.
addEventHandler("onClientRender", root, function()
local rootx, rooty, rootz = getCameraMatrix()
for i,player in ipairs(getElementsByType("player")) do
if getElementDimension(localPlayer) == getElementDimension(player) and getElementInterior(localPlayer) == getElementInterior(player) then
local x,y,z = getPedBonePosition(player,7)
local sx, sy = getScreenFromWorldPosition(x, y, z+0.50)
local sxc,syc =getScreenFromWorldPosition(x, y, z+0.69)
local sxc1,syc2 =getScreenFromWorldPosition(x, y, z+0.57)
local sxc2,syc3 =getScreenFromWorldPosition(x, y, z+0.63)
local sxc5,syc5 =getScreenFromWorldPosition(x, y, z+0.42)
if sx and sy and sxc and syc and sxc1 and syc2 then
local distance = getDistanceBetweenPoints3D(rootx, rooty, rootz, x, y, z)
if getElementAlpha(player) < 2 and not getElementData(localPlayer,"player:admin") then
return end
if(distance <= 12) then
--if isLineOfSightClear( rootx,rooty,rootz, x,y,z, true, false, false, false, false, false, true,localPlayer ) then
dxDrawText ((getPlayerName(player).." [#b8b8b8"..getElementData(player,"id").."#ffffff]"):gsub("#%x%x%x%x%x%x",""),sx, sy, sx, sy,tocolor(255, 255, 255,255),1.0,"default-bold","center","center",false,false,false,true, true)
if getElementData(player,"player:premium") then
dxDrawText ("[PREMIUM]",sxc1, syc2, sxc1, syc2, tocolor(169, 191, 46, 255),1.02,"default","center","center",false,false,false,true, true)
end
if getElementData(player,"player:premiumplus") then
dxDrawText ("[PREMIUM+]",sxc1, syc2 -15, sxc1, syc2, tocolor(116, 191, 46, 255),1.02,"default","center","center",false,false,false,true, true)
end
if getElementData(player, "player:mute") then
dxDrawText ("[Zmutowany]",sxc5, syc5, sxc5, syc5,tocolor(255, 0, 0, 255),1.02,"default","center","center",false,false,false,true, true)
end
local frakcja = getElementData(player, "player:faction")
if frakcja == "SAPD" then
dxDrawText("[San Andreas Police Departament]", sxc2, syc3, sxc2, syc3, tocolor(3, 0, 253, 255), 1.02, "default-bold", "center", "center",false,false,false,true, true)
elseif frakcja == "SAFD" then
dxDrawText("[San Andreas Fire Departament]", sxc2, syc3, sxc2, syc3, tocolor(255, 0, 0, 255), 1.02, "default-bold", "center", "center",false,false,false,true, true)
elseif frakcja == "SAMC" then
dxDrawText("[San Andreas Medical Center]", sxc2, syc3, sxc2, syc3, tocolor(0, 255, 255, 255), 1.02, "default-bold", "center", "center",false,false,false,true, true)
elseif frakcja == "SARA" then
dxDrawText("[San Andreeas Road Assistance]", sxc2, syc3, sxc2, syc3, tocolor(205, 87, 0, 255), 1.02, "default-bold", "center", "center",false,false,false,true, true)
elseif frakcja == "TSA" then
dxDrawText("[Transport San Andreas]", sxc2, syc3, sxc2, syc3, tocolor(255, 255, 0, 255), 1.02, "default-bold", "center", "center",false,false,false,true, true)
end
local level = getElementData(player, "player:level")
if type(level) == "number" then
if level == 6 then
dxDrawText("Support", sxc, syc, sxc, syc, tocolor(0, 255, 0, 255), 1.02, "default-bold", "center", "center",false,false,false,true, true)
elseif level == 1 then
dxDrawText("Moderator", sxc, syc, sxc, syc, tocolor(0, 255, 255, 255), 1.02, "default-bold", "center", "center",false,false,false,true, true)
elseif level == 2 then
dxDrawText("Administrator", sxc, syc, sxc, syc, tocolor(255, 0, 0, 255), 1.02, "default-bold", "center", "center",false,false,false,true, true)
elseif level == 3 then
dxDrawText("Opiekun", sxc, syc, sxc, syc, tocolor(255, 0, 255, 255), 1.02, "default-bold", "center", "center",false,false,false,true, true)
elseif level == 5 then
dxDrawText("RCON", sxc, syc, sxc, syc, tocolor(102, 0, 255, 255), 1.02, "default-bold", "center", "center",false,false,false,true, true)
elseif level == 7 then
dxDrawText("VCEO", sxc, syc, sxc, syc, tocolor(255, 100, 0, 255), 1.02, "default-bold", "center", "center",false,false,false,true, true)
elseif level == 4 then
dxDrawText("CEO", sxc, syc, sxc, syc, tocolor(255, 255, 0, 255), 1.02, "default-bold", "center", "center",false,false,false,true, true)
end
--dxDrawText (name,fX+1, fY+1, fX+1, fY+1,white,nametagScale,"default","center","center",false,false,false,true,true )
if getElementData(localPlayer,"player:duty") == "SAMC" then
dxDrawRectangle(sx-25*2-1, sy+5*2, 100-distance, 18+2-distance/2.0, tocolor(27,27,27,155))
dxDrawRectangle(sx-25*2, sy+5*2+1, getElementHealth(player)-distance, 18-distance/1.0, tocolor(255,5,5,155))
end
end
end
end
end
end
for i,ped in ipairs(getElementsByType("ped")) do
if ped~=localPlayer and getElementDimension(localPlayer)==getElementDimension(ped) and getElementInterior(localPlayer) == getElementInterior(ped) and getElementAlpha(ped) > 0 then
local x,y,z=getElementPosition(ped)
local sx,sy =getScreenFromWorldPosition(x, y, z+1)
if sx and sy then
local desc=getElementData(ped,"ped:desc")
if desc then
local distance = getDistanceBetweenPoints3D(rootx,rooty,rootz,x,y,z)
if distance <= 25 then
dxDrawText(desc, sx, sy, sx, sy, tocolor(255, 255, 255, 255), 1.0, "default`", "center", "center")
end
end
end
end
end
for i,vehicle in ipairs(getElementsByType("vehicle")) do
local x,y,z=getElementPosition(vehicle)
local sx,sy=getScreenFromWorldPosition(x,y,z)
if sx and sy then
local desc=getElementData(vehicle,"vehicle:desc")
if desc then
local distance=getDistanceBetweenPoints3D(rootx,rooty,rootz,x,y,z)
if distance <= 25 then
if isLineOfSightClear( rootx,rooty,rootz, x,y,z, true, false, false, true, false, false, true,localPlayer ) then
dxDrawText(desc:gsub("#%x%x%x%x%x%x",""), sx, sy, sx, sy, tocolor(255, 255, 255, 255), 1.00,"default", "center", "center")
end
end
end
end
end
end)
addEventHandler("onClientResourceStart", resourceRoot, function()
for _,v in ipairs(getElementsByType("player")) do
setPlayerNametagShowing(v, false)
end
end)
addEventHandler("onClientPlayerSpawn", root, function()
setPlayerNametagShowing(source, false)
end)