Garry's Mod
No hay suficientes valoraciones
[E2 Library] ChatPrint 2024
   
Premiar
Favoritos
Favorito
Quitar
Tipo de contenido: Extensión
Tipo de extensión: Herramienta
Etiqueta de extensión: Cómic, Diversión, Juego de rol
Tamaño
Publicado el
Actualizado el
5.265 KB
25 NOV 2024 a las 16:36
25 NOV 2024 a las 18:02
2 notas sobre cambios ( ver )

Suscríbete para descargar
[E2 Library] ChatPrint 2024

En 1 colección creada por [MG] Cheezus
Avtomat Events
154 artículos
Descripción
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 comentarios
Denneisk 27 NOV 2024 a las 18:55 
Nice lol :v