Back to TPG

TPG.Util.ChatMessageThrottled

S🏷️ Util

Part of TPG namespace

TPG.Util.ChatMessageThrottled(ply, key, message, color, interval)
View on GitHub|gamemode/core/sh_utils.lua:59-73
📋 Has LDoc👁️ 0 viewsUpdated 1 month ago

Description

Send a chat line, at most once every interval seconds per player. For messages driven by an event the player can fire dozens of times in a tick: a spawn-menu click held down, a paste of thirty props refused one prop at a time. Without this the refusal is technically correct and completely unreadable, and the useful line above it is gone from the chat box. key is what gets rate limited, not the text, so a message whose body carries a changing count still collapses to one line per interval. Different keys never suppress each other, so an unrelated warning arriving in the same second still gets through.

Parameters

NameTypeDescription
plyPlayerRecipient.
keystringGroups messages that should suppress one another.
messagestringText to send.
color?ColorColour to print it in.(default: white)
interval?numberSeconds of silence after a send.(default: 2)

Returns

TypeDescription
booleanWhether the line was actually sent.

Examples

No examples available.

Used In

No usages found in the codebase.