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

Wysłany: 2019-06-21, 22:02


Kulegg







Wiek: 46
Na forum: 3125 dni
Posty: 283

Piwa: 20

Respekt: 50

Siemka,
Mam skrypt z communitymtasa na pokazywanie nick?w pod f11, widzimy nicki graczy na mapie, i powinno by? tak ?e tak samo z kolrkiem je?li mamy nick przyk?adowo r??owy, to na mapie jest nasz nick ale te? r??owy, niestety mi nie ?aduje kodu rgb w skrypcie i nie wiem jak to naprawi?, ss poni?ej:



Kod skryptu:

-- Settings variables
local textFont       "default-bold"            -- The font of the tag text
local textScale      1                        -- The scale of the tag text
local heightPadding  1                        -- The amount of pixels the tag should be extended on either side of the vertical axis
local widthPadding   1                        -- The amount of pixels the tag should be extended on either side of the horizontal axis
local xOffset        8                        -- Distance between the player blip and the tag
local minAlpha       10                        -- If blip alpha falls below thisthe tag won't the shown
local textAlpha      = 255
local rectangleColor = tocolor(0,0,0,230)

-- Other variables
local floor          = math.floor
local w,h            = guiGetScreenSize()

local function drawMapStuff()
    if isPlayerMapVisible() then
        
        local sx,sy,ex,ey     = getPlayerMapBoundingBox()                            -- Map positions
        local mw,mh           = ex-sx,sy-ey                                            -- Map width/height
        local cx,cy           = (sx+ex)/2,(sy+ey)/2                                    -- Center position of the map
        local ppuX,ppuY       = mw/6000,mh/6000                                        -- Pixels per unit
        local fontHeight      = dxGetFontHeight(textScale,textFont)                    -- Height of the specified font
        local yOffset         = fontHeight/2                                        -- How much pixels the tag should be offsetted at
        local blips           = getElementsByType("blip")
        
        for k,v in ipairs(blips) do
            
            local attached=getElementAttachedTo(v)
            
            if isElement(attached) and getElementType(attached)=="player" then
                
                local px,py      = getElementPosition(attached)                        -- Player's position
                local x          floor(cx+px*ppuX+xOffset)                        -- for the nametag
                local y          floor(cy+py*ppuY-yOffset)                        -- for the nametag
                local pname      getPlayerName(attached)                            -- Player name
                local nameLength dxGetTextWidth(pname,textScale,textFont)            -- Width of the playername
                local r,g,b      getPlayerNametagColor(attached)                    -- Player's nametag color
                local _,_,_,a    = getBlipColor(v)                                    -- Blip alpha
                
                if a>minAlpha then
                    
                    dxDrawRectangle(x-widthPadding,y+heightPadding,nameLength+widthPadding*2,fontHeight-heightPadding*2,rectangleColor,false)
                    dxDrawText(pname,x,y,x+nameLength,y+fontHeight,tocolor(r,g,b,textAlpha),textScale,textFont,"left","top",false,false,false)
                    
                end
            end
        end
    end
end
addEventHandler("onClientRender",getRootElement(),drawMapStuff)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-06-22, 08:16


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Czternasty argument funkcji dxDrawText odpowiada za kolorowanie tekstu, ustaw go na true tak jak poni?ej:

dxDrawText(pname,x,y,x+nameLength,y+fontHeight,tocolor(r,g,b,textAlpha),textScale,textFont,"left","top",false,false,false,true)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-06-22, 09:35


Kulegg







Wiek: 46
Na forum: 3125 dni
Posty: 283

Piwa: 20

Respekt: 50

Dzia?a, ale teraz doda? si? jakby kawa?ek czarnego paska



Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-06-22, 10:20


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

local nameLength dxGetTextWidth(pname:gsub("#%x%x%x%x%x%x",""),textScale,textFont)            -- Width of the playername


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Kulegg
Wysłany: 2019-06-22, 10:30


Kulegg







Wiek: 46
Na forum: 3125 dni
Posty: 283

Piwa: 20

Respekt: 50

Dzi?kuje Ci bardzo, dzia?? wszystko pi?knie, piwko dla Ciebie :D :mrgreen:

Postaw piwo autorowi tego posta
 

 
Tagi: nieodczytywanie :: koloru :: rgb :: nickname :: f11
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