HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include < amxmodx >
  2. #include < amxmisc >
  3.  
  4. new g_pHostName, g_iMsgServerName;
  5.  
  6. public plugin_init( ) {
  7. register_plugin( "amx_hostname", "1.0", "xPaw" );
  8.  
  9. register_clcmd( "amx_hostname", "CmdHostName", ADMIN_CFG, "<hostname>" );
  10.  
  11. g_iMsgServerName = get_user_msgid( "ServerName" );
  12. g_pHostName = get_cvar_pointer( "hostname" );
  13. }
  14.  
  15. public CmdHostName( const id, const iLevel, const iCid ) {
  16. if( !cmd_access( id, iLevel, iCid, 1 ) )
  17. return PLUGIN_HANDLED;
  18.  
  19. new szHostName[ 64 ];
  20.  
  21. if( read_argc( ) == 1 ) {
  22. new name[33]
  23. get_user_name(id, name, 32)
  24. print_color(0, "!t[Info]!y %s!g Frisstette a szerver nevt.",name );
  25.  
  26. get_pcvar_string( g_pHostName, szHostName, 63 );
  27. } else {
  28. read_argv( 1, szHostName, 63 );
  29.  
  30. set_pcvar_string( g_pHostName, szHostName );
  31.  
  32. new name[33]
  33. get_user_name(id, name, 32)
  34. print_color(0, "!t[Info]!y %s!g Megvltoztatta a szerver nevt!!t A szerver j neve:!y %s",name, szHostName );
  35. }
  36.  
  37. message_begin( MSG_BROADCAST, g_iMsgServerName );
  38. write_string( szHostName );
  39. message_end( );
  40.  
  41. return PLUGIN_HANDLED;
  42. }
  43.  
  44. stock print_color(const id, const input[], any:...)
  45. {
  46. new count = 1, players[32]
  47. static msg[191]
  48. vformat(msg, 190, input, 3)
  49.  
  50. replace_all(msg, 190, "!g", "^4")
  51. replace_all(msg, 190, "!y", "^1")
  52. replace_all(msg, 190, "!t", "^3")
  53. replace_all(msg, 190, "", "á")
  54. replace_all(msg, 190, "", "é")
  55. replace_all(msg, 190, "", "í")
  56. replace_all(msg, 190, "", "ó")
  57. replace_all(msg, 190, "", "ö")
  58. replace_all(msg, 190, "", "ő")
  59. replace_all(msg, 190, "", "ú")
  60. replace_all(msg, 190, "", "ü")
  61. replace_all(msg, 190, "", "ű")
  62. replace_all(msg, 190, "", "Á")
  63. replace_all(msg, 190, "", "É")
  64. replace_all(msg, 190, "", "Í")
  65. replace_all(msg, 190, "", "Ó")
  66. replace_all(msg, 190, "", "Ö")
  67. replace_all(msg, 190, "", "Ő")
  68. replace_all(msg, 190, "", "Ú")
  69. replace_all(msg, 190, "", "Ü")
  70. replace_all(msg, 190, "", "Ű")
  71.  
  72. if (id) players[0] = id; else get_players(players, count, "ch")
  73. {
  74. for (new i = 0; i < count; i++)
  75. {
  76. if (is_user_connected(players[i]))
  77. {
  78. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
  79. write_byte(players[i])
  80. write_string(msg)
  81. message_end()
  82. }
  83. }
  84. }
  85. return PLUGIN_HANDLED
  86. }