Skip to content

PrintGlobal

Vurv edited this page Feb 15, 2021 · 11 revisions

Last updated for version v0.3.1

Main Info

This is a sub-addon in VExtensions, it adds several functions that allow you to print to other people's chat with different colors, etc. It behaves similarly to chat.AddText, except you can align colors and strings in any order. You are warned in your console when someone is printing to your chat, there is a limit in number of characters, number of arguments and there is a limit to how many times you can print in a second.

Here are the convars:

printglobal_charmax_sv (By default 350 characters)
printglobal_argmax_sv (By default 50 args)
printglobal_burst_sv (By default 4 per second) -- Removed since v0.3.0 temporarily.

Documentation

n = canPrintGlobal()

Returns 1 or 0 for whether you can call printGlobal()

n = canPrintTo(eply)

Returns 1 or 0 for whether you can printGlobal to player ply, does not keep in mind whether you can printGlobal at all, so you must use this alongside canPrintGlobal to make sure you don't go past the burst limit.

printGlobal(...)

Prints to everyone's chat, similar to how chat.AddText does, using an assortment of vectors and strings.
By default prints to everyone, but the first argument may be either: A single valid player An array of valid players. Costs ~100 ops by default, but as the message is longer, 3 ops are added per byte sent, and ~1000 ops per newline to avoid abuse.

printGlobal(r args)

Prints to everyone's chat using an array of arguments instead of ..., behaves similarly to chat.addText

printGlobal(e ply, ...)

Prints to a certain players chat, otherwise the same as printGlobal(...)

printGlobal(r playersToPrintTo, r args)

Prints to an array of people's chats using an array of arguments instead of ..., otherwise the same as printGlobal(...)

runOnPrintGlobal(n doRunOn)

Sets the e2 to run on people using the printGlobal function with e2, n being 1 to run and 0 to not run

n = printGlobalClk()

Returns 1 or 0 for whether the e2 chip was triggered by someone sending a printGlobal to you.

r = lastGPrintRaw()

Returns an array of the last printGlobalClk information retrieved

r = lastGPrintRaw(e ply)

Returns an array of the last printGlobalClk information retrieved that ply sent.

e = lastGPrintSender()

Returns the last player to send a printGlobal message to you.

s = lastGPrintText()

Returns the last text to be sent with printGlobal, the text being merged from all of the strings given. For example, if someone calls printGlobal("hello",vec(255,0,0),"world"), lastGPrintText will return "helloworld".

s = lastGPrintText(e ply)

Returns the last text to be sent by player ply with printGlobal