Skip to content
This repository was archived by the owner on Mar 11, 2024. It is now read-only.

Commit

Permalink
resend message from console on onPlayerChat
Browse files Browse the repository at this point in the history
  • Loading branch information
nrzull committed Jun 17, 2019
1 parent e4d8d21 commit 403c287
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion chat2_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ function onChatSendMessage(message)
return
end

local nickname = getPlayerName(client)
defaultOutput(client, message)
end

function defaultOutput(sender, message)
local nickname = getPlayerName(sender)
local text = string.format("%s#ffffff: %s", nickname, message)

for _, player in ipairs(getElementsByType("player")) do
Expand All @@ -72,5 +76,10 @@ function onPlayerJoin()
registerPlayer(source)
end

function onPlayerChat(message)
defaultOutput(source, message)
end

addEventHandler("onChat2SendMessage", resourceRoot, onChatSendMessage)
addEventHandler("onPlayerJoin", root, onPlayerJoin)
addEventHandler("onPlayerChat", root, onPlayerChat)

0 comments on commit 403c287

Please sign in to comment.