Garry's Mod

Garry's Mod

Onvoldoende beoordelingen
[E2 Library] ChatPrint 2024
   
Prijs
Toevoegen aan favorieten
Toegevoegd aan favorieten
Verwijderen uit favorieten
Content Type: Addon
Addon Type: Tool
Addon Tags: Comic, Fun, Roleplay
Bestandsgrootte
Geplaatst op
Bijgewerkt op
5.265 KB
25 nov 2024 om 16:36
25 nov 2024 om 18:02
2 wijzigingsnotities (weergeven)

Abonneren om te downloaden
[E2 Library] ChatPrint 2024

In 1 verzameling van [MG] Cheezus
Avtomat Events
154 items
Omschrijving
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 opmerkingen
Denneisk 27 nov 2024 om 18:55 
Nice lol :v