Code:
/* Formatright © 2011, ConnorMcLeod
This plugin is free software;
you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this plugin; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <amxmodx>
#define PLUGIN "Game Message"
#define VERSION "0.0.2"
new Trie:g_tReplacements
new g_iSyncHud
public plugin_init()
{
register_plugin(PLUGIN, VERSION, "ConnorMcLeod")
register_message(get_user_msgid("TextMsg"), "Message_TextMsg")
g_tReplacements = TrieCreate()
TrieSetString(g_tReplacements, "#Bomb_Planted", "The bomb has been planted!")
TrieSetString(g_tReplacements, "#Bomb_Defused", "The bomb has been defused!" )
TrieSetString(g_tReplacements, "#Target_Bombed", "Target Succesfully Bombed!")
TrieSetString(g_tReplacements, "#CTs_Win", "Counter-Terrorists Win!")
TrieSetString(g_tReplacements, "#Terrorists_Win", "Terrorists Win!")
TrieSetString(g_tReplacements, "#Target_Saved", "Target has been saved!")
TrieSetString(g_tReplacements, "#Game_Commencing", "Game Commencing!")
TrieSetString(g_tReplacements, "#Round_Draw", "Round Draw!")
TrieSetString(g_tReplacements, "#Auto_Team_Balance_Next_Round", "Auto-Team Balance next round!")
g_iSyncHud = CreateHudSyncObj()
}
public Message_TextMsg(iMsgId, iMsgDest, id)
{
if( !id && get_msg_arg_int(1) == print_center )
{
new szMessage[64]
get_msg_arg_string(2, szMessage, charsmax(szMessage))
if( TrieGetString(g_tReplacements, szMessage, szMessage, charsmax(szMessage)) )
{
set_hudmessage(0, 100, 200, -1.0, 0.28, .channel=-1)
ShowSyncHudMsg(0, g_iSyncHud, szMessage)
return PLUGIN_HANDLED
}
}
return PLUGIN_CONTINUE
}