Szerző Téma: dxDrawRectangle hp csík méretarányos csökkenése  (Megtekintve 731 alkalommal)

dxDrawRectangle hp csík méretarányos csökkenése
« Dátum: 2016. augusztus 20. - 10:22:10 »
0 Show voters
Sziasztok! Dolgozok egy hudon, viszont abba ütköztem hogy nem tudom megcsinálni azt hogyha már 0 hp-d van akkor csak 100 px megy ugye vissza ( a kód lent lesz ), 328 px-ből! Hogyan lehetne megoldani?
(Kód:)
 
 function component()
            showPlayerHudComponent(\"all\", false)
   showPlayerHudComponent(\"radar\", true)
    end
    addEventHandler(\"onClientResourceStart\", getRootElement(), component)
     
    local screenW, screenH = guiGetScreenSize()
    function all()
             local hp = math.ceil(getElementHealth(localPlayer)) -- Nem tudtam hogyan használjam math.ceil-el vagy annélkül, ha jól tudom ez lekerekíti.
    --local hp = getElementHealth (source)
            local money = getPlayerMoney (source)
   local time = getRealTime()
local hours = time.hour
local minutes = time.minute
setTime (hours, minutes)
       dxDrawText(money..\" FT\", screenW * 0.7297, screenH * 0.1009, screenW * 0.8609, screenH * 0.1259, tocolor(255, 255, 255, 255), 1.00, \"pricedown\", \"left\", \"top\", false, false, false, false, false)
        dxDrawText(\"Blue Gaming System\", 0 - 1, -4 - 1, 330 - 1, 28 - 1, tocolor(0, 0, 0, 255), 1.00, \"bankgothic\", \"left\", \"top\", false, false, false, false, false)
        dxDrawText(\"Blue Gaming System\", 0 + 1, -4 - 1, 330 + 1, 28 - 1, tocolor(0, 0, 0, 255), 1.00, \"bankgothic\", \"left\", \"top\", false, false, false, false, false)
        dxDrawText(\"Blue Gaming System\", 0 - 1, -4 + 1, 330 - 1, 28 + 1, tocolor(0, 0, 0, 255), 1.00, \"bankgothic\", \"left\", \"top\", false, false, false, false, false)
        dxDrawText(\"Blue Gaming System\", 0 + 1, -4 + 1, 330 + 1, 28 + 1, tocolor(0, 0, 0, 255), 1.00, \"bankgothic\", \"left\", \"top\", false, false, false, false, false)
        dxDrawText(\"Blue Gaming System\", 0, -5, 330, 27, tocolor(43, 35, 171, 255), 1.00, \"bankgothic\", \"left\", \"top\", false, false, false, false, false)
        dxDrawText(hours..\":\"..minutes, screenW * 0.9052, screenH * 0.0231, screenW * 0.9370, screenH * 0.0491, tocolor(255, 255, 255, 255), 1.00, \"pricedown\", \"right\", \"center\", false, false, false, false, false)
        dxDrawLine((screenW * 0.7297) - 1, (screenH * 0.0231) - 1, (screenW * 0.7297) - 1, screenH * 0.0361, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(screenW * 0.9000, (screenH * 0.0231) - 1, (screenW * 0.7297) - 1, (screenH * 0.0231) - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine((screenW * 0.7297) - 1, screenH * 0.0361, screenW * 0.9000, screenH * 0.0361, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(screenW * 0.9000, screenH * 0.0361, screenW * 0.9000, (screenH * 0.0231) - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawRectangle(screenW * 0.7297, screenH * 0.0231, screenW * 0.1703, screenH * 0.0130, tocolor(73, 0, 0, 255), false)
        dxDrawLine((screenW * 0.7297) - 1, (screenH * 0.0231) - 1, (screenW * 0.7297) - 1, screenH * 0.0361, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(screenW * 0.9000, (screenH * 0.0231) - 1, (screenW * 0.7297) - 1, (screenH * 0.0231) - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine((screenW * 0.7297) - 1, screenH * 0.0361, screenW * 0.9000, screenH * 0.0361, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(screenW * 0.9000, screenH * 0.0361, screenW * 0.9000, (screenH * 0.0231) - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawRectangle(screenW * 0.7297, screenH * 0.0231, screenW * 0.1703, screenH * 0.0130, tocolor(73, 0, 0, 255), false) -- hp alatti csík
        dxDrawRectangle(screenW * 0.7297, screenH * 0.0231,  hp+228, screenH * 0.0130, tocolor(243, 0, 0, 255), false) -- hp
        dxDrawLine((screenW * 0.7297) - 1, (screenH * 0.0417) - 1, (screenW * 0.7297) - 1, screenH * 0.0546, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(screenW * 0.9000, (screenH * 0.0417) - 1, (screenW * 0.7297) - 1, (screenH * 0.0417) - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine((screenW * 0.7297) - 1, screenH * 0.0546, screenW * 0.9000, screenH * 0.0546, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(screenW * 0.9000, screenH * 0.0546, screenW * 0.9000, (screenH * 0.0417) - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawRectangle(screenW * 0.7297, screenH * 0.0417, screenW * 0.1703, screenH * 0.0130, tocolor(15, 19, 65, 255), false)
        dxDrawLine((screenW * 0.7297) - 1, (screenH * 0.0602) - 1, (screenW * 0.7297) - 1, screenH * 0.0731, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(screenW * 0.9000, (screenH * 0.0602) - 1, (screenW * 0.7297) - 1, (screenH * 0.0602) - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine((screenW * 0.7297) - 1, screenH * 0.0731, screenW * 0.9000, screenH * 0.0731, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(screenW * 0.9000, screenH * 0.0731, screenW * 0.9000, (screenH * 0.0602) - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawRectangle(screenW * 0.7297, screenH * 0.0602, screenW * 0.1703, screenH * 0.0130, tocolor(92, 52, 23, 255), false)
        dxDrawRectangle(screenW * 0.7297, screenH * 0.0417, screenW * 0.1703, screenH * 0.0130, tocolor(52, 65, 208, 255), false)
        dxDrawRectangle(screenW * 0.7297, screenH * 0.0602, screenW * 0.1703, screenH * 0.0130, tocolor(188, 106, 47, 255), false)
        dxDrawLine((screenW * 0.7297) - 1, (screenH * 0.0787) - 1, (screenW * 0.7297) - 1, screenH * 0.0917, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(screenW * 0.9000, (screenH * 0.0787) - 1, (screenW * 0.7297) - 1, (screenH * 0.0787) - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine((screenW * 0.7297) - 1, screenH * 0.0917, screenW * 0.9000, screenH * 0.0917, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(screenW * 0.9000, screenH * 0.0917, screenW * 0.9000, (screenH * 0.0787) - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawRectangle(screenW * 0.7297, screenH * 0.0787, screenW * 0.1703, screenH * 0.0130, tocolor(8, 47, 8, 255), false)
        dxDrawRectangle(screenW * 0.7297, screenH * 0.0787, screenW * 0.1703, screenH * 0.0130, tocolor(32, 188, 32, 255), false)
dxDrawImage(1372, 23, 29, 22, \"hpicon.png\", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(1373, 44, 28, 21, \"italicon.png\", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(1372, 65, 29, 16, \"kajaicon.png\", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(1372, 85, 27, 14, \"pancelicon.png\", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    end
    addEventHandler(\"onClientRender\", getRootElement(), all)
 


dxDrawRectangle hp csík méretarányos csökkenése
« Válasz #1 Dátum: 2016. augusztus 20. - 10:29:42 »
0 Show voters
Szerintem math.ceil nélkül használd, pontosabb.
3.28 * hp

dxDrawRectangle hp csík méretarányos csökkenése
« Válasz #2 Dátum: 2016. augusztus 20. - 10:39:06 »
0 Show voters
Kiprobálom köszike!

Dupla hozzászólás automatikusan összefûzve. ( [time]2016. augusztus 20. 10:43:03[/time] )

Amikor elinditom a hud-ot akkor minden villog. Ez csak nálam van igy?

Dupla hozzászólás automatikusan összefûzve. ( 2016. augusztus 20. - 10:44:20 )

reconnect moglodtta köszönöm!  :smokin:
« Utoljára szerkesztve: 2016. augusztus 20. - 10:44:20 írta thegergo02 »

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal