NieZnanyUserOk Posted October 31, 2021 Posted October 31, 2021 Hello, I wanted to ask for help, because I do not know how to make the graphics appear on the entire screen and the cursor after clicking the key
The_GTA Posted October 31, 2021 Posted October 31, 2021 40 minutes ago, NieZnanyUserOk said: Hello, I wanted to ask for help, because I do not know how to make the graphics appear on the entire screen and the cursor after clicking the key which key? which graphics?
The_GTA Posted October 31, 2021 Posted October 31, 2021 1 hour ago, NieZnanyUserOk said: clicking the key I think you meant to say "pressing" the key. Take a look at the dxDrawRectangle family of functions. Inside of an onClientRender event handler you can draw a black-color entire screen rectangle by fetching the current screen dimensions using guiGetScreenSize. By using bindKey in combination with the "down" key state you can register a press-down handler for the "F2" key. Inside of the press down handler you set the condition to true that enables the dxDrawRectangle call. 1
NieZnanyUserOk Posted October 31, 2021 Author Posted October 31, 2021 Could you send lightly ready code? As I am new and I do not understand too much, please send only the beginning of the code TrybInterakcji = false local sx, sy = guiGetScreenSize() local px, py = (sx/1920), (sy/1080) function isMouseIn ( 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 font = dxCreateFont("font.ttf", 15) function gui() dxDrawImage(0*px, 0*py, 1920*px, 1080*py, "screen.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("Test", 255*px, 268*py, 100*px, 40*py, tocolor(255, 255, 255), 1.0*px, font, "center", "top",false,false,false,true) end bindKey("F2", "down", function() TrybInterakcji = true addEventHandler("onClientRender", root, gui) showCursor(true) end end end Where is problem?
The_GTA Posted October 31, 2021 Posted October 31, 2021 (edited) 26 minutes ago, NieZnanyUserOk said: Where is problem? bindKey("F2", "down", function() TrybInterakcji = true addEventHandler("onClientRender", root, gui) showCursor(true) end end end is wrong. It has to be... bindKey("F2", "down", function() TrybInterakcji = not TrybInterakcji if (TrybInterakcji) then addEventHandler("onClientRender", root, gui) else removeEventHandler("onClientRender", root, gui) end showCursor(TrybInterakcji) end ); Edited October 31, 2021 by The_GTA
NieZnanyUserOk Posted October 31, 2021 Author Posted October 31, 2021 Now no errors, but when I click the F2 button, then I only see the cursor and the graphics do not appear.
The_GTA Posted October 31, 2021 Posted October 31, 2021 (edited) 3 minutes ago, NieZnanyUserOk said: Now no errors, but when I click the F2 button, then I only see the cursor and the graphics do not appear. Sorry, I made a spelling mistake because I am not a native Polish speaker. Look at the line... if (TrybInterackcji) then ... and change it to... if (TrybInterakcji) then Good luck! Edited October 31, 2021 by The_GTA 1
The_GTA Posted October 31, 2021 Posted October 31, 2021 Just now, NieZnanyUserOk said: Thanks! You're welcome! Come back to our forums if you have any further questions. I will be there to help you. 1
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