Страница 1 от 1

timer hud / serverfps hud / date

Публикувано на: 06 Сеп 2020, 01:06
от L.O.F.I
you can remove score, ct / tt, round, forum and let only [the date + hour + server fps]

Код за потвърждение: Избери целия код

#include < amxmodx >		// Required by default
#include < amxmisc >		// Required for admin_access
#include < fakemeta >		// Required for Server FPS
	
#pragma semicolon 1
	
//Plugin registration

// Build CVARS:
new cvar_forum, cvar_color;
	
new g_MsgSync;
new maxplayers;
new g_round 	= 0;
new g_TeWins 	= 0;
new g_CountWins	= 0;

// FPS Function
new Float:g_fServerGameTime [ 33 ];
new g_iServerFPS [ 33 ];
new g_iCurrentServerFPS [ 33 ];
new g_iServerFrames [ 33 ];
	
	/*************************************************************/
	// Admin ACCESS
	// Default: (a)
	#define ADMIN_ACCESS		ADMIN_LEVEL_A
	/*************************************************************/
	
public plugin_init ( )
{
	// Registration
	register_plugin ("Fps Info", "1.0", "Evils");
	
	// CVARS:
	cvar_forum 	= register_cvar ( "amx_forum", "WWW.EVILS.RO" );
	cvar_color	= register_cvar ( "amx_color", "96 96 176" );
	
	// Console command for changing: forum
	register_concmd ( "amx_forum", "ChangeForum", ADMIN_ACCESS );
	
	// Events:
	register_event ( "HLTV", "evNewRound", "a", "1=0", "2=0" );
	register_event ( "TextMsg", "evRoundRestart", "a", "2&#Game_C", "2&#Game_w" );
	
	register_event ( "SendAudio", "TskTeWin", "a", "2&%!MRAD_ttwin" );
	register_event ( "SendAudio", "TskCtWin", "a", "2&%!MRAD_ctwin" );
	
	// Forwards (fakemeta); 1 = true | 0 = false;
	register_forward ( FM_StartFrame, "fwd_StartFramePost", 1 );
	
	// Task
	set_task ( 1.1, "TskShowTime", 0, "", 0, "b" );
	
	// Others
	g_MsgSync 	= CreateHudSyncObj ( );
	maxplayers	= get_maxplayers ( );
}

public TskShowTime ( )
{
	new forum [ 256 ];
	static timer [ 33 ], red, green, blue;
	get_hud_color ( red, green, blue );
	
	get_time ( "Date: %d.%m.%Y^nHour: %H:%M:%S", timer, charsmax ( timer ) );
	get_pcvar_string ( cvar_forum, forum, charsmax ( forum ) );
	
	for ( new iPlayers = 1; iPlayers <= maxplayers; iPlayers++ )
	{
		if ( !is_user_connected ( iPlayers ) || is_user_bot ( iPlayers ) )
			continue;
	
		set_hudmessage ( red, green, blue, -3.8, 0.15, 0, _, 1.0, _, _, 1 );
		ShowSyncHudMsg ( iPlayers, g_MsgSync, "%s^nWeb: %s^nRound: %d^nScore: CT: %i - TT: %i^nServer FPS: %i", timer, forum, g_round, g_CountWins, g_TeWins, g_iCurrentServerFPS [ iPlayers ] );
	}
}

public evNewRound ( )
{
	++g_round;
}

public evRoundRestart ( )
{
	g_round 	= 0;
	g_TeWins 	= 0;
	g_CountWins	= 0;
}

public TskCtWin ( )
{
	g_CountWins++;
}

public TskTeWin ( )
{
	g_TeWins++;
}

get_hud_color ( &r, &g, &b )
{
    	new color [ 20 ];
    	static red [ 5 ], green [ 5 ], blue [ 5 ];
    	get_pcvar_string ( cvar_color, color, charsmax ( color ) );
    	parse ( color, red, charsmax ( red ), green, charsmax ( green ), blue, charsmax ( blue ) );

    	r = str_to_num ( red );
    	g = str_to_num ( green );
    	b = str_to_num ( blue );
}

public ChangeForum ( id, level, cid )
{
    	if ( !cmd_access ( id, level, cid, 1 ) )
        	return 1;
	
    	new args [ 196 ];
    	read_args ( args, charsmax ( args ) );
    	remove_quotes ( args );
        
    	set_pcvar_string ( cvar_forum, args );
	console_print ( id, "[FURIEN.EVILS.RO] The forum was successfully changed to: %s", args );
	
	// Prevent unknown amx comand in console and force plugin to handle;
    	return 1;
}

