MisterQuestions Posted August 12, 2014 Share Posted August 12, 2014 Hi! in this time i wanna ask how to know that cause im making a panel, and has a first tab with a dxRectangle and i wanna destroy that rectangle when the tab is switched some body help me? Link to comment
MTA Team botder Posted August 12, 2014 MTA Team Share Posted August 12, 2014 https://wiki.multitheftauto.com/wiki/OnClientGUITabSwitched Link to comment
MisterQuestions Posted August 12, 2014 Author Share Posted August 12, 2014 Thanks but now...In the first tab theres a Rectangle And how to do dissapear if change to another tab, buti f returns to that tab how to appear again the rectangle? Link to comment
MTA Team botder Posted August 12, 2014 MTA Team Share Posted August 12, 2014 In your rectangle rendering function: https://wiki.multitheftauto.com/wiki/GuiGetSelectedTab Link to comment
MisterQuestions Posted August 13, 2014 Author Share Posted August 13, 2014 Thanks for all! now the last dude, im making a panel, that in one part theres a tab, in that tab is the interface management the you can change colors, i put it like 3 editboxes R: G: B: And if you change it and click on set button the interface and the sample rectangle should change to the inserted color of RGB How to change color like that, i know is guiGetText and what else y should use to set the color? Link to comment
Et-win Posted August 13, 2014 Share Posted August 13, 2014 bool dxDrawRectangle ( int startX, int startY, float width, float height [, int color = white, bool postGUI = false] ) You have to use the event 'onClientRender' on this codes. You are using them, good. Instead of putting in: 'tocolor(255, 255, 255, 255)' you are going to do this: --Add a variable which represents the current color: local gCurrentColor = tocolor(255, 255, 255, 255) --As soon as you change the color you can do this: local gR, gG, gB = guiGetText(youreditboxR), guiGetText(youreditboxG), guiGetText(youreditboxB) gCurrentColor = tocolor(tonumber(gR), tonumber(gG), tonumber(gB), 255) Be sure you only can enter numbers into the editboxes, if you add something else than a number, then you get alot of errors. (You can remove everything except digits with: 'string.gsub(yourstring, "%D", "")' ) Link to comment
MisterQuestions Posted August 13, 2014 Author Share Posted August 13, 2014 Thanks i will check it ! Link to comment
Et-win Posted August 13, 2014 Share Posted August 13, 2014 Btw, why like this? Because on every frame it re-creates the codes you have in that function which is on event 'onClientRender'. (Because it's only created for 1 frame only) Which means, variables are awesome! Link to comment
MisterQuestions Posted August 13, 2014 Author Share Posted August 13, 2014 (edited) I got a error, and only shows the rectangle why? whats wrong--- Edited August 18, 2014 by Guest Link to comment
Et-win Posted August 13, 2014 Share Posted August 13, 2014 1. What error? 2. function onKeyUse( element ) if ( hasObjectPermissionTo ( element, "function.setServerPassword", true ) ) then triggerClientEvent( element, "Show", element ) end end I hope you aren't going to put backdoors in and put it online? Link to comment
MisterQuestions Posted August 13, 2014 Author Share Posted August 13, 2014 @guiSetVisible thats the error, when i press 'o' doesnt open window, and draw rectangle,else i press again 'o' and appears that onClientRender is already handled so? No i dont gonna put backdoors would be a private script, i use hasObjectPermissionTo cause i tried with isObjectInACLGroup and doesn't work :c Link to comment
Et-win Posted August 13, 2014 Share Posted August 13, 2014 Ah, just asking. Don't mind me. *cough* But you didn't start function 'PanelAdmin', so 'guiGetVisible' can't find 'window'. Just start the function, and on the last line before 'end' set it invisible. Link to comment
MisterQuestions Posted August 13, 2014 Author Share Posted August 13, 2014 function toggleGUI() if guiGetVisible(PanelAdmin) == false then guiSetVisible(window,false) showCursor(false) removeEventHandler("onClientRender", getRootElement(), CurrentColor) else guiSetVisible(window,true) showCursor(true) addEventHandler("onClientRender", root, CurrentColor) end end addEvent("Show",true) addEventHandler("Show",root,toggleGUI) Still not working Link to comment
Et-win Posted August 13, 2014 Share Posted August 13, 2014 No, everything was correct. But you have to start function 'PanelAdmin' as soon as the resource starts. Then inside the function 'PanelAdmin', set the 'window' invisible with 'guiSetVisible'. 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