#include < amxmodx >
#include < amxmisc >
new g_pHostName, g_iMsgServerName;
public plugin_init( ) {
register_plugin( "amx_hostname", "1.0", "xPaw" );
register_clcmd( "amx_hostname", "CmdHostName", ADMIN_CFG, "<hostname>" );
g_iMsgServerName = get_user_msgid( "ServerName" );
g_pHostName = get_cvar_pointer( "hostname" );
}
public CmdHostName( const id, const iLevel, const iCid ) {
if( !cmd_access( id, iLevel, iCid, 1 ) )
return PLUGIN_HANDLED;
new szHostName[ 64 ];
if( read_argc( ) == 1 ) {
console_print( id, "[AMXX] Szervernev frissitve." );
get_pcvar_string( g_pHostName, szHostName, 63 );
} else {
read_argv( 1, szHostName, 63 );
set_pcvar_string( g_pHostName, szHostName );
console_print( id, "[AMXX] Te bealitottad a szervernevet ^"%s^".", szHostName );
}
message_begin( MSG_BROADCAST, g_iMsgServerName );
write_string( szHostName );
message_end( );
return PLUGIN_HANDLED;
}