Скриптер
Участник
Пользователь
- Сообщения
- 157
- Реакции
- 279
---------- [ Description ] ----------
NOTE: as of March 2021 (version 3.0), CromChat is no longer Counter-Strike dependant! You can use it with any mod, but the colors will be active only in CS.
Since every colorchat include that I used so far had something that I don't like, I decided to make one my self and fix the things that annoy me. For example, I didn't like using RED/BLUE/TEAM_COLOR as a parameter in the ColorChat include, another include displayed an error when sending a message in an empty server, and so on. So, here's my version.
---------- [ Color Codes ] ----------
Beside the default symbols - ^x04, ^x03 & ^x01, you can also use these ones:
&x07 = red
&x06 = blue
&x05 = white
&x04 = green
&x03 = team color
&x01 = normal
&x00 = removes message prefix (only if put in the beginning of the message)
You can use only one of the following in a single message: &x07, &x06, &x05, &x03. If you use more than one in a message, it will automatically select the color that is first in the list and will replace all other colors with that one. Combining more than one team color is not possible in CS 1.6!!!
You can choose from multiple color code groups by adding a single line in the .sma file. You can see all the different groups on the image below. By default, the CROMCHAT group is used.
To activate a different color group, simply add #define CC_COLORS_TYPE CC_COLORS_<group name> before #include <cromchat>. Example: if you want to activate the group SHORT, the code needs to look like this:
PHP:
#define CC_COLORS_TYPE CC_COLORS_SHORT
#include <cromchat>
You can also make your own custom set of codes, by using the group CUSTOM like this:
PHP:
#define CC_SYM_CHAT_NORMAL "&x01"
#define CC_SYM_CHAT_TEAM "&x03"
#define CC_SYM_CHAT_GREEN "&x04"
#define CC_SYM_CHAT_WHITE "&x05"
#define CC_SYM_CHAT_BLUE "&x06"
#define CC_SYM_CHAT_RED "&x07"
#define CC_SYM_CHAT_NOPREF "&x00"
#include <cromchat>
---------- [ Sending Messages ] ----------
Messages are sent using the function CC_SendMessage or CromChat:
PHP:
CC_SendMessage(id, szMessage[], any:...)
PHP:
// This will send a message to "id" and log it in the default log file.
CC_LogMessage(id, _, "&x04green &x01is not &x07red")
// This will send a message to all players and log it in the file "test.txt".
CC_LogMessage(0, "test.txt", "&x03Cooool story bro!")
PHP:
CC_SendMatched(const id, const iPlayer, const szInput[], any:...)
PHP:
CC_SendMatched(id, iTarget, "message")
CC_SendMatched(0, CC_COLOR_GREY, "message")
PHP:
CC_GroupMessage("ae", "TERRORIST", "message")
PHP:
CC_SendAdminMessage("abcei", true, "message")
You can also change the color for any other CC_* function by using CC_SetColor.
This will force the next CC_* call to use that color.
PHP:
CC_SetColor(CC_COLOR_GREY)
CC_GroupMessage("a", _, "message")
You can prevent this by setting the second parameter to true:
PHP:
CC_SetColor(CC_COLOR_GREY, true)
---------- [ Adding A Prefix ] ----------
With the function CC_SetPrefix you can specify a global prefix that will automatically be added in the beginning of each message. This is much more easier than having to add a prefix manually on each line of code. The function needs to be added in plugin_init() (or some other forward if necessary).
PHP:
public plugin_init()
CC_SetPrefix("&x04[X-Servers]")
---------- [ Removing Colors ] ----------
To remove the color codes from a message:
PHP:
CC_RemoveColors(szMessage[], iLen, bool:bChat = true, bool:bMenu = false)
If bMenu = true, it will remove the codes for menu colors.
There is also a function for removing chat exploits, e.g. chat color codes and the % sign.
PHP:
CC_RemoveExploits(message, len)
Последнее редактирование: