Facebook
From CrxA, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 209
  1. --local nametagFont = "default"
  2. local nametagFont = dxCreateFont( "epik.ttf", 20 )
  3. if not nametagFont then nametagFont = "default-bold" end
  4. local vopisFont = dxCreateFont( "epik.ttf", 20 )
  5. if not vopisFont then vopisFont = "default-bold" end
  6.  
  7. local screenSize = Vector2(guiGetScreenSize())
  8. local timer = false
  9. local nametagAlpha = 175
  10. local nametagColor =
  11. {
  12.         r = 255,
  13.         g = 255,
  14.         b = 255
  15. }
  16.  
  17. addEventHandler("onClientMinimize", root, function()
  18.         setElementData(localPlayer, "player:minimalized", getTickCount())
  19.         setElementData(localPlayer, "player:tick", getTickCount())
  20.         timer = Timer(function() localPlayer:setData("player:tick", getTickCount()) end, 1000, 0)
  21. end)
  22.  
  23. addEventHandler("onClientRestore", root, function()
  24.         setElementData(localPlayer, "player:minimalized", false)
  25.         if timer and timer.valid then timer:destroy() end
  26. end)
  27.  
  28. -- Funkcja nametagów graczy i pojazdów
  29. -- zazwyczaj są dla ułatwienia wyglądu.
  30. addEventHandler("onClientRender", root, function()
  31.         local rootx, rooty, rootz = getCameraMatrix()
  32.                 for i,player in ipairs(getElementsByType("player")) do
  33.                         if getElementDimension(localPlayer) == getElementDimension(player) and getElementInterior(localPlayer) == getElementInterior(player) then
  34.                                 local x,y,z = getPedBonePosition(player,7)
  35.                                 local sx, sy = getScreenFromWorldPosition(x, y, z+0.50)
  36.                                 local sxc,syc =getScreenFromWorldPosition(x, y, z+0.69)
  37.                                 local sxc1,syc2 =getScreenFromWorldPosition(x, y, z+0.57)
  38.                                 local sxc2,syc3 =getScreenFromWorldPosition(x, y, z+0.63)
  39.                                 local sxc5,syc5 =getScreenFromWorldPosition(x, y, z+0.42)
  40.                                 local sxc6,syc6 =getScreenFromWorldPosition(x, y, z+0.79)
  41.                                 if sx and sy and sxc and syc and sxc1 and syc2 then
  42.                                 local distance = getDistanceBetweenPoints3D(rootx, rooty, rootz, x, y, z)
  43.                                 if getElementAlpha(player) < 2 and not getElementData(localPlayer,"player:admin") then
  44.                                 return end
  45.                             if(distance <= 12) then
  46.                                 --if isLineOfSightClear( rootx,rooty,rootz, x,y,z, true, false, false, false, false, false, true,localPlayer ) then
  47.                                         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 )
  48.                                         local minimalized = ""
  49.                                         local minimal = getElementData(player, "player:minimalized")
  50.                                         if minimal then
  51.                                                 local tick = getElementData(player, "player:tick")
  52.                                                 if tick then
  53.                                                         local tick = tick - minimal
  54.                                                         local sekundy=math.floor(tick/1000) or 0
  55.                                                         local godziny = string.format("%02.f", math.floor(sekundy/3600));
  56.                                                         local minuty = string.format("%02.f", math.floor(sekundy/60 - (godziny*60)));
  57.                                                         local secs = string.format("%02.f", math.floor(sekundy - godziny*3600 - minuty *60));
  58.                                                         minimalized = "poza mta od: "..godziny.."h "..minuty.."m "..secs.."s"
  59.                                                 end
  60.                                         end
  61.                                         if getElementData(player,"player:minimalized") then
  62.                                         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)
  63.                                         end
  64.                                         if getElementData(player,"player:vip") then
  65.                                         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 )
  66.                                         end
  67.                                         if getElementData(player,"player:svip") then
  68.                                         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 )
  69.                                         end
  70.                                         if getElementData(player, "player:muted") then
  71.                                         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 )
  72.                                         end
  73.                                         local frakcja = getElementData(player, "player:duty")
  74.                                         if frakcja == "SAPD" then
  75.                                         dxDrawText("[San Andreas Police Departament]", sxc2, syc3, sxc2, syc3, tocolor(3, 0, 253, 255), 1.02, "default-bold", "center", "center")
  76.                                         elseif frakcja == "SAFD" then
  77.                                         dxDrawText("[San Andreas Fire Departament]", sxc2, syc3, sxc2, syc3, tocolor(255, 0, 0, 255), 1.02, "default-bold", "center", "center")
  78.                                         elseif frakcja == "SAMA" then
  79.                                         dxDrawText("[San Andreas Medical Assistance]", sxc2, syc3, sxc2, syc3, tocolor(0, 255, 255, 255), 1.02, "default-bold", "center", "center")
  80.                                         end
  81.                                         local level = getElementData(player, "player:level")
  82.                                         if not getElementData(player,"p:inv") then
  83.                                         if type(level) == "number" then
  84.                                         if level == 1 then
  85.                                         dxDrawText("[SUPPORT]", sxc, syc, sxc, syc, tocolor(0, 255, 0, 255), 1.02, "default-bold", "center", "center")
  86.                                         elseif level == 2 then
  87.                                         dxDrawText("[ADMINISTRATOR]", sxc, syc, sxc, syc, tocolor(255, 0, 0, 255), 1.02, "default-bold", "center", "center")
  88.                                         elseif level == 3 then
  89.                                         dxDrawText("[ADMINISTRATOR RCON]", sxc, syc, sxc, syc, tocolor(163, 19, 3, 110), 1.02, "default-bold", "center", "center")
  90.                                         elseif level == 4 then
  91.                                         dxDrawText("[OPIEKUN]", sxc, syc, sxc, syc, tocolor(0, 153, 147, 255), 1.02, "default-bold", "center", "center")
  92.                                         elseif level == 5 then
  93.                                         dxDrawText("[MANAGER]", sxc, syc, sxc, syc, tocolor(51,153,255, 255), 1.02, "default-bold", "center", "center")
  94.                                         end
  95.                                         --dxDrawText (name,fX+1, fY+1, fX+1, fY+1,white,nametagScale,"default","center","center",false,false,false,true,true )
  96.                                         if getElementData(localPlayer,"player:faction") == "samc-sf" then
  97.                                         dxDrawRectangle(sx-25*2-1, sy+5*2, 100-distance, 18+2-distance/2.0, tocolor(27,27,27,155))
  98.                                         dxDrawRectangle(sx-25*2, sy+5*2+1, getElementHealth(player)-distance, 18-distance/1.0, tocolor(255,5,5,155))
  99.                                         end
  100.                                         end
  101.                                   end
  102.                                 end
  103.                         end
  104.                 end
  105.         end
  106.         for i,ped in ipairs(getElementsByType("ped")) do
  107.                 if ped~=localPlayer and getElementDimension(localPlayer)==getElementDimension(ped) and getElementInterior(localPlayer) == getElementInterior(ped) and getElementAlpha(ped) > 0 then
  108.                         local x,y,z=getElementPosition(ped)
  109.                         local sx,sy =getScreenFromWorldPosition(x, y, z+1)
  110.                         if sx and sy then
  111.                                 local desc=getElementData(ped,"ped:desc")
  112.                                 if desc then
  113.                                         local distance = getDistanceBetweenPoints3D(rootx,rooty,rootz,x,y,z)
  114.                                         if distance <= 12 then
  115.                                                 dxDrawText(desc, sx, sy, sx, sy, tocolor(255, 255, 255, 255), 1.0, "default`", "center", "center")
  116.                                         end
  117.                                 end
  118.                         end
  119.                 end
  120.         end
  121.         for i,vehicle in ipairs(getElementsByType("vehicle")) do
  122.                 local x,y,z=getElementPosition(vehicle)
  123.                 local sx,sy=getScreenFromWorldPosition(x,y,z)
  124.                 if sx and sy then
  125.                         local desc=getElementData(vehicle,"vehicle:desc")
  126.                         if desc then
  127.                                 local distance=getDistanceBetweenPoints3D(rootx,rooty,rootz,x,y,z)
  128.                                 if distance <= 12 then
  129.                                         if isLineOfSightClear( rootx,rooty,rootz, x,y,z, true, false, false, true, false, false, true,localPlayer ) then
  130.                                         dxDrawText(desc:gsub("#%x%x%x%x%x%x",""), sx, sy, sx, sy, tocolor(255, 255, 255, 255), 1.00,"default", "center", "center")
  131.                                         end
  132.                                 end
  133.                         end
  134.                 end
  135.         end
  136. end)
  137.  
  138. addEventHandler("onClientResourceStart", resourceRoot, function()
  139.         for _,v in ipairs(getElementsByType("player")) do
  140.                 setPlayerNametagShowing(v, false)
  141.         end
  142. end)
  143.  
  144. addEventHandler("onClientPlayerSpawn", root,  function()
  145.         setPlayerNametagShowing(source, false)
  146. end)