justn Posted March 30, 2014 Share Posted March 30, 2014 So hi, i have this small problem with a language chat im making ( in progress ) and the problem is, it doesnt output in chat or anytihng ERRORS: attempt to cancatenate local 'language' ( a boolean value) local language_handler = function(player,_,language,...) local text = table.concat({...}," ") local language = guiComboBoxGetItemText(guiComboBoxGetSelected(LanguageWindow)) outputChatBox("["..language.."] "..getPlayerName(localPlayer)..": "..text,root,255,255,255,true) end addCommandHandler("language",language_handler) bindKey("l","down","chatbox","language") Link to comment
WhoAmI Posted March 30, 2014 Share Posted March 30, 2014 string guiComboBoxGetItemText ( element comboBox, int itemId ) You have to put itemId. Link to comment
cheez3d Posted March 30, 2014 Share Posted March 30, 2014 local language_handler = function(player,_,...) local text = table.concat({...}," ") local language = guiComboBoxGetItemText(LanguageWindow,guiComboBoxGetSelected(LanguageWindow)) outputChatBox("["..language.."] "..getPlayerName(localPlayer)..": "..text,root,255,255,255,true) end addCommandHandler("language",language_handler) bindKey("l","down","chatbox","language") Link to comment
justn Posted March 30, 2014 Author Share Posted March 30, 2014 Thx, can you guys help with 2 more things ? When i press l and talk, it only says [ Language ] #Twerky : and how do i determine, if a player has selected a certain language, and he talks in chat, then the message will only show for players who have selected that same language? Link to comment
WhoAmI Posted March 30, 2014 Share Posted March 30, 2014 When player selects language in combobox set to him data, like this setElementData ( localPlayer, "language", "some lang" ) And then local language_handler = function(player,_,...) local text = table.concat({...}," ") local language = guiComboBoxGetItemText(LanguageWindow,guiComboBoxGetSelected(LanguageWindow)) for _,v in ipairs ( getElementsByType ( "player" ) ) do if ( getElementData ( v, "language" ) == language ) then outputChatBox("["..language.."] "..getPlayerName(localPlayer)..": "..text,v,255,255,255,true) end end end addCommandHandler("language",language_handler) bindKey("l","down","chatbox","language") But wait, this function should be serverside, becouse in clientside you can't set to him would be visible message. 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