HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /****************************************************************************
  2. * Chat With Your Country! *
  3. * Author: nikhilgupta345 *
  4. * *
  5. * Info: *
  6. * This plugin allows you to talk with people that are only from your *
  7. * country, by using '!' before your message. It will allow only people *
  8. * that are in your country to see it, and it will display the country name *
  9. * beside the message. *
  10. * *
  11. * Along with that, you can also team-chat and country-chat at the same time.*
  12. * So it will show the message only to the people that are on your team and *
  13. * that are in your country. *
  14. * *
  15. * *
  16. * *
  17. * This plugin is useful when you have a lot of people from a different *
  18. * language in your server, or want to keep people in the server because you *
  19. * don't want them to leave because of the different languages spoken. *
  20. * *
  21. * Changelog: *
  22. * v1.0 - Nov. 03, 2010: Plugin first released. *
  23. * *
  24. * Credits: *
  25. * Me - creating the plugin *
  26. * Multiple People - using their plugin's as an idea-base. *
  27. * *
  28. * Installation Instructions: *
  29. * -Click the 'Get Source' Link below. *
  30. * -Place countrychat.sma in your scripting folder. *
  31. * -Add 'colorchat.inc ' to your includes folder. *
  32. * -Run compile.exe *
  33. * *
  34. * Main Plugin Thread: http://forums.alliedmods.net/showthread.php?t=142303 *
  35. * *
  36. ****************************************************************************/
  37.  
  38. #include <amxmodx>
  39. #include <amxmisc>
  40. #include <geoip>
  41. #include <colorchat>
  42. #include <cstrike>
  43.  
  44. #pragma semicolon 1
  45.  
  46. new countries[33][46];
  47. new ips[33][30];
  48.  
  49. public plugin_init()
  50. {
  51. register_plugin( "Country Chat", "1.0", "nikhilgupta345" );
  52. register_clcmd( "say", "cmdSay" );
  53. register_clcmd( "say_team", "cmdSayTeam" );
  54. }
  55.  
  56. public client_connect( id )
  57. {
  58. get_user_ip( id, ips[id], charsmax( ips ) );
  59. geoip_country( ips[id], countries[id], charsmax( countries ) );
  60. }
  61.  
  62. public cmdSay( id )
  63. {
  64.  
  65. if( !equali( countries[id], "error" ) )
  66. {
  67. new message2[200];
  68. read_args( message2, charsmax( message2 ) );
  69.  
  70. if( message2[1] == '!' )
  71. {
  72. new name[32];
  73. get_user_name( id, name, 31 );
  74.  
  75. new players[32];
  76. new country[46];
  77.  
  78. copy( country, charsmax( country ), countries[id] );
  79.  
  80. new player, num;
  81.  
  82. get_players( players, num );
  83.  
  84. for( new i; i < num; i++ )
  85. {
  86. player = players[i];
  87.  
  88. if( equal( country, countries[player] ) )
  89. ColorChat( player, GREEN, "[%s] ^x03%s: ^x01%s", country, name, message2[1] );
  90. }
  91.  
  92. return PLUGIN_HANDLED;
  93. }
  94. }
  95.  
  96. return PLUGIN_CONTINUE;
  97. }
  98.  
  99. public cmdSayTeam( id )
  100. {
  101. if( !equali( countries[id], "error" ) )
  102. {
  103. new message2[200];
  104. read_args( message2, charsmax( message2 ) );
  105.  
  106. if( message2[1] == '!' )
  107. {
  108. new name[32];
  109. get_user_name( id, name, 31 );
  110.  
  111. new players[32], country[46];
  112. copy( country, charsmax( country ), countries[id] );
  113. new player, num;
  114.  
  115. get_players( players, num );
  116.  
  117. new CsTeams:team = cs_get_user_team( id );
  118.  
  119. new printTeam[32];
  120. get_user_team( id, printTeam, charsmax( printTeam ) );
  121.  
  122. for( new i; i < num; i++ )
  123. {
  124. player = players[i];
  125.  
  126. if( equal( country, countries[player] ) && team == cs_get_user_team( player ) )
  127. ColorChat( i, GREEN, "[%s] ^x01(%s) ^x03%s: ^x01%s", country, printTeam, name, message2[1] );
  128. }
  129.  
  130. return PLUGIN_HANDLED;
  131. }
  132. }
  133.  
  134. return PLUGIN_CONTINUE;
  135. }
  136.