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

Wysłany: 2020-11-24, 16:15


NoNamik







Wiek: 35
Na forum: 2185 dni
Posty: 289
Nick w MP: JestemNoNamem

Piwa: 374

Respekt: 60

Witam posiadam skrypt na nametagi lecz jak chce da? vopis i daje przykladowo #FFFF00siema to to siema sie nie koloruje

local sw,sh=guiGetScreenSize()
local timer false

--local nametagFont "default"
local nametagFont dxCreateFont"f/droid-sans.ttf"11)
local auta dxCreateFont"f/droid-sans.ttf"10)
if not nametagFont then nametagFont "default-bold" end
local fontHeight=dxGetFontHeight(1nametagFont)
local nametagScale 1
local nametagAlpha 255
local nametagColor =
{
    255,
    255,
    255
local hp_width=math.floor(sw/20)
if hp_width<50 then hp_width=50 end
local hp_height=math.floor(hp_width/10)

local gsize=sw>800 and 32 or 16


local ourlevel=0
local ourfid=""



setTimer(function()
  ourlevel=getElementData(localPlayer"level") or 0
  ourfid=getElementData(localPlayer"player:faction") or ""
end150000)

function korona()
    local rootxrootyrootz getCameraMatrix()
    for iplayer in ipairs(getElementsByType("player",root,true)) do
        if getElementDimension(localPlayer)==getElementDimension(player) and getElementInterior(localPlayer)==getElementInterior(playerthen
            if getElementAlpha(player) < 1 then
            if not getElementData(localPlayer,"player:admin") == true then return end
            end
            local x,y,getPedBonePosition(player,6)
            if and and z then
                local distance getDistanceBetweenPoints3D(rootxrootyrootzxyz)
                if(distance <= 22then
                    if isLineOfSightClearrootx,rooty,rootzx,y,ztruefalsefalsetruefalsefalsetrue,localPlayer then
                        if getElementData(player,"Ryjek"then
                            if(distance <= 12then
                                dxDrawMaterialLine3D(x,y,z+1.25,x,y,z+0.35,img,1.1,white)
                            end
                        end
                    end
                end
            end
        end
    end
end

addEventHandler("onClientMinimize"root, function()
    localPlayer:setData("player:minimalized"getTickCount())
    localPlayer:setData("player:tick"getTickCount())
    timer Timer(function() localPlayer:setData("player:tick"getTickCount()) end10000)
end)

addEventHandler("onClientRestore"root, function()
    localPlayer:setData("player:minimalized"false)
    if timer and timer.valid then timer:destroy() end
end)

addEventHandler("onClientRender"root, function()
  local rootxrootyrootz getCameraMatrix()--getElementPosition(getLocalPlayer())
        for ivehicle in ipairs(getElementsByType("vehicle"roottrue)) do
            local opis=getElementData(vehicle,"opis")
            local poziom=tonumber(getElementData(vehicle,"poziom"))
            if poziom then
                opis= (opis and opis or "") .. " zape?nienie: " ..math.floor(math.max(math.min(poziom,100),0)+0.5).."%"
            end
            if (opisthen
            local x,y,z=getElementPosition(vehicle)
            local distance getDistanceBetweenPoints3D(rootxrootyrootzxyz)
            local kierowca=getVehicleController(vehicle)
            if (distance<=15 or (kierowca and kierowca==localPlayer)) then
                local sx,sy getScreenFromWorldPosition(x,y,z200)
                if (sx and sythen
                    dxDrawText(opissx-(sw/5),sy,sx+(sw/5),sytocolor(255,255,255,155), 1.0"default-small""center","center",false,true)
                end
            end
            end
        end
        
        local ctrl=getKeyState("lalt") or getKeyState("ralt") or getKeyState("lctrl") or getKeyState("rctrl")

        for iplayer in ipairs(getElementsByType("player",root,true)) do
            if player ~= localPlayer and (getElementAlpha(player)>50 or ourlevel>or getElementDimension(player)==901then
                local x,y,getPedBonePosition(player,8)

                local sxsy getScreenFromWorldPosition(xyz+0.5)
                if sx then
                        local distance getDistanceBetweenPoints3D(rootxrootyrootzxyz)
                        if getElementAlpha(player) < and not getElementData(localPlayer,"player:admin"then
                        return end
                        
                        local name "["..getElementData(player"id").."] "..getPlayerName(player)..""
                        local distance getDistanceBetweenPoints3D(rootxrootyrootzxyz)

                        local fX math.floor(sx)
                        local fY math.floor(sy)

                        local alpha 120

                        if(distance <= 35then
                            local minimalized ""
                            local minimal player:getData("player:minimalized")
                                if minimal then 
                                local tick player:getData("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 "zminimalizowany(a) od: "..godziny.."h "..minuty.."m "..secs.."s" 
                                    end
                            end
                            local org=getElementData(player,"player:organization")
                            if (ctrlthen
                                local fname=getElementData(player"player:faction")
                                if (fnamethen
                                    dxDrawText(fnamefXfY+16fXfY+16tocolor(255,255,255,200), nametagScale*0.9nametagFont"center""center")
                                end
                                if org and org.nazwa then
                                    dxDrawText(org.nazwafXfY+15fXfY+15tocolor0,   0,  0150), nametagScale*1nametagFont"center""center")
                                end
                            end

                            local level tonumber(getElementData(player"player:level"))
                            local p_level tonumber(getElementData(player"premium:level"))
                            if level == 1 then
                                dxDrawText(minimalized..""fXfYfXfYtocolor(255255255255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("["..getElementData(player"id").."] "..getPlayerName(player):gsub("#%x%x%x%x%x%x","")..""fX+1fY+1fX+1fY+1tocolor(0,0,0255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("#FFFFFF[#9ACD32"..getElementData(player"id").."#FFFFFF] #FFFFFF"..getPlayerName(player):gsub("#%x%x%x%x%x%x","")..""fXfYfXfYtocolor(255255255255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("[Supporter]"fX+1fY-15fX+1fY-15tocolor(0,0,0255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("#FFFFFF[#9ACD32Supporter#FFFFFF]"fXfY-16fXfY-16tocolor(255255255255), nametagScalenametagFont"center""center",false,false,false,true,true)
                            elseif level == 2 then
                                dxDrawText(minimalized.."\n\n\n\n\n\n"fXfYfXfYtocolor(255255255255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("["..getElementData(player"id").."] "..getPlayerName(player):gsub("#%x%x%x%x%x%x","")..""fX+1fY+1fX+1fY+1tocolor(0,0,0255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("#FFFFFF[#ff0000"..getElementData(player"id").."#FFFFFF] #FFFFFF"..getPlayerName(player):gsub("#%x%x%x%x%x%x","")..""fXfYfXfYtocolor(255255255255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("[Administrator]"fX+1fY-15fX+1fY-15tocolor(0,0,0255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("#FFFFFF[#ff0000Administrator#FFFFFF]"fXfY-16fXfY-16tocolor(255255255255), nametagScalenametagFont"center""center",false,false,false,true,true)
                            elseif level == 3 then
                                dxDrawText(minimalized.."\n\n\n\n\n\n"fXfYfXfYtocolor(255255255255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("["..getElementData(player"id").."] "..getPlayerName(player):gsub("#%x%x%x%x%x%x","")..""fX+1fY+1fX+1fY+1tocolor(0,0,0255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("#FFFFFF[#a31303"..getElementData(player"id").."#FFFFFF] #FFFFFF"..getPlayerName(player):gsub("#%x%x%x%x%x%x","")..""fXfYfXfYtocolor(255255255255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("[RCON]"fX+1fY-15fX+1fY-15tocolor(0,0,0255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("#FFFFFF[#a31303RCON#FFFFFF]"fXfY-16fXfY-16tocolor(255255255255), nametagScalenametagFont"center""center",false,false,false,true,true)
                            elseif level == 6 then
                                dxDrawText(minimalized.."\n\n\n\n\n\n"fXfYfXfYtocolor(255255255255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("["..getElementData(player"id").."] "..getPlayerName(player):gsub("#%x%x%x%x%x%x","")..""fX+1fY+1fX+1fY+1tocolor(0,0,0255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("#FFFFFF[#b2b807"..getElementData(player"id").."#FFFFFF] #FFFFFF"..getPlayerName(player):gsub("#%x%x%x%x%x%x","")..""fXfYfXfYtocolor(255255255255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("[SPONSOR]"fX+1fY-15fX+1fY-15tocolor(0,0,0255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("#FFFFFF[#b2b807SPONSOR#FFFFFF]"fXfY-16fXfY-16tocolor(255255255255), nametagScalenametagFont"center""center",false,false,false,true,true)
                            elseif level == 4 then
                                dxDrawText(minimalized.."\n\n\n\n\n\n"fXfYfXfYtocolor(255255255255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("["..getElementData(player"id").."] "..getPlayerName(player):gsub("#%x%x%x%x%x%x","")..""fX+1fY+1fX+1fY+1tocolor(0,0,0255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("#FFFFFF[#04d4af"..getElementData(player"id").."#FFFFFF] #FFFFFF"..getPlayerName(player):gsub("#%x%x%x%x%x%x","")..""fXfYfXfYtocolor(255255255255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("[W?a?ciciel]"fX+1fY-15fX+1fY-15tocolor(0,0,0255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("#FFFFFF[#04d4afW?a?ciciel#FFFFFF]"fXfY-16fXfY-16tocolor(255255255255), nametagScalenametagFont"center""center",false,false,false,true,true)
                            elseif level == 5 then
                                dxDrawText(minimalized.."\n\n\n\n\n\n"fXfYfXfYtocolor(255255255255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("["..getElementData(player"id").."] "..getPlayerName(player):gsub("#%x%x%x%x%x%x","")..""fX+1fY+1fX+1fY+1tocolor(0,0,0255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("#FFFFFF[#8F00FF"..getElementData(player"id").."#FFFFFF] #FFFFFF"..getPlayerName(player):gsub("#%x%x%x%x%x%x","")..""fXfYfXfYtocolor(255255255255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("[Opiekun]"fX+1fY-15fX+1fY-15tocolor(0,0,0255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("#FFFFFF[#8F00FFOpiekun#FFFFFF]"fXfY-16fXfY-16tocolor(255255255255), nametagScalenametagFont"center""center",false,false,false,true,true)
                            elseif p_level == 1 then
                                dxDrawText(minimalized.."\n\n\n\n\n\n"fXfYfXfYtocolor(255255255255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("["..getElementData(player"id").."] "..getPlayerName(player):gsub("#%x%x%x%x%x%x","")..""fX+1fY+1fX+1fY+1tocolor(0,0,0255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("#FFFFFF[#f6a104"..getElementData(player"id").."#FFFFFF] #FFFFFF"..getPlayerName(player):gsub("#%x%x%x%x%x%x","")..""fXfYfXfYtocolor(255255255255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("[Premium]"fX+1fY-15fX+1fY-15tocolor(0,0,0255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText("#FFFFFF[#f6a104Premium#FFFFFF]"fXfY-16fXfY-16tocolor(255255255255), nametagScalenametagFont"center""center",false,false,false,true,true)
                            else
                                dxDrawText(""..minimalized.."\n\n["..getElementData(player"id").."] "..getPlayerName(player):gsub("#%x%x%x%x%x%x","")..""fX+1fY+1fX+1fY+1tocolor(0,0,0255), nametagScalenametagFont"center""center",false,false,false,true,true)
                                dxDrawText(""..minimalized.."\n\n#FFFFFF[#FFFFFF"..getElementData(player"id").."#FFFFFF] #FFFFFF"..getPlayerName(player):gsub("#%x%x%x%x%x%x","")..""fXfYfXfYtocolor(255255255255), nametagScalenametagFont"center""center",false,false,false,true,true)
                            end
                            if getElementData(player,"mute:player"then
                            dxDrawText("[Wyciszony]"fX+1fY-31fX+1fY-31tocolor(000alpha), nametagScalenametagFont"center""center",false,false,false,true,true)
                            dxDrawText("#FFFFFF[#FFFF00Wyciszony#FFFFFF]"fXfY-32fXfY-32tocolor(0255255255), nametagScalenametagFont"center""center",false,false,false,true,true)
                            end



                            if ourfid=="SAMC" then -- pokazujemy hp innych graczy
                                dxDrawRectangle(fX-hp_width/2-1fY+fontHeighthp_width+2hp_height+2tocolor(27,27,27,155))
                                local hp=getElementHealth(player)
                                if hp>100 then hp=100 end
                                local hhp_width=(hp*hp_width/100)
                                dxDrawRectangle(fX-hp_width/2fY+fontHeight+1hhp_widthhp_heighttocolor(255,5,5,155))
                            end

                            local opis=getElementData(player"opis")
                            if opis then
                                local alpha=255-getDistanceBetweenPoints2D(sw/2,sh/2,sx,sy)

                                if alpha>5 then
                                    local sxsy getScreenFromWorldPosition(xyz-0.5)
                                    if sx and sy then
                                        dxDrawText(opissx-(sw/10),sy,sx+(sw/10),sytocolor(255,255,255,alpha), 1.0"default-small""center","center",false,true)
                                    end
                                end
                            end
                        end
                end
            end
        end    

        for iped in ipairs(getElementsByType("ped",root,true)) do
            local name=getElementData(ped,"name")
            if name then
                local x,y,getElementPosition(ped)
                local sxsy getScreenFromWorldPosition(xy1)

                if sx then
                    local distance getDistanceBetweenPoints3D(rootxrootyrootzxyz)

                    local fX sx
                    local fY sy

                    local alpha 120

                    if(distance <= and isLineOfSightClear(rootx,rooty,rootz,x,y,z,false,false,false)) then
                        dxDrawText(namefXfYfXfYtocolor(000alpha), nametagScalenametagFont"center""center")                    
                    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 <= 25 then
                    if isLineOfSightClearrootx,rooty,rootzx,y,ztruetruefalsetruefalsetruetrue,vehicle then
                        dxDrawText(desc:gsub("#%x%x%x%x%x%x",""), sx-(sw/10)+1,sy+1,sx+(sw/10)+1,sy+1tocolor(0,0,0,alpha), 1.0auta"center","center",false,true,false,true)
                    dxDrawText(desc:gsub("#%x%x%x%x%x%x",""), sx-(sw/10),sy,sx+(sw/10),sytocolor(255,255,255,alpha), 1.0auta"center","center",false,true,false,true)
                    end
                end
            end
        end
    end
end)

addEventHandler("onClientResourceStart"getResourceRootElement(getThisResource()), 
    function()
        for kv in ipairs(getElementsByType("player")) do
            setPlayerNametagShowing vfalse )
        end
    end
)

addEventHandler("onClientPlayerJoin"root, 
--addEventHandler("onClientPlayerSpawn"getRootElement(), 
    function()
        setPlayerNametagShowing sourcefalse )
    end
)

fileDelete("nametags_c.lua")


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-24, 17:24


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Poczytaj o argumencie 'colorCoded' w funkcji

Więcej informacji znajdziesz w Wikipedii MTA:

dxDrawText


Upewnij si? tak?e, ?e nie usuwasz kodu HEX z wiadomo?ci np. funkcj? string.gsub.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-24, 17:42


NoNamik







Wiek: 35
Na forum: 2185 dni
Posty: 289
Nick w MP: JestemNoNamem

Piwa: 374

Respekt: 60

Ale tu nie chodzi o to ze sie pokazuje
#FF0000siema tylko sie pokazuje samo siema i jest na bialo a powinno byc na czerwono

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-24, 18:15


TheSebaPL

Mod-team






Wiek: 21
Na forum: 3098 dni
Posty: 964

Piwa: 3102

Respekt: 640,5
Respekt: 640,5Respekt: 640,5

Mo?esz tak?e zastosowa? linijki kodu podanego wy?ej np:

                                dxDrawText("#FFFFFF[#9ACD32Supporter#FFFFFF]"fXfY-16fXfY-16tocolor(255255255255), nametagScalenametagFont"center""center",false,false,false,true,true)


Tylko zmieni? pozycje.

A je?eli ju? robi?e? z tym napisem "siema" to poka? kod jak wykona?e?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-24, 20:57


NoNamik







Wiek: 35
Na forum: 2185 dni
Posty: 289
Nick w MP: JestemNoNamem

Piwa: 374

Respekt: 60

dobra ogarnalem podwalilem vehicle:desc od demus i da sie juz kolorowy zrobic vopis

[ Dodano: 2020-11-24, 21:01 ]

        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 isLineOfSightClearrootx,rooty,rootzx,y,ztruetruefalsetruefalsetruetrue,vehicle then
                        dxDrawText(desc:gsub("#%x%x%x%x%x%x",""), sx-(sw/10)+1,sy+1,sx+(sw/10)+1,sy+1tocolor(0,0,0,alpha), 1.0"default-bold""center","center",false,true,true,true)
                    dxDrawText(descsx-(sw/10),sy,sx+(sw/10),sytocolor(255,255,255,alpha), 1.0"default-bold""center","center",false,true,true,true)
                    end
                end
            end
        end
    end
end)    


[ Dodano: 2020-11-24, 21:02 ]
zamykam

Postaw piwo autorowi tego posta
 

 
Tagi: nametagi :: kolorowe
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