iFoReX Posted June 1, 2012 Share Posted June 1, 2012 why when I press the button the Edit Doesnt Change ? --[[ Dont Copy my Script or Dead -.- ]] BNumber = {} ENumber = {} B = {} x2, y2 = 58,31 CGUI = guiCreateWindow(0.3648,0.1517,0.25,0.3667,"Calculadora",true) ENumber[1] = guiCreateEdit(9,25,112,23,"",false,CGUI) guiEditSetMaxLength(ENumber[1], 4) ENumber[2] = guiCreateEdit(125,25,47,22,"",false,CGUI) guiEditSetMaxLength(ENumber[2], 1) ENumber[3] = guiCreateEdit(177,25,133,22,"",false,CGUI) guiEditSetMaxLength(ENumber[3], 4) EResult = guiCreateEdit(9,51,344,21,"---Resultado",false,CGUI) BDelete = guiCreateButton(237,75,72,26,"Borrar",false,CGUI) BNumber[1] = guiCreateButton(9,112,x2, y2,"1",false,CGUI) BNumber[2] = guiCreateButton(70,111,x2, y2,"2",false,CGUI) BNumber[3] = guiCreateButton(130,111,x2, y2,"3",false,CGUI) BNumber[4] = guiCreateButton(9,145,x2, y2,"4",false,CGUI) BNumber[5] = guiCreateButton(70,145,x2, y2,"5",false,CGUI) BNumber[6] = guiCreateButton(130,145,x2, y2,"6",false,CGUI) BNumber[7] = guiCreateButton(9,177,x2, y2,"7",false,CGUI) BNumber[8] = guiCreateButton(70,176,x2, y2,"8",false,CGUI) BNumber[9] = guiCreateButton(130,176,x2, y2,"9",false,CGUI) B0 = guiCreateButton(251,175,58,31,"0",false,CGUI) B.D = guiCreateButton(190,111,58,31,"/",false,CGUI) B.X = guiCreateButton(190,145,58,31,"X",false,CGUI) B.S = guiCreateButton(250,110,58,31,"+",false,CGUI) B.R = guiCreateButton(250,144,58,31,"-",false,CGUI) B.Re = guiCreateButton(190,175,58,31,"=",false,CGUI) BChooser1 = guiCreateButton(9,73,68,21,"1 Edit",false,CGUI) BChooser2 = guiCreateButton(83,73,68,21,"2 Edit",false,CGUI) guiSetVisible(CGUI, false) showCursor(false) bindKey("c","down", function () if getKeyState("lctrl") then guiSetVisible(CGUI, not guiGetVisible(CGUI)) showCursor(guiGetVisible(CGUI)) end end ) addEventHandler("onClientGUIClick",root, function() if source == BChooser1 then addEventHandler("onClientGUIClick",root, SetE) end end ) function setE() if source == BNumber[1] then guiSetText(ENumber[1], "1") end end Link to comment
Castillo Posted June 2, 2012 Share Posted June 2, 2012 Mind explaining what are you trying to achieve? Link to comment
Castillo Posted June 2, 2012 Share Posted June 2, 2012 I already know that, Shadow, but I mean what he's trying to do. Link to comment
iFoReX Posted June 2, 2012 Author Share Posted June 2, 2012 I want do : if the player press BChooser1 and the BNumber[1] in the ENumber[1] set the "1" Link to comment
Castillo Posted June 2, 2012 Share Posted June 2, 2012 --[[ Dont Copy my Script or Dead -.- ]] BNumber = {} ENumber = {} B = {} x2, y2 = 58,31 selected = 0 CGUI = guiCreateWindow(0.3648,0.1517,0.25,0.3667,"Calculadora",true) ENumber[1] = guiCreateEdit(9,25,112,23,"",false,CGUI) guiEditSetMaxLength(ENumber[1], 4) ENumber[2] = guiCreateEdit(125,25,47,22,"",false,CGUI) guiEditSetMaxLength(ENumber[2], 1) ENumber[3] = guiCreateEdit(177,25,133,22,"",false,CGUI) guiEditSetMaxLength(ENumber[3], 4) EResult = guiCreateEdit(9,51,344,21,"---Resultado",false,CGUI) BDelete = guiCreateButton(237,75,72,26,"Borrar",false,CGUI) BNumber[1] = guiCreateButton(9,112,x2, y2,"1",false,CGUI) BNumber[2] = guiCreateButton(70,111,x2, y2,"2",false,CGUI) BNumber[3] = guiCreateButton(130,111,x2, y2,"3",false,CGUI) BNumber[4] = guiCreateButton(9,145,x2, y2,"4",false,CGUI) BNumber[5] = guiCreateButton(70,145,x2, y2,"5",false,CGUI) BNumber[6] = guiCreateButton(130,145,x2, y2,"6",false,CGUI) BNumber[7] = guiCreateButton(9,177,x2, y2,"7",false,CGUI) BNumber[8] = guiCreateButton(70,176,x2, y2,"8",false,CGUI) BNumber[9] = guiCreateButton(130,176,x2, y2,"9",false,CGUI) B0 = guiCreateButton(251,175,58,31,"0",false,CGUI) B.D = guiCreateButton(190,111,58,31,"/",false,CGUI) B.X = guiCreateButton(190,145,58,31,"X",false,CGUI) B.S = guiCreateButton(250,110,58,31,"+",false,CGUI) B.R = guiCreateButton(250,144,58,31,"-",false,CGUI) B.Re = guiCreateButton(190,175,58,31,"=",false,CGUI) BChooser1 = guiCreateButton(9,73,68,21,"1 Edit",false,CGUI) BChooser2 = guiCreateButton(83,73,68,21,"2 Edit",false,CGUI) guiSetVisible ( CGUI, false ) showCursor ( false ) bindKey ( "c", "down", function ( ) if getKeyState ( "lctrl" ) then guiSetVisible ( CGUI, not guiGetVisible ( CGUI ) ) showCursor ( guiGetVisible ( CGUI ) ) end end ) addEventHandler ( "onClientGUIClick", guiRoot, function ( ) if ( source == BChooser1 ) then selected = 1 elseif ( source == BChooser2 ) then selected = 2 elseif ( source == BNumber[1] ) then if ( selected == 1 ) then guiSetText ( ENumber[1], "1" ) end end end ) Try that. Link to comment
iFoReX Posted June 2, 2012 Author Share Posted June 2, 2012 thank you, work, but when I press Edit 2 and I press "1", the edit 2 doesnt change 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