3B00DG4MER Posted March 11, 2014 Share Posted March 11, 2014 (edited) Hello,I made A Panel send Message The Bug is,When i click Send will Send For me Only The Message show for Client only Help Client: function onClickSend(button, state) if button == "left" then if tostring( guiGetText( GUIEditor.edit[1] ) ) == "" then else local editmsg = tostring( guiGetText( GUIEditor.edit[1] ) ) local playerName = getPlayerName( localPlayer ) local row = guiGridListAddRow ( GUIEditor.gridlist[1] ) guiGridListSetItemText ( GUIEditor.gridlist[1], row, 2, editmsg, false, false ) guiGridListSetItemText ( GUIEditor.gridlist[1], row, 1, playerName , false, false ) triggerServerEvent("onPlayerChatMessage",localPlayer,editText,Log) guiSetText ( GUIEditor.edit[1] , "" ) end end end addEvent( "Sendmsg", true ) addEventHandler( "Sendmsg", getRootElement(), onClickSend ) Server: addEvent("onPlayerChatMessage",true) addEventHandler("onPlayerChatMessage",root,function ( Text , Log ) triggerClientEvent("Sendmsg",source,text) function logMessage(text,player) if text and player then local log = fileOpen("Logs/support.log") or fileCreate("Logs/support.log") -- if log then fileSetPos(log,fileGetSize(log)) fileWrite(log,"\r\n",""..player.." | "..text.."") fileFlush(log) fileClose(log) end end end end ) Help plz Edited March 13, 2014 by Guest Link to comment
Anubhav Posted March 11, 2014 Share Posted March 11, 2014 function onClickSend() local editmsg = tostring( guiGetText( GUIEditor.edit[1] ) ) local playerName = getPlayerName( localPlayer ) local row = guiGridListAddRow ( GUIEditor.gridlist[1] ) guiGridListSetItemText ( GUIEditor.gridlist[1], row, 2, editmsg, false, false ) guiGridListSetItemText ( GUIEditor.gridlist[1], row, 1, playerName , false, false ) triggerServerEvent("onPlayerChatMessage",localPlayer,editText,Log) guiSetText ( GUIEditor.edit[1] , "" ) end end end addEvent( "Sendmsg", true ) addEventHandler( "Sendmsg", getRootElement(), onClickSend ) Server addEvent("onPlayerChatMessage",true) addEventHandler("onPlayerChatMessage",root,function ( Text , Log ,text,player) triggerClientEvent("Sendmsg",source,text) if text and player then local log = fileOpen("Logs/support.log") or fileCreate("Logs/support.log") -- if log then fileSetPos(log,fileGetSize(log)) fileWrite(log,"\r\n",""..player.." | "..text.."") fileFlush(log) fileClose(log) end end end ) EDIT: I have corrected some mistakes. Not do the outputing. Link to comment
3B00DG4MER Posted March 11, 2014 Author Share Posted March 11, 2014 Still Nothing Anyone HElp me Debug script Error : ERROR: Client (|PD|XGamer) triggered serverside event onPlayerChatMessage, but event is not added serverside Link to comment
Moderators Citizen Posted March 11, 2014 Moderators Share Posted March 11, 2014 ERROR: Client (|PD|XGamer) triggered serverside event onPlayerChatMessage, but event is not added serverside It means that the script that contains this: addEvent("onPlayerChatMessage", true) wasn't added to the meta.xml or there is a syntax error somewhere in this script file. There is no syntax error in the Anubhav's code so fix the rest of the code or put it in another script file. 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