* Currently the plugin could add tag to Steam players only
* - kroshk4 for plugin 'VipMenu'
* - serfreeman1337 for plugin 'Top SayPrefix'
* - Lev for dproto & plugin 'UpdateHint'
* SayText standard message structure for player chat:
* Arg 2 (String "#Cstrike_Chat_<>")
* Arg 4 (String "<text>^n")
// customizable parameters
new const STEAM_PREFIX[] = "^4[STEAM]^1"
// end of customizable parameters
// macro; %1 - variable being modified, %2 - player id
/* plugin 'Update Client Hint' (c-s.net.ua/forum/topic44709.html) is not used.
we should get player auth by ourselves. */
register_plugin( PLUGIN, VERSION, AUTHOR )
register_message( get_user_msgid("SayText"), "Msg_SayText" )
giMaxPlayers = get_maxplayers()
pDprotoProvider = get_cvar_pointer( "dp_r_id_provider" ) // dproto interface
public client_putinserver(id) {
is_user_steam(id) ? SetFlag( gbIsSteam, id ) : ClearFlag( gbIsSteam, id )
public Msg_SayText( msgid, dest, receiver ) {
// remember: we care about standard game chat messages only!
// ignore any other messages; for example '#Cstrike_Name_Change' that is sent as MSG_BROADCAST
new id = get_msg_arg_int(ARG_SENDERID)
if( !id || id > giMaxPlayers )
if( !CheckFlag( gbIsSteam, id ) )
// nothing to worry about
new paramsCount = get_msg_args()
if( paramsCount != STD_MSG_ARGS_NUM ) {
/* generally SayText usermsg could have any number of arguments;
ignore all MSG_ONE messages that are definitely not a standard chat ones */
/* Minimum size is sizeof STEAM_PREFIX + 21 (the longest
Maximum one is limited by user message size - 192 bytes for whole message.
I decided not to take into account 3rd party tags and possible double-byte character truncating */
static msgLastId, Float:msgLastTime, msgHolder[ REQ_SIZE ]
if( msgLastId == id && msgLastTime == get_gametime() ) {
// we are not cache get_gametime() value because assuming it mostly used one time
set_msg_arg_string( ARG_MAIN_STRING, msgHolder )
static const szChatAll[] = "#Cstrike_Chat_All"
static szMsg[REQ_SIZE], szNewMsg[REQ_SIZE]
get_msg_arg_string( ARG_MAIN_STRING, szMsg, charsmax(szMsg) )
if( !strcmp( szMsg, szChatAll ) ) {
// create template entirely because original one is unusable due to STX symbol
// formatex is not suitable here because of %s parameters intended for processing by the game
copy( szNewMsg, charsmax(szNewMsg), STEAM_PREFIX )
add( szNewMsg, charsmax(szNewMsg), " ^3%s1^1 : %s2" )
formatex( szNewMsg, charsmax(szNewMsg), "%s %s", STEAM_PREFIX, szMsg )
set_msg_arg_string( ARG_MAIN_STRING, szNewMsg )
msgLastTime = get_gametime()
copy( msgHolder, charsmax(msgHolder), szNewMsg )
if( is_user_bot(id) || is_user_hltv(id) )
server_cmd( "dp_clientinfo %d", id )
return get_pcvar_num( pDprotoProvider ) == DP_AUTH_STEAM ? 1 : 0