Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2017-03-14, 19:09


lukas60055







Wiek: 25
Na forum: 4058 dni
Posty: 53
Nick w MP: Lukasino



Respekt: 75,3

Nie wiem jak zrobic zeby widziec nametagi przez np.klatke
Moze ktos pomoc





--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 nametagScale = 0.5
local nametagScale2 = 0.58
local nametagAlpha = 180
local nametagColor =
{
    r = 255,
    g = 255,
    b = 255
} 

local obkrecaj= math.sin(getTickCount()/515)*15

-- Funkcja nametag?w graczy i pojazd?w
-- zazwyczaj s? dla u?atwienia wygl?du.
addEventHandler("onClientRender", root, function()
        local rootx, rooty, rootz = getCameraMatrix()--getElementPosition(getLocalPlayer())
        for i, player in ipairs(getElementsByType("player",root,true)) do
            if  player ~= localPlayer and getElementDimension(localPlayer)==getElementDimension(player) and getElementInterior(localPlayer)==getElementInterior(player) and getElementAlpha(player)>1 then
                local x,y,z = getPedBonePosition(player,8)
                local sx, sy = getScreenFromWorldPosition(x, y, z+0.43)
                local sxc,syc =getScreenFromWorldPosition(x, y, z+0.50)
                local srx,sry =getScreenFromWorldPosition(x, y, z-0.5)            
                local sxw, syw=getScreenFromWorldPosition(x, y, z+0.60)
                if sx and sy and sxc and syc and sxw and syw then
                local distance = getDistanceBetweenPoints3D(rootx, rooty, rootz, x, y, z)                 
                if(distance <= 22) then
                  if isLineOfSightClear( rootx,rooty,rootz, x,y,z, true, false, false, true, false, false, true,localPlayer ) then
                    local name =""..getPlayerName(player).."("..getElementData(player,"id")..")"
                    local namep=""..getPlayerName(player).."("..getElementData(player,"id")..")"
                    local level = tonumber(getElementData(player, "player:level"))
                                        if not getElementData(player,"p:inv") then 
                    if level == 1 then
                    end
                    if level == 2 then
                    end
                    if level == 3 then
                    end
                    if getElementData(player,"player:premium") then
                        else

                    end

                                       
                    dxDrawText (name,sx+1, sy+1, sx+1, sy+1,tocolor(255,255,255,255),nametagScale,nametagFont,"center","center",false,false,false,true,true,0,0,-50 )
                    --dxDrawText (name,sx+1, sy+1, sx+1, sy+1,white,nametagScale,nametagFont,"center","center",false,false,false,true,true )
                    --    dxDrawText(name, sx+1, sy+1, sx+1, sy+1, tocolor(0, 0, 0, alpha), nametagScale, nametagFont, "center", "center",false,false,false,false,true)
                        --dxDrawText(name, sx, sy, sx, sy, tocolor(255, 255, 255, alpha), nametagScale, nametagFont, "center", "center",false,false,false,false,true)
                    --dxDrawText(name, sx-1, sy-1, sx-1, sy-1, tocolor( 0, 0, 0, 255), 1.5-distance/15, "default-bold", "center", "center")
                    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
                    local desc=getElementData(player,"player:desc")
                    if desc then
                        local distance = getDistanceBetweenPoints3D(rootx,rooty,rootz,x,y,z)
                        if distance <= 18 then
                            dxDrawText(desc:gsub("#%x%x%x%x%x%x",""), srx, sry, srx, sry, tocolor(255, 255, 255, 170), 0.65, vopisFont, "center", "center")
                        end
                    end
                  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 veh = getPedOccupiedVehicle(localPlayer)
                local distance=getDistanceBetweenPoints3D(rootx,rooty,rootz,x,y,z)
                if distance <= 40 then
                    if isLineOfSightClear( rootx,rooty,rootz, x,y,z, true, true, false, true, false, true, true,vehicle ) then
                    dxDrawText(desc:gsub("#%x%x%x%x%x%x",""), sx, sy, sx, sy, tocolor(0, 0, 0, 255), 1, "default", "center", "center")
                    dxDrawText(desc:gsub("#%x%x%x%x%x%x",""), sx, sy, sx, sy, tocolor(255, 255, 255, 255), 1, "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)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-03-14, 21:45


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4290 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4661

Respekt: 1436,8
Respekt: 1436,8

--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 nametagScale = 0.5
local nametagScale2 = 0.58
local nametagAlpha = 180
local nametagColor =
{
    r = 255,
    g = 255,
    b = 255
} 

local obkrecaj= math.sin(getTickCount()/515)*15

-- Funkcja nametag?w graczy i pojazd?w
-- zazwyczaj s? dla u?atwienia wygl?du.
addEventHandler("onClientRender", root, function()
        local rootx, rooty, rootz = getCameraMatrix()--getElementPosition(getLocalPlayer())
        for i, player in ipairs(getElementsByType("player",root,true)) do
            if  player ~= localPlayer and getElementDimension(localPlayer)==getElementDimension(player) and getElementInterior(localPlayer)==getElementInterior(player) and getElementAlpha(player)>1 then
                local x,y,z = getPedBonePosition(player,8)
                local sx, sy = getScreenFromWorldPosition(x, y, z+0.43)
                local sxc,syc =getScreenFromWorldPosition(x, y, z+0.50)
                local srx,sry =getScreenFromWorldPosition(x, y, z-0.5)            
                local sxw, syw=getScreenFromWorldPosition(x, y, z+0.60)
                if sx and sy and sxc and syc and sxw and syw then
                local distance = getDistanceBetweenPoints3D(rootx, rooty, rootz, x, y, z)                 
                if(distance <= 22) then
                --  if isLineOfSightClear( rootx,rooty,rootz, x,y,z, true, false, false, true, false, false, true,localPlayer ) then
                    local name =""..getPlayerName(player).."("..getElementData(player,"id")..")"
                    local namep=""..getPlayerName(player).."("..getElementData(player,"id")..")"
                    local level = tonumber(getElementData(player, "player:level"))
                                        if not getElementData(player,"p:inv") then 
                    if level == 1 then
                    end
                    if level == 2 then
                    end
                    if level == 3 then
                    end
                    if getElementData(player,"player:premium") then
                        else

                    end

                                       
                    dxDrawText (name,sx+1, sy+1, sx+1, sy+1,tocolor(255,255,255,255),nametagScale,nametagFont,"center","center",false,false,false,true,true,0,0,-50 )
                    --dxDrawText (name,sx+1, sy+1, sx+1, sy+1,white,nametagScale,nametagFont,"center","center",false,false,false,true,true )
                    --    dxDrawText(name, sx+1, sy+1, sx+1, sy+1, tocolor(0, 0, 0, alpha), nametagScale, nametagFont, "center", "center",false,false,false,false,true)
                        --dxDrawText(name, sx, sy, sx, sy, tocolor(255, 255, 255, alpha), nametagScale, nametagFont, "center", "center",false,false,false,false,true)
                    --dxDrawText(name, sx-1, sy-1, sx-1, sy-1, tocolor( 0, 0, 0, 255), 1.5-distance/15, "default-bold", "center", "center")
                    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
                    local desc=getElementData(player,"player:desc")
                    if desc then
                        local distance = getDistanceBetweenPoints3D(rootx,rooty,rootz,x,y,z)
                        if distance <= 18 then
                            dxDrawText(desc:gsub("#%x%x%x%x%x%x",""), srx, sry, srx, sry, tocolor(255, 255, 255, 170), 0.65, vopisFont, "center", "center")
             --           end
                    end
                  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 veh = getPedOccupiedVehicle(localPlayer)
                local distance=getDistanceBetweenPoints3D(rootx,rooty,rootz,x,y,z)
                if distance <= 40 then
                   -- if isLineOfSightClear( rootx,rooty,rootz, x,y,z, true, true, false, true, false, true, true,vehicle ) then
                    dxDrawText(desc:gsub("#%x%x%x%x%x%x",""), sx, sy, sx, sy, tocolor(0, 0, 0, 255), 1, "default", "center", "center")
                    dxDrawText(desc:gsub("#%x%x%x%x%x%x",""), sx, sy, sx, sy, tocolor(255, 255, 255, 255), 1, "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)


Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Tagi: widzenie :: nametaga :: przez :: klatke
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku