fairyoggy Posted July 6, 2019 Share Posted July 6, 2019 --client addEventHandler("onDgsMouseClick", root, function() if source == askbt1 then local askEdit = DGS:dgsGetText(askEdit) playSoundFrontEnd(1) triggerServerEvent( "askPlayer", getLocalPlayer(), askEdit) end end) --server function askPlayer (ThePlayer, cmd, askEdit) outputChatBox ( "#DC143C[SYS] #ffffff["..hours..":"..minutes..":"..second.."] #FFA500ASK: #FFFFFF", source, 255, 100, 200,true ) end addEvent("askPlayer",true) addEventHandler("askPlayer",root,askPlayer) how to get a chat message from "dgsGetText(askEdit)" ? Link to comment
HassoN Posted July 6, 2019 Share Posted July 6, 2019 I'm not quiet sure that I understood you, do you mean like get text from dgsGetText and post it as an outputChatBox? if so: --client addEventHandler("onDgsMouseClick", root, function() if source == askbt1 then local text = DGS:dgsGetText(askEdit) playSoundFrontEnd(1) outputChatBox ("#DC143C[SYS] #ffffff["..hours..":"..minutes..":"..second.."] #FFA500ASK: #FFFFFF"..tostring(text), 255, 100, 200) end end) but that will only outputs to the player who triggered the event. If you want to show the message to everyone send it to server side. 1 Link to comment
fairyoggy Posted July 6, 2019 Author Share Posted July 6, 2019 20 minutes ago, HassoN said: I'm not quiet sure that I understood you, do you mean like get text from dgsGetText and post it as an outputChatBox? if so: --client addEventHandler("onDgsMouseClick", root, function() if source == askbt1 then local text = DGS:dgsGetText(askEdit) playSoundFrontEnd(1) outputChatBox ("#DC143C[SYS] #ffffff["..hours..":"..minutes..":"..second.."] #FFA500ASK: #FFFFFF"..tostring(text), 255, 100, 200) end end) but that will only outputs to the player who triggered the event. If you want to show the message to everyone send it to server side. This should work on the server side. So How do i make a text(from dgsGetText in client side) send to server side in outputChatBox? Link to comment
HassoN Posted July 6, 2019 Share Posted July 6, 2019 1 minute ago, slapz0r said: This should work on the server side. So How do i make a text(from dgsGetText in client side) send to server side in outputChatBox? Try this -- client addEventHandler("onDgsMouseClick", root, function() if source == askbt1 then local text = DGS:dgsGetText(askEdit) playSoundFrontEnd(1) triggerServerEvent( "askPlayer", localPlayer, text) end end) -- server function askPlayer (text) outputChatBox ( "#DC143C[SYS] #ffffff["..hours..":"..minutes..":"..second.."] #FFA500ASK: #FFFFFF"..tostring(text), client, 255, 100, 200,true ) end addEvent("askPlayer",true) addEventHandler("askPlayer",root,askPlayer) I have basically just sent "text" with the trigger and received it with the function askPlayer (text) then used ..tostring(text) in the outputChatBox. 1 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