Jump to content

[Solved] Uhm Hi


justn

Recommended Posts

  
local language_handler = function(_,language,...) 
    local text = table.concat({...}," ") 
    outputChatBox("["..language.."] "..getPlayerName(localPlayer)..": "..text,root,255,255,255,true) 
end 
addCommandHandler("language",language_handler) 
bindKey("l","down","chatbox","language",guiComboBoxGetItemText(guiComboBoxGetSelected(--[[your_combo_box]]))) 
  

Link to comment

So you're saying this?

sx,sy = guiGetScreenSize() 
        lp = getLocalPlayer() 
        mr = math.random(1,2) 
        LanguageWindow = guiCreateComboBox(328, 229, 403, 435, "Please choose your language..", false) 
        guiSetVisible(LanguageWindow,false) 
        guiSetFont(LanguageWindow, "default-bold-small") 
        guiSetProperty(LanguageWindow, "NormalEditTextColour", "FF170800") 
        guiComboBoxAddItem(LanguageWindow, "Please choose your language..") 
        guiComboBoxAddItem(LanguageWindow, "Arabic") 
        guiComboBoxAddItem(LanguageWindow, "French") 
        guiComboBoxAddItem(LanguageWindow, "Spanish") 
  
local language_handler = function(player,_,language,...) 
    local text = table.concat({...}," ") 
    outputChatBox("["..language.."] "..getPlayerName(player)..": "..text,root,255,255,255,true) 
end 
addCommandHandler("language",language_handler) 
bindKey("l","down","chatbox","language",guiComboBoxGetItemText(guiComboBoxGetSelected(LanguageWindow))) 

Link to comment

Not exactly, this way it will always return the first item which is the 'Please choose your language..'. You need it to change when the combobox is changed.

You can use the onClientGUIComboBoxAccepted:

addEventHandler('onClientGUIComboBoxAccepted', LanguageWindow, function(combo) 
 local item = guiComboBoxGetSelected (combo) 
 if (item == 0) then return end 
 local text = tostring (guiComboBoxGetItemText(combo, item)) 
 unbindKey('l', 'down', 'chatbox') 
 bindKey('l', 'down', 'chatbox', 'language', text) 
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...