Enargy, Posted December 10, 2013 Share Posted December 10, 2013 I have problems with doing this help panel, When I write something in the text box below and I press the button 'send' does not send the text to the memo, can anyone solve the problem? addEventHandler("onClientResourceStart", resourceRoot, function() window = guiCreateWindow(0.26, 0.13, 0.48, 0.65, "SUPPORT", true) guiWindowSetMovable(window, false) guiWindowSetSizable(window, false) guiSetVisible(window, false) edit_writer = guiCreateEdit(0.03, 0.91, 0.75, 0.06, "", true, window) btn_send = guiCreateButton(0.83, 0.91, 0.14, 0.06, "Send", true, window) guiSetProperty(btn_send, "NormalTextColour", "FFAAAAAA") memo_help = guiCreateMemo(0.02, 0.06, 0.95, 0.83, "", true, window) guiMemoSetReadOnly(memo_help, true) end) function toggleWindow() guiSetVisible (window, not guiGetVisible ( window ) ) showCursor(guiGetVisible(window)) end bindKey("F6", "down", toggleWindow) function sendMessage() if isElement(window) then local newText = guiGetText(edit_writer) if newText and string.len(newText) > 0 then local oldText = guiGetText(memo_help) if not oldText then oldText = "" end oldText = oldText .. getPlayerName(localPlayer) .. ": " .. newText .. "\n" guiSetText(memo_help, oldText) guiSetText(edit_writer, "") guiMemoSetCaretIndex(edit_writer, string.len(oldText)) end end end function sendMSG() if (source == btn_send ) then local localP = getPlayerFromName(guiGetText(memo_help)) if localP then sendMessage(localP) end end end addEventHandler("onClientGUIClick", root, sendMSG) Link to comment
Castillo Posted December 10, 2013 Share Posted December 10, 2013 local localP = getPlayerFromName(guiGetText(memo_help)) if localP then What are these for? Link to comment
Enargy, Posted December 10, 2013 Author Share Posted December 10, 2013 local localP = getPlayerFromName(guiGetText(memo_help)) if localP then What are these for? get the name of the player along with the text Link to comment
Castillo Posted December 10, 2013 Share Posted December 10, 2013 And how would that work...? isn't that the memo containing all the messages? Link to comment
Enargy, Posted December 10, 2013 Author Share Posted December 10, 2013 And how would that work...? isn't that the memo containing all the messages? I want people to write your text on the bottom bar, click the button to 'send' the written text in the bottom bar is displayed in the memo Link to comment
Castillo Posted December 11, 2013 Share Posted December 11, 2013 Yeah, but if the memo contains the messages sent, then your getPlayerFromName will return always false. 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