Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Settings = {
- Host = "127.0.0.1",
- Port = 2000
- }
- local chatSocket = sockOpen(Settings.Host, Settings.Port)
- addEventHandler("onSockOpened", root, function(socket)
- if socket == chatSocket then
- outputDebugString("Chat socket opened!")
- end
- end)
- addEventHandler("onPlayerChat", root, function(msg, msgType)
- if msgType == 0 then
- local data = getPlayerName(source)..": "..msg
- sockWrite(chatSocket, data.."\r\n")
- end
- end)
- addEventHandler("onSockData", root, function(socket, data)
- if socket == chatSocket then
- outputChatBox(data)
- end
- end)
- addEventHandler("onSockClosed", root, function(socket)
- if socket == chatSocket then
- outputDebugString("Chat socket closed!")
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment