Jump to content

bind say gui


Recommended Posts

hi all :D

  
   
  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 ) :D

Link to comment
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.

Link to comment

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

Link to comment
  
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

Link to comment
Guest Guest4401
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 
) 

Link to comment

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