Szerző Téma: dxDrawRectlange  (Megtekintve 656 alkalommal)

dxDrawRectlange
« Dátum: 2017. December 22. - 21:38:38 »
0
 
 
Sziasztok! Van egy dxDrawRectlange gombom. onClientClick event handlert, illeve egy function is csináltam már, amibe beleírtam, hol a box, viszont sajnálatos módon nem érzékeli, miért lehet ez? Illetve van egy IsCursorInPosition function-om is, ami annyit csinál, ha valaki ráteszi az egeret szin1-ről szin 2-re változik, majd ha valaki elveszi, akkor vissza. Ez se működik, sőt, még a rectlange is eltűnik. 
 

addEventHandler(\"onClientRender\", root,
    function()
        dxDrawRectangle((screenW - 243) / 2, (screenH - 353) / 2, 243, 353, tocolor(0, 0, 0, 110), false)
        dxDrawRectangle(562, 208, 243, 17, tocolor(0, 0, 0, 110), false)
        dxDrawRectangle(574, 259, 221, 30, tocolor(0, 0, 0, 130), false)
        dxDrawRectangle(574, 311, 221, 30, tocolor(0, 0, 0, 130), false)
        dxDrawRectangle(574, 385, 221, 30, tocolor(0, 0, 0, 130), false)
        dxDrawRectangle(574, 429, 221, 30, (isCursorInPosition(574, 429, 221, 30) and tocolor(255, 0, 0) or tocolor(0, 255, 0)))
        dxDrawText(\"Üdv az #4286f4Immortal Gaming #ffffffszerverén!\\nKérlek #ff6363 regisztrálj #ffffff vagy #4286f4jelentkezz be!\\n\\n#ffffffTovábbi jó játékot kívánunk!\", 576, 481, 795, 533, tocolor(255, 255, 255, 255), 1.00, \"default-bold\", \"center\", \"center\", false, false, false, true, false)
        dxDrawRectangle(438, 451, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawText(\"#4286f4Bejelentkezés\", 562, 208, 805, 224, tocolor(255, 255, 255, 255), 1.00, \"default-bold\", \"center\", \"center\", false, false, false, true, false)
        dxDrawText(\"Felhasználónév\", 620, 240, 746, 259, tocolor(255, 255, 255, 255), 1.00, \"default-bold\", \"center\", \"center\", false, false, false, false, false)
        dxDrawText(\"Jelszó\", 620, 292, 746, 311, tocolor(255, 255, 255, 255), 1.00, \"default-bold\", \"center\", \"center\", false, false, false, false, false)
        dxDrawText(\"Bejelentkezés\", 620, 390, 746, 409, tocolor(255, 255, 255, 255), 1.00, \"default-bold\", \"center\", \"center\", false, false, false, false, false)
        dxDrawText(\"Regisztráció\", 620, 435, 746, 454, tocolor(255, 255, 255, 255), 1.00, \"default-bold\", \"center\", \"center\", false, false, false, false, false)
        showPlayerHudComponentVisible(\"all\", false)
    end
)
addEventHandler(\"onClientClick\", getRootElement(), onClickCucc)
function onClickCucc(absoluteX, absoluteY, worldX, worldY, worldZ)
    if (absoluteX >= 574) and (absoluteX <= 574+221) and (absoluteY >= 311) and (absoluteY <= 311+30) then
        outputChatBox(\"Ráböktél a gombra\")
    end
    if (absoluteX >= x) and (absoluteX <= x+szelesseg) and (absoluteY >= y) and (absoluteY <= y+magassag) then
        outputChatBox(\"Ráböktél a másk gombra\")
    end
end
function isCursorInPosition(rectX, rectY, rectW, rectH)
local cursorX, cursorY = getCursorPosition()
cursorX, cursorY = cursorX * screenWidth, cursorY * screenHeight
return (cursorX >= rectX and cursorX <= rectX+rectW) and (cursorY >= rectY and cursorY <= rectY+rectH)
end
« Utoljára szerkesztve: 2017. December 22. - 21:57:09 írta xerox0224 »

dxDrawRectlange
« Válasz #1 Dátum: 2017. December 22. - 23:22:13 »
0
Az IsCursorInPosition megoldódott, viszont sajnos a kattintás nem. 
 


addEventHandler(\"onClientRender\", root,
    function()
        dxDrawRectangle((screenW - 243) / 2, (screenH - 353) / 2, 243, 353, tocolor(0, 0, 0, 110), false)
        dxDrawRectangle(562, 208, 243, 17, tocolor(0, 0, 0, 110), false)
        dxDrawRectangle(574, 259, 221, 30, tocolor(0, 0, 0, 130), false)
        dxDrawRectangle(574, 311, 221, 30, tocolor(0, 0, 0, 130), false)
        dxDrawRectangle(574, 385, 221, 30, (isCursorInPosition(574, 385, 221, 30) and tocolor(66, 134, 244, 130) or tocolor(0, 0, 0, 130)))
        dxDrawRectangle(574, 429, 221, 30, (isCursorInPosition(574, 429, 221, 30) and tocolor(244, 65, 65, 130) or tocolor(0, 0, 0, 130)))
        dxDrawText(\"Üdv az #4286f4Immortal Gaming #ffffffszerverén!\\nKérlek #ff6363 regisztrálj #ffffff vagy #4286f4jelentkezz be!\\n\\n#ffffffTovábbi jó játékot kívánunk!\", 576, 481, 795, 533, tocolor(255, 255, 255, 255), 1.00, \"default-bold\", \"center\", \"center\", false, false, false, true, false)
        dxDrawRectangle(438, 451, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawText(\"#4286f4Bejelentkezés\", 562, 208, 805, 224, tocolor(255, 255, 255, 255), 1.00, \"default-bold\", \"center\", \"center\", false, false, false, true, false)
        dxDrawText(\"Felhasználónév\", 620, 240, 746, 259, tocolor(255, 255, 255, 255), 1.00, \"default-bold\", \"center\", \"center\", false, false, false, false, false)
        dxDrawText(\"Jelszó\", 620, 292, 746, 311, tocolor(255, 255, 255, 255), 1.00, \"default-bold\", \"center\", \"center\", false, false, false, false, false)
        dxDrawText(\"Bejelentkezés\", 620, 390, 746, 409, tocolor(255, 255, 255, 255), 1.00, \"default-bold\", \"center\", \"center\", false, false, false, false, false)
        dxDrawText(\"Regisztráció\", 620, 435, 746, 454, tocolor(255, 255, 255, 255), 1.00, \"default-bold\", \"center\", \"center\", false, false, false, false, false)
        showPlayerHudComponentVisible(\"all\", false)
        addEventHandler(\"onClientClick\", getRootElement(), onClickCucc)
    end
)
function isCursorInPosition(rectX, rectY, rectW, rectH)
    local cursorX, cursorY = getCursorPosition()
    cursorX, cursorY = cursorX * screenWidth, cursorY * screenHeight
    return (cursorX >= rectX and cursorX <= rectX+rectW) and (cursorY >= rectY and cursorY <= rectY+rectH)
end
function onClickCucc(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement)
    if (state == \"down\") then
        if (absoluteX >= 574) and (absoluteX <= 574+221) and (absoluteY >= 385) and (absoluteY <= 385+30) then
            outputChatBox(\"Ráböktél a gombra\")
        end
    end
end

Nem elérhető Live

  • 507
    • Profil megtekintése
dxDrawRectlange
« Válasz #2 Dátum: 2017. December 22. - 23:59:22 »
0

addEventHandler(\"onClientRender\", root,
    function()
        dxDrawRectangle((screenW - 243) / 2, (screenH - 353) / 2, 243, 353, tocolor(0, 0, 0, 110), false)
        dxDrawRectangle(562, 208, 243, 17, tocolor(0, 0, 0, 110), false)
        dxDrawRectangle(574, 259, 221, 30, tocolor(0, 0, 0, 130), false)
        dxDrawRectangle(574, 311, 221, 30, tocolor(0, 0, 0, 130), false)
        dxDrawRectangle(574, 385, 221, 30, tocolor(0, 0, 0, 130), false)
        dxDrawRectangle(574, 429, 221, 30, (isCursorInPosition(574, 429, 221, 30) and tocolor(255, 0, 0) or tocolor(0, 255, 0)))
        dxDrawText(\"Üdv az #4286f4Immortal Gaming #ffffffszerverén!\\nKérlek #ff6363 regisztrálj #ffffff vagy #4286f4jelentkezz be!\\n\\n#ffffffTovábbi jó játékot kívánunk!\", 576, 481, 795, 533, tocolor(255, 255, 255, 255), 1.00, \"default-bold\", \"center\", \"center\", false, false, false, true, false)
        dxDrawRectangle(438, 451, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawText(\"#4286f4Bejelentkezés\", 562, 208, 805, 224, tocolor(255, 255, 255, 255), 1.00, \"default-bold\", \"center\", \"center\", false, false, false, true, false)
        dxDrawText(\"Felhasználónév\", 620, 240, 746, 259, tocolor(255, 255, 255, 255), 1.00, \"default-bold\", \"center\", \"center\", false, false, false, false, false)
        dxDrawText(\"Jelszó\", 620, 292, 746, 311, tocolor(255, 255, 255, 255), 1.00, \"default-bold\", \"center\", \"center\", false, false, false, false, false)
        dxDrawText(\"Bejelentkezés\", 620, 390, 746, 409, tocolor(255, 255, 255, 255), 1.00, \"default-bold\", \"center\", \"center\", false, false, false, false, false)
        dxDrawText(\"Regisztráció\", 620, 435, 746, 454, tocolor(255, 255, 255, 255), 1.00, \"default-bold\", \"center\", \"center\", false, false, false, false, false)
        showPlayerHudComponentVisible(\"all\", false)
    end
)
addEventHandler(\"onClientClick\", getRootElement(),
function(button, state, absoluteX, absoluteY, worldX, worldY, worldZ)
   if button == \"left\" and state == \"up\" then
      if (absoluteX >= 574) and (absoluteX <= 574+221) and (absoluteY >= 311) and (absoluteY <= 311+30) then
         outputChatBox(\"Ráböktél a gombra\")
      end
      if (absoluteX >= x) and (absoluteX <= x+szelesseg) and (absoluteY >= y) and (absoluteY <= y+magassag) then
         outputChatBox(\"Ráböktél a másk gombra\")
      end
   end
end
)
function isCursorInPosition(rectX, rectY, rectW, rectH)
local cursorX, cursorY = getCursorPosition()
cursorX, cursorY = cursorX * screenWidth, cursorY * screenHeight
return (cursorX >= rectX and cursorX <= rectX+rectW) and (cursorY >= rectY and cursorY <= rectY+rectH)
end

 
 
« Utoljára szerkesztve: 2017. December 23. - 00:01:00 írta Live »

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal