/* Formatright © 2009, ConnorMcLeod
TeamAttack Notifier 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 TeamAttack Notifier; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Fordította: BBk - Death of Legend
*/
#define ADMIN_TEAMATTACK_NOTIFY ADMIN_KICK
#include <amxmodx>
#include <cstrike>
#define VERSION "0.1.0"
#define MAX_PLAYERS 32
#define HUD_PRINTTALK 3
#define NOTIFY_ALL 1
#define NOTIFY_ADMINS_ONLY 2
new g_pCvarNotifier, gmsgTextMsg
public plugin_init()
{
register_plugin("TeamAttack Notifier", VERSION, "ConnorMcLeod")
g_pCvarNotifier = register_cvar("amx_teamattack_notifier", "1")
register_event("TextMsg", "Event_TextMsg_TeamAttack", "bc", "1=3", "2=#Game_teammate_attack")
gmsgTextMsg = get_user_msgid("TextMsg")
}
public Event_TextMsg_TeamAttack()
{
new iMode = get_pcvar_num(g_pCvarNotifier)
if( !iMode )
{
return
}
new szName[32], iAttacker
read_data(3, szName, charsmax(szName))
iAttacker = get_user_index(szName)
static const Game_teammate_attack[] = "#Game_teammate_attack"
if( is_user_connected(iAttacker) )
{
new CsTeams:iTeam = cs_get_user_team(iAttacker)
new iPlayers[MAX_PLAYERS], iNum, id
get_players(iPlayers, iNum)
for(new i; i<iNum; i++)
{
id = iPlayers[i]
if( cs_get_user_team(id) != iTeam
&& ( iMode == NOTIFY_ALL || get_user_flags(id) & ADMIN_TEAMATTACK_NOTIFY ) )
{
message_begin(MSG_ONE_UNRELIABLE, gmsgTextMsg, _, id)
write_byte(HUD_PRINTTALK)
write_string(Game_teammate_attack)
write_string(szName)
message_end()
}
}
}
}