/* Formatright © 2013, Jhob94
The "Win Messages Changer" is free plugin;
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 plugin 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 "Win Messages Changer" Plugin Source; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <amxmodx>
new msgcvar_method
new Text_Msg, WinningTeam
new Trie: tc
public plugin_init() {
register_plugin("Win Messages Changer", "0.0.5", "Jhob94")
msgcvar_method = register_cvar("msg_method", "0") // 0 = Print_Center | 1 = HUD
tc = TrieCreate()
TrieSetCell(tc, "%!MRAD_terwin" , register_cvar("msg_t_win" , "A Terroristak nyertek ezt a kort"))
TrieSetCell(tc, "%!MRAD_ctwin" , register_cvar("msg_ct_win" , "A Terror Elharitok nyertek ezt a kort"))
TrieSetCell(tc, "%!MRAD_rounddraw" , register_cvar("msg_rounddraw" , "Ebben a korben nem nyert semelyik csapat"))
register_message(get_user_msgid("SendAudio"), "Messages_Audio")
Text_Msg = get_user_msgid("TextMsg")
}
public Messages_Audio(Message_Index, Message_Dest, Index)
{
if(!Index)
{
new Audio[14], won_msg[120]
get_msg_arg_string(2, Audio, charsmax(Audio))
if(TrieGetCell(tc, Audio, WinningTeam) && get_pcvar_string(WinningTeam, won_msg, charsmax(won_msg)))
{
if(get_msg_block(Text_Msg) == BLOCK_NOT)
set_msg_block(Text_Msg, BLOCK_ONCE)
if(!get_pcvar_num(msgcvar_method))
client_print(0, print_center, "%s", won_msg)
else
{
set_hudmessage(0, 250, 0, -1.0, 0.3, 0, 6.0, 12.0, _, _, -1)
show_hudmessage(0, "%s", won_msg)
}
return PLUGIN_HANDLED
}
}
return PLUGIN_CONTINUE
}