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

Wysłany: 2015-11-08, 12:49


Gerano

Mleko,Kakao,LUA






Wiek: 38
Na forum: 4407 dni
Posty: 187
Nick w MP: Gerano

Piwa: 1460

Respekt: 146,3
Respekt: 146,3

Ostrzeżeń: 100%
Witam mam problem poniewa? mam hud u mnie jest ok a u kolegi jest na ?rodku.Wi?c jak zrobi? aby by? u ka?dego w rogu?

showPlayerHudComponent ( "all", false )
showPlayerHudComponent ( "radar", true)
showPlayerHudComponent ( "wanted", true)

--- Kod na realny czas
local realtime = getRealTime()
    local hour = realtime.hour
    local minute = realtime.minute
    
    addEventHandler("onClientRender", root, function()
    if not getElementData(localPlayer,"player:logged") then return end
    if dxSetAspectRatioAdjustmentEnabled then dxSetAspectRatioAdjustmentEnabled(true) end
    renderHUD() -- ustawia nowy hud
end)

addEventHandler("onClientRender", root,
    function()
x,y = guiGetScreenSize()

        dxDrawRectangle(680 ,0 ,344 ,221 , tocolor(68, 68, 68, 182), false)
        dxDrawRectangle(680,220,344,7, tocolor(17, 107, 219, 254), false)
        dxDrawRectangle(675,0,5,227, tocolor(17, 107, 219, 254), false)
        dxDrawRectangle(680,182,344,28, tocolor(95, 95, 95, 254), false)
        dxDrawText("Pieni?dze: "..getPlayerMoney(localPlayer).." Funt?w ", 680 + 1, 181 + 1, 1024 + 1, 211 + 1, tocolor(0, 0, 0, 255), 2.00, "sans", "left", "center", false, false, false, false, false)
        dxDrawText("Pieni?dze: "..getPlayerMoney(localPlayer).." Funt?w ", 680, 181, 1024, 211, tocolor(35, 127, 23, 254), 2.00, "sans", "left", "center", false, false, false, false, false)
        dxDrawRectangle(855, 19,169, 32, tocolor(150, 0, 0, 254), false)
        dxDrawRectangle(855, 68, 169, 32, tocolor(4, 4, 4, 254), false)
        dxDrawRectangle(855, 120, 169, 44, tocolor(31, 145, 217, 215), false)
        dxDrawText("Czas: "..hour..":"..minute.."", 856 + 1, 121 + 1, 1024 + 1, 164 + 1, tocolor(0, 0, 0, 255), 1.80, "sans", "left", "center", false, false, false, false, false)
        dxDrawText("Czas: "..hour..":"..minute.."", 856, 121, 1024, 164, tocolor(255, 255, 255, 255), 1.80, "sans", "left", "center", false, false, false, false, false)
        dxDrawText("?ycie:"..math.floor(getElementHealth(localPlayer)).. "%", 856 + 1, 20 + 1, 1024 + 1, 51 + 1, tocolor(0, 0, 0, 255), 1.60, "sans", "left", "center", false, false, false, false, false)
        dxDrawText("?ycie:"..math.floor(getElementHealth(localPlayer)).. "%", 856, 20, 1024, 51, tocolor(255, 255, 255, 255), 1.60, "sans", "left", "center", false, false, false, false, false)
        if getPedArmor(localPlayer) > 2 then
        dxDrawText("Pancerz:"..math.floor(getPedArmor(localPlayer)).. "%", 855 + 1, 68 + 1, 1023 + 1, 99 + 1, tocolor(0, 0, 0, 255), 1.60, "sans", "left", "center", false, false, false, false, false)
       dxDrawText("Pancerz:"..math.floor(getPedArmor(localPlayer)).. "%", 855, 68, 1023, 99, tocolor(255, 255, 255, 255), 1.60, "sans", "left", "center", false, false, false, false, false)
       end
         dxDrawImage(693, 21, 152, 143, "i/ikona.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        
        end
)


Podpis
BUDOWA SERWERA: XXX

Prace: XXX%
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-08, 16:15


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4275 dni
Posty: 446
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1034

Respekt: 240
Respekt: 240Respekt: 240

Ostrzeżeń: 60%
"Gerano" napisał/a:

Witam mam problem poniewa? mam hud u mnie jest ok a u kolegi jest na ?rodku.Wi?c jak zrobi? aby by? u ka?dego w rogu?

showPlayerHudComponent ( "all", false )
showPlayerHudComponent ( "radar", true)
showPlayerHudComponent ( "wanted", true)

--- Kod na realny czas
local realtime = getRealTime()
    local hour = realtime.hour
    local minute = realtime.minute
    
    addEventHandler("onClientRender", root, function()
    if not getElementData(localPlayer,"player:logged") then return end
    if dxSetAspectRatioAdjustmentEnabled then dxSetAspectRatioAdjustmentEnabled(true) end
    renderHUD() -- ustawia nowy hud
end)

addEventHandler("onClientRender", root,
    function()
x,y = guiGetScreenSize()

        dxDrawRectangle(680 ,0 ,344 ,221 , tocolor(68, 68, 68, 182), false)
        dxDrawRectangle(680,220,344,7, tocolor(17, 107, 219, 254), false)
        dxDrawRectangle(675,0,5,227, tocolor(17, 107, 219, 254), false)
        dxDrawRectangle(680,182,344,28, tocolor(95, 95, 95, 254), false)
        dxDrawText("Pieni?dze: "..getPlayerMoney(localPlayer).." Funt?w ", 680 + 1, 181 + 1, 1024 + 1, 211 + 1, tocolor(0, 0, 0, 255), 2.00, "sans", "left", "center", false, false, false, false, false)
        dxDrawText("Pieni?dze: "..getPlayerMoney(localPlayer).." Funt?w ", 680, 181, 1024, 211, tocolor(35, 127, 23, 254), 2.00, "sans", "left", "center", false, false, false, false, false)
        dxDrawRectangle(855, 19,169, 32, tocolor(150, 0, 0, 254), false)
        dxDrawRectangle(855, 68, 169, 32, tocolor(4, 4, 4, 254), false)
        dxDrawRectangle(855, 120, 169, 44, tocolor(31, 145, 217, 215), false)
        dxDrawText("Czas: "..hour..":"..minute.."", 856 + 1, 121 + 1, 1024 + 1, 164 + 1, tocolor(0, 0, 0, 255), 1.80, "sans", "left", "center", false, false, false, false, false)
        dxDrawText("Czas: "..hour..":"..minute.."", 856, 121, 1024, 164, tocolor(255, 255, 255, 255), 1.80, "sans", "left", "center", false, false, false, false, false)
        dxDrawText("?ycie:"..math.floor(getElementHealth(localPlayer)).. "%", 856 + 1, 20 + 1, 1024 + 1, 51 + 1, tocolor(0, 0, 0, 255), 1.60, "sans", "left", "center", false, false, false, false, false)
        dxDrawText("?ycie:"..math.floor(getElementHealth(localPlayer)).. "%", 856, 20, 1024, 51, tocolor(255, 255, 255, 255), 1.60, "sans", "left", "center", false, false, false, false, false)
        if getPedArmor(localPlayer) > 2 then
        dxDrawText("Pancerz:"..math.floor(getPedArmor(localPlayer)).. "%", 855 + 1, 68 + 1, 1023 + 1, 99 + 1, tocolor(0, 0, 0, 255), 1.60, "sans", "left", "center", false, false, false, false, false)
       dxDrawText("Pancerz:"..math.floor(getPedArmor(localPlayer)).. "%", 855, 68, 1023, 99, tocolor(255, 255, 255, 255), 1.60, "sans", "left", "center", false, false, false, false, false)
       end
         dxDrawImage(693, 21, 152, 143, "i/ikona.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        
        end
)


Robione GUI-Editorem? Jak tak to pami?tam ?e by?a jaka? opcja do zaznaczenia, ?e element dostosowuje si? do ka?dej rozdzielczo?ci. Je?li nie, to musisz u?y? tego:


Więcej informacji znajdziesz w Wikipedii MTA:

guiGetScreenSize


Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-08, 17:41


AteX







Wiek: 27
Na forum: 4157 dni
Posty: 925
Nick w MP: #AteX

Piwa: 8366

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

Przyk?ad jak to wygl?da u ciebie:
x,y = guiGetScreenSize()

dxDrawRectangle(680 ,0 ,344 ,221 , tocolor(68, 68, 68, 182), false)

A jak to powinno wygl?da?
x,y = guiGetScreenSize()
xm,ym = Xtwojejrozdzielczosci /Ytwojejrozdzielczosci 

dxDrawRectangle(x*680/xm,y*0/ym ,x*344/xm,y*221/ym, tocolor(68, 68, 68, 182), false)


Zrobi?e? to z warto?ciami absolutnymi, wi?c b?dzie to takie d?ugie. M?g?by? te? to napisa? kr?cej warto?ciami od 0 do 1 wtedy wygl?da?oby to tak:

x,y = guiGetScreenSize()

dxDrawRectangle(x*0.23,y*0 ,x*0.34,y*0.53, tocolor(68, 68, 68, 182), false)

Lecz musia?by? teraz od nowa robi? gui. I klikaj?c prawym na elementy w guieditor zmieni? Absolute na Relative.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-11, 09:53


Gerano

Mleko,Kakao,LUA






Wiek: 38
Na forum: 4407 dni
Posty: 187
Nick w MP: Gerano

Piwa: 1460

Respekt: 146,3
Respekt: 146,3

Ostrzeżeń: 100%
AteX, zrobi?em to drugie ale jest b??d ERROR: YRL-Gui attemtp co? takiego


showPlayerHudComponent ( "all", false )
showPlayerHudComponent ( "radar", true)
showPlayerHudComponent ( "wanted", true)

--- Kod na realny czas
local realtime = getRealTime()
    local hour = realtime.hour
    local minute = realtime.minute
    
    addEventHandler("onClientRender", root, function()
    if not getElementData(localPlayer,"player:logged") then return end
    if dxSetAspectRatioAdjustmentEnabled then dxSetAspectRatioAdjustmentEnabled(true) end
    renderHUD() -- ustawia nowy hud
end)

addEventHandler("onClientRender", root,
    function()
x,y = guiGetScreenSize()
xm,ym = 1024 /768


        
dxDrawRectangle(x*680/xm,y*0/ym ,x*344/xm,y*221/ym, tocolor(68, 68, 68, 182), false)
        dxDrawRectangle(x*680/xm,y*220/ym,x*344/xm,y*7/ym, tocolor(17, 107, 219, 254), false)
        dxDrawRectangle(x*675/xm,y*0/ym,x*5/xm,y*227/ym, tocolor(17, 107, 219, 254), false)
        dxDrawRectangle(x*680/xm,y*182/ym,x*344/xm,y*28/ym, tocolor(95, 95, 95, 254), false)
        dxDrawText("Pieni?dze: "..getPlayerMoney(localPlayer).." PLN ", x*680 + 1/xm, y*181 + 1/ym, x*1024 + 1/xm, y*211 + 1/ym, tocolor(0, 0, 0, 255), 2.00, "sans", "left", "center", false, false, false, false, false)
        dxDrawText("Pieni?dze: "..getPlayerMoney(localPlayer).." PLN ", x*680/xm, y*181/ym, x*1024/xm, y*211/ym, tocolor(35, 127, 23, 254), 2.00, "sans", "left", "center", false, false, false, false, false)
        dxDrawRectangle(x*855/xm, y*19/ym,x*169/xm, y*32/ym, tocolor(150, 0, 0, 254), false)
        dxDrawRectangle(x*855/xm, y*68/ym, x*169/xm, y*32/ym, tocolor(4, 4, 4, 254), false)
        dxDrawRectangle(x*855/xm, y*120/ym, x*169/xm, y*44/ym, tocolor(31, 145, 217, 215), false)
        dxDrawText("Czas: "..hour..":"..minute.."", x*856 + 1, y*121 + 1/ym, x*1024 + 1/xm, y*164 + 1/ym, tocolor(0, 0, 0, 255), 1.80, "sans", "left", "center", false, false, false, false, false)
        dxDrawText("Czas: "..hour..":"..minute.."",x*856/xm, y*121/ym, x*1024/xm, y*164/ym, tocolor(255, 255, 255, 255), 1.80, "sans", "left", "center", false, false, false, false, false)
        dxDrawText("?ycie:"..math.floor(getElementHealth(localPlayer)).. "%", x*856 + 1/xm, y*20 + 1/ym, x*1024 + 1/xm, y*51 + 1/ym, tocolor(0, 0, 0, 255), 1.60, "sans", "left", "center", false, false, false, false, false)
        dxDrawText("?ycie:"..math.floor(getElementHealth(localPlayer)).. "%", x*856/xm, y*20/ym, x*1024/xm, y*51/ym, tocolor(255, 255, 255, 255), 1.60, "sans", "left", "center", false, false, false, false, false)
        if getPedArmor(localPlayer) > 2 then
        dxDrawText("Pancerz:"..math.floor(getPedArmor(localPlayer)).. "%", x*855 + 1/xm, y*68 + 1/ym, x*1023 + 1/xm, y*99 + 1/ym, tocolor(0, 0, 0, 255), 1.60, "sans", "left", "center", false, false, false, false, false)
        dxDrawText("Pancerz:"..math.floor(getPedArmor(localPlayer)).. "%", x*855/xm, y*68/ym, x*1023/ym, y*99/ym, tocolor(255, 255, 255, 255), 1.60, "sans", "left", "center", false, false, false, false, false)
       end
       dxDrawImage(x*693/xm, y*21/ym, x*152/xm, y*143/ym, "i/ikona.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        function at ( element, rel  )

        end
        end
)


Podpis
BUDOWA SERWERA: XXX

Prace: XXX%
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-11, 13:20


#404







Wiek: 27
Na forum: 4913 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
    if dxSetAspectRatioAdjustmentEnabled then dxSetAspectRatioAdjustmentEnabled(true) end


Pogubi?e? nawiasy i parametry.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-11, 20:06


Gerano

Mleko,Kakao,LUA






Wiek: 38
Na forum: 4407 dni
Posty: 187
Nick w MP: Gerano

Piwa: 1460

Respekt: 146,3
Respekt: 146,3

Ostrzeżeń: 100%
DestroY, pokaza? by? bo nie rozumiem o co ci chodzi

Podpis
BUDOWA SERWERA: XXX

Prace: XXX%
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-11-11, 20:11


#404







Wiek: 27
Na forum: 4913 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
Gerano, tak na dobr? spraw? to ?le u?y?e? tej funkcji, s?u?y ona do ustawiania, nie do sprawdzania, wi?c w miejsce tej linijki wystarczy samo

dxSetAspectRatioAdjustmentEnabled(true)


Postaw piwo autorowi tego posta
 

 
Tagi: hud :: pod :: każdą :: rozdzielczość
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Hud pod każdą rozdzielczość 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