iiv03 Posted May 19, 2019 Share Posted May 19, 2019 (edited) مشكله هنا ابغى حل الي ابغاه انه اذا ضغطت علي الزر يجي النص المشكله هنا كل ماضغط علي الزر يجي النص و يختفي ليه؟ if isMouseInPosition (187*sx, 50*sy, 74*sx, 27*sy) then dxDrawRectangle(159*sx, 95*sy, 128*sx, 1*sy, tocolor(255, 255, 255, 255), false) if getKeyState("mouse1") and not stateKey then dxDrawText("TEST", 372*sx, 244*sy, 938*sx, 329*sy, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end else dxDrawRectangle(159*sx, 95*sy, 128*sx, 1*sy, tocolor(255, 255, 255, 80), false) end Edited May 19, 2019 by liwahadri Link to comment
N3xT Posted May 19, 2019 Share Posted May 19, 2019 (edited) sx + sy بما ان كودك غير مطروح بالكامل, لا تنسى تتأكد من تعريف local showText = false addEventHandler ( "onClientRender", root, function ( ) dxDrawRectangle(159*sx, 95*sy, 128*sx, 1*sy, tocolor(255, 255, 255, 255), false) dxDrawText("TEST", 372*sx, 244*sy, 938*sx, 329*sy, tocolor(255, 255, 255, showText and 255 or 0), 1.00, "default", "left", "top", false, false, false, false, false) end ) addEventHandler ( "onClientClick", root, function ( button, state ) if ( button == "left" and state == "down" ) then if ( isMouseInPosition ( 159*sx, 95*sy, 128*sx, 1*sy ) ) then showText = not showText end end end ) Edited May 19, 2019 by N3xT 1 Link to comment
iiv03 Posted May 19, 2019 Author Share Posted May 19, 2019 10 minutes ago, N3xT said: sx + sy بما ان كودك غير مطروح بالكامل, لا تنسى تتأكد من تعريف local showText = false addEventHandler ( "onClientRender", root, function ( ) dxDrawRectangle(159*sx, 95*sy, 128*sx, 1*sy, tocolor(255, 255, 255, 255), false) if ( showText == true ) then dxDrawText("TEST", 372*sx, 244*sy, 938*sx, 329*sy, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end end ) addEventHandler ( "onClientClick", root, function ( button, state ) if ( button == "left" and state == "down" ) then if ( isMouseInPosition ( 159*sx, 95*sy, 128*sx, 1*sy ) ) then showText = not showText end end end ) unexpected symbol near' local showText = false Link to comment
N3xT Posted May 19, 2019 Share Posted May 19, 2019 الكود شغال عندي local showText = false addEventHandler ( "onClientRender", root, function ( ) dxDrawRectangle(159, 95, 128, 5, tocolor(255, 255, 255, 255), false) dxDrawText("TEST", 372, 244, 938, 329, tocolor(255, 255, 255, showText and 255 or 0), 1.00, "default", "left", "top", false, false, false, false, false) end ) addEventHandler ( "onClientClick", root, function ( button, state ) if ( button == "left" and state == "down" ) then if ( isMouseInPosition ( 159, 95, 128, 5 ) ) then showText = not showText end end end ) function isMouseInPosition ( x, y, width, height ) if ( not isCursorShowing( ) ) then return false end local sx, sy = guiGetScreenSize ( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx * sx ), ( cy * sy ) if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then return true else return false end end Link to comment
iiv03 Posted May 19, 2019 Author Share Posted May 19, 2019 21 minutes ago, N3xT said: الكود شغال عندي local showText = false addEventHandler ( "onClientRender", root, function ( ) dxDrawRectangle(159, 95, 128, 5, tocolor(255, 255, 255, 255), false) dxDrawText("TEST", 372, 244, 938, 329, tocolor(255, 255, 255, showText and 255 or 0), 1.00, "default", "left", "top", false, false, false, false, false) end ) addEventHandler ( "onClientClick", root, function ( button, state ) if ( button == "left" and state == "down" ) then if ( isMouseInPosition ( 159, 95, 128, 5 ) ) then showText = not showText end end end ) function isMouseInPosition ( x, y, width, height ) if ( not isCursorShowing( ) ) then return false end local sx, sy = guiGetScreenSize ( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx * sx ), ( cy * sy ) if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then return true else return false end end local sx, sy = guiGetScreenSize() sx, sy = ( sx / 1280 ), ( sy / 720 ) local showText = false function paneldx() local playername = getPlayerName(getLocalPlayer()) local w2 = dxGetTextWidth(playername,4.00,fonts["normal"][2],false) dxDrawImage(0,0, 1280*sy, 720*sx, ":guieditor/images/rank.png", 0, 0, 0, tocolor(200, 200,200, 255), false) dxDrawLine(129*sx, 95*sy, 1280*sx, 95*sy, tocolor(255, 255, 255, 80), 1, false) dxDrawLine(129*sx, 96*sy, 129*sx, 720*sy, tocolor(255, 255, 255, 80), 1, false) dxDrawText("News", 146*sx, 27*sy, 301*sx, 95*sy, tocolor(255, 255, 255, 255), 2.40, "defaul-bold", "center", "center", false, false, true, false, false) dxDrawText("TEST", 372, 244, 938, 329, tocolor(255, 255, 255, showText and 255 or 0), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("Soon", 301*sx, 27*sy, 456*sx, 95*sy, tocolor(255, 255, 255, 255), 2.40, "defaul-bold", "center", "center", false, false, true, false, false) dxDrawText("Soon", 456*sx, 27*sy, 611*sx, 95*sy, tocolor(255, 255, 255, 255), 2.40, "defaul-bold", "center", "center", false, false, true, false, false) _dxDrawRectangleRounded(928*sx, 19*sy, 335*sx, 58*sy, tocolor(0, 0, 0, 190), false) _dxDrawRectangle(928*sx, 19*sy, 335*sx, 58*sy, tocolor(0, 0, 0, 190), false) dxDrawText(playername, s*0.7850,y*-0.8700,s,y, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "center", false, false, false, true, false) dxDrawImage(931*sx, 22*sy, 58*sx, 51*sy, ":guieditor/images/default-avatar.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) end addEventHandler ( "onClientClick", root, function ( button, state ) if ( button == "left" and state == "down" ) then if ( isMouseInPosition ( 159, 95, 128, 5 ) ) then end end end ) setTimer ( function() if removeEventHandler("onClientRender", root,render) then addEventHandler("onClientRender", root, tworender) else removeEventHandler("onClientRender", root, tworender) addEventHandler("onClientRender", root, paneldx) end end,1000,0) end expected near ' dxDrawText("TEST", 372, 244, 938, 329, tocolor(255, 255, 255, showText and 255 or 0), 1.00, "default", "left", "top", false, false, false, false, false) حاولت ادور حل مالقيت ابب ... Link to comment
N3xT Posted May 19, 2019 Share Posted May 19, 2019 احذف المسافة اللي ببداية سطر 12, وسطر 40 احذف الاند الزايدة Link to comment
iiv03 Posted May 19, 2019 Author Share Posted May 19, 2019 (edited) 4 hours ago, N3xT said: احذف المسافة اللي ببداية سطر 12, وسطر 40 احذف الاند الزايدة دست علي زر ماصار شيئ النص مافي 5 hours ago, N3xT said: احذف المسافة اللي ببداية سطر 12, وسطر 40 احذف الاند الزايدة حاولت اطلع نص في ديبوق سترينق ماطلع شيئ addEventHandler ( "onClientClick", root, function () if ( button == "left" and state == "down" ) then if isMouseInPosition(43, 566, 61, 64) then outputDebugString("test") end end end ) شسالفه؟ Edited May 19, 2019 by liwahadri Link to comment
iiv03 Posted May 19, 2019 Author Share Posted May 19, 2019 5 hours ago, N3xT said: احذف المسافة اللي ببداية سطر 12, وسطر 40 احذف الاند الزايدة حاولت اطلع نص في ديبوق سترينق ماطلع شيئ addEventHandler ( "onClientClick", root, function () if ( button == "left" and state == "down" ) then if isMouseInPosition(43, 566, 61, 64) then outputDebugString("test") end end end ) حليته المشكله طلعت من function (button, state, absoluteX, absoluteY, clickedElement) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now