Jump to content

How to know when the tab switch to another?


Recommended Posts

Posted

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?

Posted
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", "")' )

Posted

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!

Posted

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?

Posted

@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 xD would be a private script, i use hasObjectPermissionTo cause i tried with isObjectInACLGroup and doesn't work :c

Posted

Ah, just asking. Don't mind me. *cough* :roll:

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.

Posted
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

Posted

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'.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...