HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /* Formatright © 2009, ConnorMcLeod
  2.  
  3. TeamAttack Notifier is free software;
  4. you can redistribute it and/or modify it under the terms of the
  5. GNU General Public License as published by the Free Software Foundation.
  6.  
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11.  
  12. You should have received a copy of the GNU General Public License
  13. along with TeamAttack Notifier; if not, write to the
  14. Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  15. Boston, MA 02111-1307, USA.
  16.  
  17. Fordította: BBk - Death of Legend
  18. */
  19.  
  20. #define ADMIN_TEAMATTACK_NOTIFY ADMIN_KICK
  21.  
  22. #include <amxmodx>
  23. #include <cstrike>
  24.  
  25. #define VERSION "0.1.0"
  26.  
  27. #define MAX_PLAYERS 32
  28.  
  29. #define HUD_PRINTTALK 3
  30.  
  31. #define NOTIFY_ALL 1
  32. #define NOTIFY_ADMINS_ONLY 2
  33.  
  34. new g_pCvarNotifier, gmsgTextMsg
  35.  
  36. public plugin_init()
  37. {
  38. register_plugin("TeamAttack Notifier", VERSION, "ConnorMcLeod")
  39.  
  40. g_pCvarNotifier = register_cvar("amx_teamattack_notifier", "1")
  41.  
  42. register_event("TextMsg", "Event_TextMsg_TeamAttack", "bc", "1=3", "2=#Game_teammate_attack")
  43.  
  44. gmsgTextMsg = get_user_msgid("TextMsg")
  45. }
  46.  
  47. public Event_TextMsg_TeamAttack()
  48. {
  49. new iMode = get_pcvar_num(g_pCvarNotifier)
  50. if( !iMode )
  51. {
  52. return
  53. }
  54.  
  55. new szName[32], iAttacker
  56.  
  57. read_data(3, szName, charsmax(szName))
  58. iAttacker = get_user_index(szName)
  59.  
  60. static const Game_teammate_attack[] = "#Game_teammate_attack"
  61.  
  62. if( is_user_connected(iAttacker) )
  63. {
  64. new CsTeams:iTeam = cs_get_user_team(iAttacker)
  65. new iPlayers[MAX_PLAYERS], iNum, id
  66.  
  67. get_players(iPlayers, iNum)
  68.  
  69. for(new i; i<iNum; i++)
  70. {
  71. id = iPlayers[i]
  72. if( cs_get_user_team(id) != iTeam
  73. && ( iMode == NOTIFY_ALL || get_user_flags(id) & ADMIN_TEAMATTACK_NOTIFY ) )
  74. {
  75. message_begin(MSG_ONE_UNRELIABLE, gmsgTextMsg, _, id)
  76. write_byte(HUD_PRINTTALK)
  77. write_string(Game_teammate_attack)
  78. write_string(szName)
  79. message_end()
  80. }
  81. }
  82. }
  83. }