--local nametagFont = "default" local nametagFont = dxCreateFont( "epik.ttf", 20 ) if not nametagFont then nametagFont = "default-bold" end local vopisFont = dxCreateFont( "epik.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 } addEventHandler("onClientMinimize", root, function() setElementData(localPlayer, "player:minimalized", getTickCount()) setElementData(localPlayer, "player:tick", getTickCount()) timer = Timer(function() localPlayer:setData("player:tick", getTickCount()) end, 1000, 0) end) addEventHandler("onClientRestore", root, function() setElementData(localPlayer, "player:minimalized", false) if timer and timer.valid then timer:destroy() end end) -- 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) local sxc6,syc6 =getScreenFromWorldPosition(x, y, z+0.79) 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,0,0,-50 ) local minimalized = "" local minimal = getElementData(player, "player:minimalized") if minimal then local tick = getElementData(player, "player:tick") if tick then local tick = tick - minimal local sekundy=math.floor(tick/1000) or 0 local godziny = string.format("%02.f", math.floor(sekundy/3600)); local minuty = string.format("%02.f", math.floor(sekundy/60 - (godziny*60))); local secs = string.format("%02.f", math.floor(sekundy - godziny*3600 - minuty *60)); minimalized = "poza mta od: "..godziny.."h "..minuty.."m "..secs.."s" end end if getElementData(player,"player:minimalized") then dxDrawText (minimalized.."",sxc6, syc6, sxc6, syc6, tocolor(255, 255, 255, 255),1.0-distance/25,"default-bold","center","center",false,false,false,true,true,0,0,-10) end if getElementData(player,"player:vip") then dxDrawText ("[PREMIUM]",sxc1, syc2, sxc1, syc2, tocolor(255, 191, 0, 255),1.0-distance/25,"default","center","center",false,false,false,true,true,0,0,-10 ) end if getElementData(player,"player:svip") then dxDrawText ("[PREMIUM+]",sxc1, syc2, sxc1, syc2,tocolor(255, 191, 0, 255),1.0-distance/25,"default","center","center",false,false,false,true,true,0,0,-10 ) end if getElementData(player, "player:muted") then dxDrawText ("#ffffff[#FF0000Zmutowany#ffffff]",sxc5, syc5, sxc5, syc5,tocolor(255, 191, 0, 255),1.0-distance/25,"default","center","center",false,false,false,true,true,0,0,-10 ) end local frakcja = getElementData(player, "player:duty") if frakcja == "SAPD" then dxDrawText("[San Andreas Police Departament]", sxc2, syc3, sxc2, syc3, tocolor(3, 0, 253, 255), 1.02, "default-bold", "center", "center") elseif frakcja == "SAFD" then dxDrawText("[San Andreas Fire Departament]", sxc2, syc3, sxc2, syc3, tocolor(255, 0, 0, 255), 1.02, "default-bold", "center", "center") elseif frakcja == "SAMA" then dxDrawText("[San Andreas Medical Assistance]", sxc2, syc3, sxc2, syc3, tocolor(0, 255, 255, 255), 1.02, "default-bold", "center", "center") end local level = getElementData(player, "player:level") if not getElementData(player,"p:inv") then if type(level) == "number" then if level == 1 then dxDrawText("[SUPPORT]", sxc, syc, sxc, syc, tocolor(0, 255, 0, 255), 1.02, "default-bold", "center", "center") elseif level == 2 then dxDrawText("[ADMINISTRATOR]", sxc, syc, sxc, syc, tocolor(255, 0, 0, 255), 1.02, "default-bold", "center", "center") elseif level == 3 then dxDrawText("[ADMINISTRATOR RCON]", sxc, syc, sxc, syc, tocolor(163, 19, 3, 110), 1.02, "default-bold", "center", "center") elseif level == 4 then dxDrawText("[OPIEKUN]", sxc, syc, sxc, syc, tocolor(0, 153, 147, 255), 1.02, "default-bold", "center", "center") elseif level == 5 then dxDrawText("[MANAGER]", sxc, syc, sxc, syc, tocolor(51,153,255, 255), 1.02, "default-bold", "center", "center") 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:faction") == "samc-sf" 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 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 <= 12 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 <= 12 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)