Cerere Hud.

Categoria cu cereri de pluginuri si nu numai.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Forum rules
Accesează link-ul pentru a putea vedea regulile forumului

Daca doriti sa vi se modifice un plugin, va rugam postati aici .
Post Reply
User avatar
Doctor whO? <3
Membru, skill +3
Membru, skill +3
Posts: 1196
Joined: 21 Jun 2013, 12:40
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Reputatie: Fost Membru Club eXtreamCS (doua luni)
Has thanked: 109 times
Been thanked: 75 times
Contact:

28 May 2014, 21:31

Descriere plugin cerut: HP / Ap / Credite in HUD.
Alte informatii: As dori ca HP, AP, Credite sa apara in hud :D
Sa apara acolo sus langa viata si armura.
Folosesc depozitul cu fcs al lui Askhanar.
RoyalServer 2
User avatar
MaRyuS33
Membru, skill +1
Membru, skill +1
Posts: 232
Joined: 27 Feb 2014, 19:52
Detinator Steam: Da
CS Status: Acasă
Detinator server CS: BB.Freakz.Ro
Been thanked: 2 times
Contact:

28 May 2014, 22:01

Poftim
Click Hud | Afiseaza codul
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >



/*
 * Returns a players credits
 * 
 * @param		client - The player index to get points of
 * 
 * @return		The credits client
 * 
 */

native fcs_get_user_credits(client);

/*
 * Sets <credits> to client
 * 
 * @param		client - The player index to set points to
 * @param		credits - The amount of credits to set to client
 * 
 * @return		The credits of client
 * 
 */

native fcs_set_user_credits(client, credits);

/*
 * Adds <credits> points to client
 * 
 * @param		client - The player index to add points to
 * @param		credits - The amount of credits to add to client
 * 
 * @return		The credits of client
 * 
 */

stock fcs_add_user_credits(client, credits)
{
	return fcs_set_user_credits(client, fcs_get_user_credits(client) + credits);
}

/*
 * Subtracts <credits>  from client
 * 
 * @param		client - The player index to subtract points from
 * @param		credits - The amount of credits to substract from client
 * 
 * @return		The credits of client
 * 
 */

stock fcs_sub_user_credits(client, credits)
{
	return fcs_set_user_credits(client, fcs_get_user_credits(client) - credits);
}


new const PLUGIN_NAME[  ] = "New HUD System( Show AP / HP )";
new const PLUGIN_VERSION[  ] = "1.0";
new const PLUGIN_AUTHOR[  ] = "YONTU";

#define ColorRed		0
#define ColorGreen	255
#define ColorBlue		0

#define SpecColorRed	0
#define SpecColorGreen	200
#define SpecColorBlue	200

// Thanks Aragon for this codes( director HUD )
#define clamp_byte(%1)		( clamp( %1, 0, 255 ) )
#define pack_color(%1,%2,%3)	( %3 + ( %2 << 8 ) + ( %1 << 16 ) )

const PEV_SPEC_TARGET = pev_iuser2;

new SyncHudMessage;

new g_cvar_show_type;

public plugin_init(  ) {

	register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR );
	
	register_event( "ResetHUD", "event_ResetHud", "be" );

	RegisterHam( Ham_Spawn, "player", "Ham_PlayerSpawnedPost", 1 );

	g_cvar_show_type = register_cvar( "nhs_show", "1" );

	SyncHudMessage = CreateHudSyncObj(  );
}

public Ham_PlayerSpawnedPost( id )
	if( is_user_connected( id ) )
		set_task( 1.0, "ShowHud", id, _, _, "b" );

public event_ResetHud( id )
	ShowHud( id );

