NameTag Sorunu !

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı By.z3y3

  • Yeni Üye
  • *
    • İleti: 69
: 04 Ağustos 2020, 02:12:34
Merhaba arkadaşlar sunucumda kullanmak için hazırladığım hudda birkaç sorunum varda bu konuda yardımcı olabilir misinz ?

Sorun=  huddaki oyuncuların rengi hepsi aynı kendi renk kodları ile isimlerini gözükmesini nasıl sağlayabilrim.

Kod
local sw,sh = guiGetScreenSize()
local GothaProMed = dxCreateFont("GothaProMed.otf",10)

addEventHandler( "onClientRender", root, function (  )
    for k,player in ipairs(getElementsByType("player")) do
        if player ~= getLocalPlayer() and getElementDimension(getLocalPlayer()) == getElementDimension(player) then
            local x, y, z = getElementPosition(player)
            z = z + 0.95
            local Mx, My, Mz = getCameraMatrix()
            local distance = getDistanceBetweenPoints3D( x, y, z, Mx, My, Mz )
            local size = 1
            if ( distance <= 30 ) then
            local sx,sy = getScreenFromWorldPosition( x, y, z, 0 )
                if ( sx and sy ) then
                    local hp = getElementHealth(player)
                    if hp > 100 then hp = 100 end
                    if hp > 0 then
                        local maxhp = 64
                        local pw,ph = hp*(maxhp/100),5
                        dxDrawImage ( sx-maxhp/2-2, sy-ph/2-2-5, maxhp+4,ph+4, "white.jpg",0,0,0,tocolor(0,0,0,250) )
                        dxDrawImage ( sx-maxhp/2, sy-ph/2-5, pw,ph, "white.jpg",0,0,0,tocolor(255,204,0,255) )
                    end
                   
                    local armor = getPedArmor(player)
                    if armor > 100 then armor = 100 end
                    if armor > 0 then
                        local maxarmor = 64
                        local pw,ph = armor*(maxarmor/100),5
                        dxDrawImage ( sx-maxarmor/2-2, sy-ph/2-2+5, maxarmor+4,ph+4, "white.jpg",0,0,0,tocolor(0,0,0,250) )
                        dxDrawImage ( sx-maxarmor/2, sy-ph/2+5, pw,ph, "white.jpg",0,0,0,tocolor(255,255,255,255) )
                    end
                   
                    local name = getPlayerName(player)
                    if hp > 0 and armor then
                        dxDrawText(name, sx, sy, sx+size, sy+size-10, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                        dxDrawText(name, sx, sy, sx-size, sy-size-10, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                        dxDrawText(name, sx, sy, sx-size, sy+size-10, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                        dxDrawText(name, sx, sy, sx+size, sy-size-10, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                        dxDrawText(name, sx, sy, sx, sy-10, tocolor(255,255,255,255), size, GothaProMed, "center", "bottom", false, false, false)

                        if getElementData(player, "groupTag") == 1 then
                            dxDrawText("Map Editor", sx, sy, sx+size, sy+size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Map Editor", sx, sy, sx-size, sy-size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Map Editor", sx, sy, sx-size, sy+size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Map Editor", sx, sy, sx+size, sy-size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Map Editor", sx, sy, sx, sy-25, tocolor(0,255,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                        elseif getElementData(player, "groupTag") == 2 then
                            dxDrawText("Moderasyon", sx, sy, sx+size, sy+size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Moderasyon", sx, sy, sx-size, sy-size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Moderasyon", sx, sy, sx-size, sy+size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Moderasyon", sx, sy, sx+size, sy-size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Moderasyon", sx, sy, sx, sy-25, tocolor(0,255,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                        elseif getElementData(player, "groupTag") == 3 then
                            dxDrawText("Admin", sx, sy, sx+size, sy+size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Admin", sx, sy, sx-size, sy-size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Admin", sx, sy, sx-size, sy+size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Admin", sx, sy, sx+size, sy-size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Admin", sx, sy, sx, sy-25, tocolor(0,255,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                        end
                    end
                end
            end
        end
    end
end)
 


MTASATURK

NameTag Sorunu !
« : 04 Ağustos 2020, 02:12:34 »

Çevrimdışı shephard^

  • Uzman Üye
  • *
    • İleti: 776
  • decay.
Yanıtla #1 : 04 Ağustos 2020, 02:40:09
Kod
local sw,sh = guiGetScreenSize()
local GothaProMed = dxCreateFont("GothaProMed.otf",10)

addEventHandler( "onClientRender", root, function (  )
    for k,player in ipairs(getElementsByType("player")) do
        if player ~= getLocalPlayer() and getElementDimension(getLocalPlayer()) == getElementDimension(player) then
            local x, y, z = getElementPosition(player)
            z = z + 0.95
            local Mx, My, Mz = getCameraMatrix()
            local distance = getDistanceBetweenPoints3D( x, y, z, Mx, My, Mz )
            local size = 1
local r, g, b = getPlayerNametagColor ( player )
            if ( distance <= 30 ) then
            local sx,sy = getScreenFromWorldPosition( x, y, z, 0 )
                if ( sx and sy ) then
                    local hp = getElementHealth(player)
                    if hp > 100 then hp = 100 end
                    if hp > 0 then
                        local maxhp = 64
                        local pw,ph = hp*(maxhp/100),5
                        dxDrawImage ( sx-maxhp/2-2, sy-ph/2-2-5, maxhp+4,ph+4, "white.jpg",0,0,0,tocolor(0,0,0,250) )
                        dxDrawImage ( sx-maxhp/2, sy-ph/2-5, pw,ph, "white.jpg",0,0,0,tocolor(255,204,0,255) )
                    end
                   
                    local armor = getPedArmor(player)
                    if armor > 100 then armor = 100 end
                    if armor > 0 then
                        local maxarmor = 64
                        local pw,ph = armor*(maxarmor/100),5
                        dxDrawImage ( sx-maxarmor/2-2, sy-ph/2-2+5, maxarmor+4,ph+4, "white.jpg",0,0,0,tocolor(0,0,0,250) )
                        dxDrawImage ( sx-maxarmor/2, sy-ph/2+5, pw,ph, "white.jpg",0,0,0,tocolor(255,255,255,255) )
                    end
                   
                    local name = getPlayerName(player)
                    if hp > 0 and armor then
                        dxDrawText(name, sx, sy, sx+size, sy+size-10, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                        dxDrawText(name, sx, sy, sx-size, sy-size-10, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                        dxDrawText(name, sx, sy, sx-size, sy+size-10, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                        dxDrawText(name, sx, sy, sx+size, sy-size-10, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                        dxDrawText(name, sx, sy, sx, sy-10, tocolor(r, g, b,255), size, GothaProMed, "center", "bottom", false, false, false)

                        if getElementData(player, "groupTag") == 1 then
                            dxDrawText("Map Editor", sx, sy, sx+size, sy+size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Map Editor", sx, sy, sx-size, sy-size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Map Editor", sx, sy, sx-size, sy+size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Map Editor", sx, sy, sx+size, sy-size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Map Editor", sx, sy, sx, sy-25, tocolor(0,255,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                        elseif getElementData(player, "groupTag") == 2 then
                            dxDrawText("Moderasyon", sx, sy, sx+size, sy+size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Moderasyon", sx, sy, sx-size, sy-size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Moderasyon", sx, sy, sx-size, sy+size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Moderasyon", sx, sy, sx+size, sy-size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Moderasyon", sx, sy, sx, sy-25, tocolor(0,255,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                        elseif getElementData(player, "groupTag") == 3 then
                            dxDrawText("Admin", sx, sy, sx+size, sy+size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Admin", sx, sy, sx-size, sy-size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Admin", sx, sy, sx-size, sy+size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Admin", sx, sy, sx+size, sy-size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Admin", sx, sy, sx, sy-25, tocolor(0,255,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                        end
                    end
                end
            end
        end
    end
end)
 


Çevrimdışı By.z3y3

  • Yeni Üye
  • *
    • İleti: 69
Yanıtla #2 : 04 Ağustos 2020, 02:47:35
İsim tamamen gitdi kendi renginden kastım #ff9999Oyuncu gibi yapanlarda renk koduyla beraber gözüksün istiyorum
 


Çevrimdışı EnemyChad

  • Yeni Üye
  • *
    • İleti: 46
    • Sunucum
Yanıtla #3 : 04 Ağustos 2020, 08:16:02
Bunu dene:

Kod
local sw,sh = guiGetScreenSize()
local GothaProMed = dxCreateFont("GothaProMed.otf",10)

addEventHandler( "onClientRender", root, function (  )
    for k,player in ipairs(getElementsByType("player")) do
        if player ~= getLocalPlayer() and getElementDimension(getLocalPlayer()) == getElementDimension(player) then
            local x, y, z = getElementPosition(player)
            z = z + 0.95
            local Mx, My, Mz = getCameraMatrix()
            local distance = getDistanceBetweenPoints3D( x, y, z, Mx, My, Mz )
            local size = 1
            if ( distance <= 30 ) then
            local sx,sy = getScreenFromWorldPosition( x, y, z, 0 )
                if ( sx and sy ) then
                    local hp = getElementHealth(player)
                    if hp > 100 then hp = 100 end
                    if hp > 0 then
                        local maxhp = 64
                        local pw,ph = hp*(maxhp/100),5
                        dxDrawImage ( sx-maxhp/2-2, sy-ph/2-2-5, maxhp+4,ph+4, "white.jpg",0,0,0,tocolor(0,0,0,250) )
                        dxDrawImage ( sx-maxhp/2, sy-ph/2-5, pw,ph, "white.jpg",0,0,0,tocolor(255,204,0,255) )
                    end
                   
                    local armor = getPedArmor(player)
                    if armor > 100 then armor = 100 end
                    if armor > 0 then
                        local maxarmor = 64
                        local pw,ph = armor*(maxarmor/100),5
                        dxDrawImage ( sx-maxarmor/2-2, sy-ph/2-2+5, maxarmor+4,ph+4, "white.jpg",0,0,0,tocolor(0,0,0,250) )
                        dxDrawImage ( sx-maxarmor/2, sy-ph/2+5, pw,ph, "white.jpg",0,0,0,tocolor(255,255,255,255) )
                    end
                   
                    local name = getPlayerName(player)
                    if hp > 0 and armor then
                        local name_noCC = string.gsub(name, "#%x%x%x%x%x%x", "")
                        dxDrawText(name_noCC, sx, sy, sx-size, sy-size-10, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                        dxDrawText(name_noCC, sx, sy, sx-size, sy+size-10, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                        dxDrawText(name_noCC, sx, sy, sx+size, sy-size-10, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                        dxDrawText(name_noCC, sx, sy, sx+size, sy+size-10, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                       
                        dxDrawText(name, sx, sy, sx, sy-10, tocolor(255,255,255,255), size, GothaProMed, "center", "bottom", false, false, false, true)

                        if getElementData(player, "groupTag") == 1 then
                            dxDrawText("Map Editor", sx, sy, sx+size, sy+size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Map Editor", sx, sy, sx-size, sy-size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Map Editor", sx, sy, sx-size, sy+size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Map Editor", sx, sy, sx+size, sy-size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Map Editor", sx, sy, sx, sy-25, tocolor(0,255,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                        elseif getElementData(player, "groupTag") == 2 then
                            dxDrawText("Moderasyon", sx, sy, sx+size, sy+size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Moderasyon", sx, sy, sx-size, sy-size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Moderasyon", sx, sy, sx-size, sy+size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Moderasyon", sx, sy, sx+size, sy-size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Moderasyon", sx, sy, sx, sy-25, tocolor(0,255,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                        elseif getElementData(player, "groupTag") == 3 then
                            dxDrawText("Admin", sx, sy, sx+size, sy+size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Admin", sx, sy, sx-size, sy-size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Admin", sx, sy, sx-size, sy+size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Admin", sx, sy, sx+size, sy-size-25, tocolor(0,0,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                            dxDrawText("Admin", sx, sy, sx, sy-25, tocolor(0,255,0,255), size, GothaProMed, "center", "bottom", false, false, false)
                        end
                    end
                end
            end
        end
    end
end)


Sunucu: Linki görebilmek için Kayıt olun yada Giriş yapın.

NPC ped sistemi: Linki görebilmek için Kayıt olun yada Giriş yapın.
 


Çevrimdışı By.z3y3

  • Yeni Üye
  • *
    • İleti: 69
Yanıtla #4 : 04 Ağustos 2020, 14:00:18
Çok teşekkür ederim halletdim
 


Çevrimdışı MertA178

  • Oh,shit! What is these cringes? These are LUA codes bro! LUA is a terrible scripting language.
  • Deneyimli Üye
  • *
    • İleti: 381
Yanıtla #5 : 12 Ağustos 2020, 17:48:42
Linki görebilmek için Kayıt olun yada Giriş yapın.
Çok teşekkür ederim halletdim
Forsetiyi kuran yanlış mı yapar ayol.
 


MTASATURK

Ynt: NameTag Sorunu !
« Yanıtla #5 : 12 Ağustos 2020, 17:48:42 »