public fwd_StartFramePost ( )
{
	static iPlayers [ 32 ];
	static iPlayersNum;
	
	get_players ( iPlayers, iPlayersNum, "ch" );
	if ( !iPlayersNum )
		return FMRES_IGNORED;
	
	static id, i;
	for ( i = 0; i < iPlayersNum; i++ )
	{
		id = iPlayers [ i ];
		
		// --| FPS function modified by me to gain server's fps.
		g_fServerGameTime [ id ] = get_gametime ( );
		
		if ( g_iServerFPS [ id ] >= g_fServerGameTime [ id ] )
			g_iServerFrames [ id ] += 1;
		
		else
		{
			g_iServerFPS [ id ] += 1;
			g_iCurrentServerFPS [ id ] = g_iServerFrames[ id ];
			g_iServerFrames [ id ] = 0;
		}
	}
	return FMRES_IGNORED;
}

timer hud / serverfps hud / date

Публикувано на: 06 Сеп 2020, 13:02
от JustInCase

Код за потвърждение: Избери целия код

#include < amxmodx >		// Required by default
#include < amxmisc >		// Required for admin_access
#include < fakemeta >		// Required for Server FPS
	
#pragma semicolon 1
	
//Plugin registration

// Build CVARS:
new cvar_forum, cvar_color;
	
new g_MsgSync;
new maxplayers;

// FPS Function
new Float:g_fServerGameTime [ 33 ];
new g_iServerFPS [ 33 ];
new g_iCurrentServerFPS [ 33 ];
new g_iServerFrames [ 33 ];
	
	/*************************************************************/
	// Admin ACCESS
	// Default: (a)
	#define ADMIN_ACCESS		ADMIN_LEVEL_A
	/*************************************************************/
	
public plugin_init ( )
{
	// Registration
	register_plugin ("Fps Info", "1.0", "Evils");
	
	// CVARS:
	cvar_forum 	= register_cvar ( "amx_forum", "WWW.EVILS.RO" );
	cvar_color	= register_cvar ( "amx_color", "96 96 176" );
	
	// Console command for changing: forum
	register_concmd ( "amx_forum", "ChangeForum", ADMIN_ACCESS );
	
	// Forwards (fakemeta); 1 = true | 0 = false;
	register_forward ( FM_StartFrame, "fwd_StartFramePost", 1 );
	
	// Task
	set_task ( 1.1, "TskShowTime", 0, "", 0, "b" );
	
	// Others
	g_MsgSync 	= CreateHudSyncObj ( );
	maxplayers	= get_maxplayers ( );
}

public TskShowTime ( )
{
	new forum [ 256 ];
	static timer [ 33 ], red, green, blue;
	get_hud_color ( red, green, blue );
	
	get_time ( "Date: %d.%m.%Y^nHour: %H:%M:%S", timer, charsmax ( timer ) );
	get_pcvar_string ( cvar_forum, forum, charsmax ( forum ) );
	
	for ( new iPlayers = 1; iPlayers <= maxplayers; iPlayers++ )
	{
		if ( !is_user_connected ( iPlayers ) || is_user_bot ( iPlayers ) )
			continue;
	
		set_hudmessage ( red, green, blue, -3.8, 0.15, 0, _, 1.0, _, _, 1 );
		ShowSyncHudMsg ( iPlayers, g_MsgSync, "%s^nServer FPS: %i", timer, g_iCurrentServerFPS [ iPlayers ] );
	}
}

get_hud_color ( &r, &g, &b )
{
    	new color [ 20 ];
    	static red [ 5 ], green [ 5 ], blue [ 5 ];
    	get_pcvar_string ( cvar_color, color, charsmax ( color ) );
    	parse ( color, red, charsmax ( red ), green, charsmax ( green ), blue, charsmax ( blue ) );

    	r = str_to_num ( red );
    	g = str_to_num ( green );
    	b = str_to_num ( blue );
}


public fwd_StartFramePost ( )
{
	static iPlayers [ 32 ];
	static iPlayersNum;
	
	get_players ( iPlayers, iPlayersNum, "ch" );
	if ( !iPlayersNum )
		return FMRES_IGNORED;
	
	static id, i;
	for ( i = 0; i < iPlayersNum; i++ )
	{
		id = iPlayers [ i ];
		
		// --| FPS function modified by me to gain server's fps.
		g_fServerGameTime [ id ] = get_gametime ( );
		
		if ( g_iServerFPS [ id ] >= g_fServerGameTime [ id ] )
			g_iServerFrames [ id ] += 1;
		
		else
		{
			g_iServerFPS [ id ] += 1;
			g_iCurrentServerFPS [ id ] = g_iServerFrames[ id ];
			g_iServerFrames [ id ] = 0;
		}
	}
	return FMRES_IGNORED;
}
try