Garry's Mod

Garry's Mod

Não há avaliações suficientes
[E2 Library] ChatPrint 2024
   
Premiar
+ favoritos
Nos favoritos
- favoritos
Content Type: Addon
Addon Type: Tool
Addon Tags: Comic, Fun, Roleplay
Tamanho
Publicado em
Atualizado em
5.265 KB
25/nov./2024 às 16:36
25/nov./2024 às 18:02
2 notas de atualização (ver)

Inscreva-se para baixar
[E2 Library] ChatPrint 2024

Em 1 coleção de [MG] Cheezus
Avtomat Events
154 itens
Descrição
E2 Library: ChatPrint
Based on MattJeanes' old library which has unfortunately broken with time.

A utility function to print coloured text to a players chat area.

IMPORTANT: This library will only work if you have admin privileges, or sbox_E2_ChatPrintAdminOnly is set to 0.

Usage
  • chatPrint(...) - Prints a message to everybody's chat. Works similar to chat.AddText(...)[wiki.facepunch.com] and can take a variable number of arguments. Takes vectors as colors.
  • chatPrint(entity targetPlayer, ...) - Prints a message to a specific player's chat.
  • chatPrint(array args) - Same as chatPrint(...) but takes an array of arguments.
  • chatPrint(entity targetPlayer, array args) - Same as chatPrint(entity, ...) but takes an array of arguments.

Console Commands
  • sbox_E2_ChatPrintAdminOnly - If set to 1, only admins can use chatPrint. This is enabled by default.
  • sbox_E2_ChatPrintMaxCharacters - The maximum number of characters that can be in a single chatPrint message. Default is 255.
  • sbox_E2_ChatPrintBurstRate - The rate at which the message limit recharges up to BurstMax, in messages per second. Default is 1 per second.
  • sbox_E2_ChatPrintBurstMax - The maximum number of messages that can be sent in a burst. Default is 8.

Examples

Prints "Hello world!" in green to the E2 owner's chat:
chatPrint(owner(), vec(0, 255, 0), "Hello world!")

Make all of your chat messages rainbow coloured for everyone:
@name Rainbow Chat
@strict

event chat(Player:entity, Message:string, _:number) {
local R = array()

R:pushVector(teamColor(owner():team()))
R:pushString(owner():name())
R:pushVector(vec(255, 255, 255))
R:pushString(": ")

for(I = 1, Message:length()) {
local Color = hsv2rgb(360 / Message:length() * I, 1, 1)
R:pushVector(Color)
R:pushString(Message[I])
}

chatPrint(R)
hideChat(1)
}

Check it out on GitHub.[github.com]
1 comentário(s)
Denneisk 27/nov./2024 às 18:55 
Nice lol :v