xTeacherx Posted May 4, 2012 Posted May 4, 2012 hi all GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Window[1] = guiCreateWindow(259,236,532,244,"Bind Say",false) word = guiCreateEdit(0.0902,0.2295,0.8346,0.1393,"",true,GUIEditor_Window[1]) bind = guiCreateEdit(0.0902,0.5082,0.8346,0.1352,"",true,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(0.1316,0.75,0.3759,0.1721,"[ Add BindKey ]",true,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(0.5357,0.7459,0.3477,0.1803,"[ unbindKey ]",true,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(0.4962,0.1352,0.1222,0.1189,"Words",true,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],100,200,255) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Label[2] = guiCreateLabel(0.5075,0.418,0.0714,0.0861,"Key",true,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],100,200,255) guiSetFont(GUIEditor_Label[2],"default-bold-small") i dont know how to create ( setbindkey or setUnBindkey )
Stanley Sathler Posted May 4, 2012 Posted May 4, 2012 What do you want? Set a bindKey for call the GUI when pressed? If yes, read: https://wiki.multitheftauto.com/wiki/BindKey
iFoReX Posted May 5, 2012 Posted May 5, 2012 with 'bindKey' and 'unbindKey' and events 'onClientGUIClick'
xTeacherx Posted May 5, 2012 Author Posted May 5, 2012 Look To PIC: OPEN LINK ! http://im15.gulfup.com/2012-05-05/1336214955211.png
Michael# Posted May 5, 2012 Posted May 5, 2012 addEventHandler ( 'onClientGUIClick', root, function ( ) if ( source == urButton ) then local text = guiGetText ( urWordsEdit ) local key = guiGetText ( urKeyEdit ) bindKey ( tostring ( key ), 'down', 'say ' .. text ) end end ) I think this works.
Scooby Posted May 5, 2012 Posted May 5, 2012 you cant make a gui with the editor and then expect it to work as a complete script, the editor only creates the code for the gui and its layout, you then need to write the functions that make each gui element work. after u create the button, use this to make the button work: addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], addTheBind, false ) -- addTheBind is your function name then make the handler function: function addTheBind() -- your code here (what do u want the function to do when u press the button) -- end u need the same again for the other button. then in each of these functions, u need to get the text added and the key used with: local key = guiGetText(bind) local words = guiGetText(word) if key and words then -- add ur bind here (bindkey / unbindKey) end hope this helps...
xTeacherx Posted May 6, 2012 Author Posted May 6, 2012 GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Window[1] = guiCreateWindow(259,236,532,244,"Bind Say",false) word = guiCreateEdit(0.0902,0.2295,0.8346,0.1393,"",true,GUIEditor_Window[1]) bind = guiCreateEdit(0.0902,0.5082,0.8346,0.1352,"",true,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(0.1316,0.75,0.3759,0.1721,"[ Add BindKey ]",true,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(0.5357,0.7459,0.3477,0.1803,"[ unbindKey ]",true,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(0.4962,0.1352,0.1222,0.1189,"Words",true,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],100,200,255) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Label[2] = guiCreateLabel(0.5075,0.418,0.0714,0.0861,"Key",true,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],100,200,255) guiSetFont(GUIEditor_Label[2],"default-bold-small") function addTheBind() local key = guiGetText(bind) local words = guiGetText(word) if key and words then addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], addTheBind, false ) -- addTheBind is your function name end end Not work
Guest Guest4401 Posted May 6, 2012 Posted May 6, 2012 addEventHandler("onClientGUIClick",root, function() if source == GUIEditor_Button[1] then -- if he clicked add bindkey button local words = guiGetText(word) -- get text of words edit local key = guiGetText(bind) -- get text of bind edit if words and key then -- if we got the text bindKey(key,"down","say",words) -- bind it end elseif source == GUIEditor_Button[2] then -- if he clicked the unbind key button local words = guiGetText(word) -- get text of words edit local key = guiGetText(bind) -- get text of bind edit if words and key then -- if we got the text unbindKey(key,"down","say") -- unbind it end end end )
Jaysds1 Posted May 6, 2012 Posted May 6, 2012 WAIT, WHO'S SCRIPT IS THIS? https://community.multitheftauto.com/index.php?p= ... ls&id=4729
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