Skip to content

Automatic game_text channel assignment for server plugins that avoids map channels

License

Notifications You must be signed in to change notification settings

Vauff/DynamicChannels

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Dynamic Game_Text Channels

Provides a native for plugins to implement that handles automatic game_text channel assigning based on what channels the current map uses. This means game_text channel conflicts can be completely be avoided when dealing with 6 or less total channels. When going over 6 channels, conflicts are inevitable, however effects are minimized. The sm_debugchannels command is also available to root admins to see the overall state of all channel assignments.

This plugin should theoretically work for any Source game with a 6 channel game_text entity. However, it has only been tested on CS:GO.

For this plugin to work properly, game_text channels must only be used by maps and by plugins via the GetDynamicChannel native. This means that all plugins using ShowHudText() need to use GetDynamicChannel() for the channel number. ShowSyncHudText() or game_text entity creation should not be used by plugins at all.

Example Usage

/*
This is the most basic usage case for the DynamicChannels plugin
Calling GetDynamicChannel(0) will find an open channel for the group 0
If you need to use a different channel number somewhere, use a different group number like 1
What channel it chooses depends on what's available, if a map uses no game_text channels, it will pick channel 0
If a map uses channels 0 and 1 for example, group 0 will pick channel 2 instead, group 1 channel 3 etc...
Group numbers will return the same channel number anywhere in your plugin stack, this can change over time though, so call GetDynamicChannel() frequently and don't store it long term
There are 6 groups maximum, and 6 engine channels maximum, each ranging from 0-5
If map channels + plugin groups exceeds 6, DynamicChannels will begin assigning plugin groups a channel number already used by the map
If the warnings convar is enabled, this will output a warning to root admins when it happens
*/

SetHudTextParams(0.5, 0.5, 5.0, 255, 0, 0, 0, 0, 1.0, 1.0, 1.0);
ShowHudText(client, GetDynamicChannel(0), "Hello world!");

Diagrams

Still not getting it? Here's a couple diagrams going over how the plugin could assign channels in different scenarios.

Note that since group channel assignment is based on the order of function calls, the exact channel that each plugin group is assigned will likely not be the same as shown in the diagrams.

Diagram 1

Diagram 2

Diagram 3

Diagram 4

Diagram 5

About

Automatic game_text channel assignment for server plugins that avoids map channels

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published