public ShowHud( id ) {

	switch( get_pcvar_num( g_cvar_show_type ) ) {

		case 0: {

			if( is_user_alive( id ) && ( get_user_team( id ) == 1 || get_user_team( id ) == 2 ) ) {

				new szMessage[ 256 ];
				formatex( szMessage, sizeof( szMessage ) - 1,"| Viata: %d  | Armura: %d  | Credite: %i |", get_user_health( id ), get_user_armor( id ), fcs_get_user_credits( id ) );

				set_hudmessage( ColorRed, ColorGreen, ColorBlue, -1.0, 0.93, 0, 0.5, 15.0, 2.0, 2.0, -1 );
				ShowSyncHudMsg( id, SyncHudMessage, szMessage );

				set_pdata_int( id, 361, get_pdata_int( id, 361 ) | ( 1<<3 ) );
			}

			else {

				new idSpec;
				new szPlayerName[ 32 ];

				idSpec = pev( id, PEV_SPEC_TARGET );
				get_user_name( idSpec, szPlayerName, 31 );

				set_hudmessage( SpecColorRed, SpecColorGreen, SpecColorBlue, -1.0, 0.7, 0, 0.5, 15.0, 2.0, 2.0, -1 );
				ShowSyncHudMsg( id, SyncHudMessage, "Spectating: %s^nHealth: %d^nArmor: %d^nCredits: %i", szPlayerName, get_user_health( idSpec ), get_user_armor( idSpec ), fcs_get_user_credits( idSpec ) );
			}
		}

		case 1: {
	
			if( is_user_connected( id ) && is_user_alive( id ) && ( get_user_team( id ) == 1 || get_user_team( id ) == 2 ) ) {

				new szMessage[ 256 ];
				formatex( szMessage, sizeof( szMessage ) - 1,"| Viata: %d  | Armura: %d  | Credite: %i |", get_user_health( id ), get_user_armor( id ), fcs_get_user_credits( id ) );

				ShowHudMessage( id, szMessage, ColorRed, ColorGreen, ColorBlue, 0.02, 0.94, 0, _, 1.0 );

				set_pdata_int( id, 361, get_pdata_int( id, 361 ) | ( 1<<3 ) );
			}

			else {

				new idSpec;
				new szPlayerName[ 32 ];

				idSpec = pev( id, PEV_SPEC_TARGET );
				get_user_name( idSpec, szPlayerName, 31 );

				new szMessage[ 256 ];
				formatex( szMessage, sizeof( szMessage ) - 1,"Spectating: %s^nViata: %d^nArmura: %d^nCredite: %i", szPlayerName, get_user_health( idSpec ), get_user_armor( idSpec ), fcs_get_user_credits( idSpec ) );

				ShowHudMessage( id, szMessage, SpecColorRed, SpecColorGreen, SpecColorBlue, -1.0, 0.7, 0, _, 1.0 );
			}
		}
	}
}

stock ShowHudMessage( const id, const szMessage[  ], red = 0, green = 160, blue = 0, Float:x = -1.0, Float:y = 0.65, effects = 2, Float:fxtime = 0.01, Float:holdtime = 3.0, Float:fadeintime = 0.01, Float:fadeouttime = 0.01 ) {

	new iCount = 1, szPlayers[ 32 ];
	
	if( id )
		szPlayers[ 0 ] = id;

	else
	get_players( szPlayers, iCount, "ch"); {

		for( new i = 0; i < iCount; i++ ) {

			if( is_user_connected( szPlayers[ i ] ) ) {

				new iColor = pack_color( clamp_byte( red ), clamp_byte( green ), clamp_byte( blue ) )
				
				message_begin( MSG_ONE_UNRELIABLE, SVC_DIRECTOR, _, szPlayers[ i ] );
				write_byte( strlen( szMessage ) + 31 );
				write_byte( DRC_CMD_MESSAGE );
				write_byte( effects );
				write_long( iColor );
				write_long( _:x );
				write_long( _:y );
				write_long( _:fadeintime );
				write_long( _:fadeouttime );
				write_long( _:holdtime );
				write_long( _:fxtime );
				write_string( szMessage );
				message_end(  );
			}
		}
	}
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1048\\ f0\\ fs16 \n\\ par }
*/
User avatar
Doctor whO? <3
Membru, skill +3
Membru, skill +3
Posts: 1196
Joined: 21 Jun 2013, 12:40
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Reputatie: Fost Membru Club eXtreamCS (doua luni)
Has thanked: 109 times
Been thanked: 75 times
Contact:

28 May 2014, 22:09

Mersi :)
Post Reply

Return to “Cereri”

  • Information
  • Who is online

    Users browsing this forum: Yandex [Bot] and 33 guests