Skip to content

Commit

Permalink
Use player_say event (#48)
Browse files Browse the repository at this point in the history
* Use player_say event

* Fix team check
  • Loading branch information
brandonsturgeon authored Jul 4, 2024
1 parent 7df5beb commit 40f8bc2
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions moon/cfc_chat_transit/server/modules/chat.moon
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import guard from ChatTransit

ChatTransit.ReceiveMessage = (ply, text, teamChat) =>
shouldRelay = hook.Run "CFC_ChatTransit_ShouldRelayChatMessage", ply, text, teamChat
return if shouldRelay == false
return if teamChat
ChatTransit.ReceiveMessage = (data) =>
:userid, :text, :teamonly = data
ply = Player userid

return if teamonly == 1
return unless text
return if text == ""

shouldRelay = hook.Run "CFC_ChatTransit_ShouldRelayChatMessage", ply, text, teamonly
return if shouldRelay == false

@Send
Type: "message"
Data:
Expand All @@ -17,4 +20,5 @@ ChatTransit.ReceiveMessage = (ply, text, teamChat) =>
SteamId: ply\SteamID64!
IrisId: "none"

hook.Add "PlayerSay", "CFC_ChatTransit_MessageListener", guard(ChatTransit\ReceiveMessage), HOOK_MONITOR_LOW
gameevent.Listen "player_say"
hook.Add "player_say", "CFC_ChatTransit_MessageListener", guard(ChatTransit\ReceiveMessage)

0 comments on commit 40f8bc2

Please sign in to comment.