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. console_print( id, "[AMXX] Szervernev frissitve." );
  23.  
  24. get_pcvar_string( g_pHostName, szHostName, 63 );
  25. } else {
  26. read_argv( 1, szHostName, 63 );
  27.  
  28. set_pcvar_string( g_pHostName, szHostName );
  29.  
  30. console_print( id, "[AMXX] Te bealitottad a szervernevet ^"%s^".", szHostName );
  31. }
  32.  
  33. message_begin( MSG_BROADCAST, g_iMsgServerName );
  34. write_string( szHostName );
  35. message_end( );
  36.  
  37. return PLUGIN_HANDLED;
  38. }