Harry Potter's Magic Wand [0.0.3]

Pluginuri facute de utilizatorii forumului eXtream.

Moderators: Moderatori ajutatori, Moderatori

User avatar
YONTU
Moderator ajutator
Moderator ajutator
Posts: 2480
Joined: 10 May 2013, 13:25
Detinator Steam: Nu
CS Status: Everyone is looking at ur shoes
Reputatie: Moderator ajutator
Fost scripter eXtreamCS
Location: Gura Humorului
Has thanked: 260 times
Been thanked: 279 times
Contact:

24 Jan 2014, 19:26

Descriere: Acest plugin adauga in jocul Counter Strike o bagheta "fermecata". Sa zicem ca este o arma ca toate celelalte!
Descarcare v0.0.2: GirlShare! | ZippyShare!
Descarcare v0.0.3: GirlShare! | ZippyShare!
Harry Potter's Magic Wand (all versions).zip
SMA v0.0.2 | Afiseaza codul
/* Plugin generated by AMXX-Studio */

#include < amxmodx >
#include < amxmisc >
#include < cstrike >
#include < hamsandwich >
#include < fakemeta >
#include < engine >
#include < message_const >
#include < CC_ColorChat >

#define PLUGIN_NAME		"Harry Potter's Magic Wand"
#define PLUGIN_VERSION	"0.0.2"
#define PLUGIN_AUTHOR	"Hades Ownage & YONTU"

#define HARRY_WAND_RECOIL 	0.0			// Recoil
#define HARRY_WAND_SPEED 	0.35			// Click stanga
#define HARRY_WAND_SPEED2 	0.75			// Click dreapta
#define HARRY_WAND_FIRE	random_num( 3, 6 )	// Animatie cand trage cu click stanga
#define HARRY_WAND_FIRE2	random_num( 5, 10 )	// Animatie cand trage cu click dreapta

#define TE_BEAMENTPOINT	1
#define TE_EXPLOSION		3
#define TE_SPRITETRAIL		15
#define TE_BEAMCYLINDER		21

new const Tag[  ] = "[Harry Magic Wand]";

new HarryFireSound[  ] = "harry_wand/harry_shoot1.wav";
new HarryHitSound[  ] = "harry_wand/harry_hit.wav";
new HarryHitSound2[  ] = "harry_wand/harry_shoot2.wav";
new HarryModel[  ] = "models/harry_wand/v_harry_wand.mdl";

new HarryBeam, HarryExp, HarryExp2, DeathSprite;

new bool:g_HasHarryWand[ 33 ];

new Harry_Ammo[ 33 ];
new Float:HarryLastShotTime[ 33 ];

new HarryDamageCvar, HarryDamageCvar2, HarryAmmo, HarryKillMoney, HarryDistance, HarryMagicCost;

public plugin_init(  ) {

	register_event( "CurWeapon", "CurrentWeapon", "be", "1=1" );
	
	register_forward( FM_CmdStart, "Harry_CmdStart" );
	
	RegisterHam( Ham_Spawn, "player", "Ham_SpawnCallback", 1 );
	
	HarryDamageCvar = register_cvar( "harry_damage", "80.0" );
	HarryDamageCvar2 = register_cvar( "harry_damage2", "135.0" );
	HarryAmmo = register_cvar( "harry_ammo", "300" );
	HarryKillMoney = register_cvar( "harry_money_reward", "5000" );
	HarryDistance = register_cvar( "harry_distance", "90909" );
	HarryMagicCost = register_cvar( "harry_cost", "10000" );

	register_concmd( "amx_get_harry", "GiveHarry", ADMIN_BAN, "< nume > < ammo >" );

	register_clcmd( "say /magic", "ClCmdBuyMagicWand" );
	register_clcmd( "say_team /magic", "ClCmdBuyMagicWand" );
}

public plugin_precache(  ) {
	
	register_plugin( PLUGIN_NAME, 
			PLUGIN_VERSION, 
			PLUGIN_AUTHOR );

	precache_sound( HarryFireSound );
	precache_sound( HarryHitSound );
	precache_sound( HarryHitSound2 );

	precache_model( HarryModel );

	HarryBeam = precache_model( "sprites/harry_wand/harry_plasma_beam.spr" );
	HarryExp = precache_model( "sprites/harry_wand/harry_plasma_exp2.spr" );
	HarryExp2 = precache_model( "sprites/harry_wand/harry_plasma_exp3.spr" );
	DeathSprite = precache_model( "sprites/harry_wand/harry_skull.spr" );
}

public client_putinserver( id ) {
		
	g_HasHarryWand[ id ] = false;
	Harry_Ammo[ id ] = false;
}

public client_disconnect( id ) {
	
	g_HasHarryWand[ id ] = false;
	Harry_Ammo[ id ] = false;
}

public ClCmdBuyMagicWand( id ) {

	new HarryCost = get_pcvar_num( HarryMagicCost );

	if( g_HasHarryWand[ id ] ) {

		ColorChat( id, GREEN, "^x04%s^x03 Ai deja bagheta !", Tag );
		return 1;
	}

	else if( !is_user_alive( id ) ) {

		ColorChat( id, GREEN, "^x04%s^x01 Nu poti cumpara bagheta cat timp esti mort.", Tag );
		return 1;
	}

	else if( cs_get_user_money( id ) < HarryCost ) {

		ColorChat( id, GREEN, "^x04%s^x01 Mai ai nevoie de^x03 %i $^x01 pentru a cumpara bagheta !", Tag, HarryCost - cs_get_user_money( id ) );
		return 1;
	}

	else {

		get_harry( id );

		ColorChat( id, GREEN, "^x04%s^x01 Ai cumparat bagheta pentru^x03 %i $^x01", Tag, HarryCost );
		cs_set_user_money( id, cs_get_user_money( id ) - HarryCost );

		return 1;
	}

	return 1;
}

public GiveHarry( id, level, cid ) {
	
	if( !cmd_access( id, level, cid, 3 ) ) 
		return PLUGIN_HANDLED;
	
	new szTtarget[ 32 ], szAmmoHarry[ 21 ];
	
	read_argv( 1, szTtarget, 31 );
	read_argv( 2, szAmmoHarry, 20 );

	new iPlayer = cmd_target( id, szTtarget, 8 );

	new szAdminName[ 32 ], szPlayerName[ 32 ];

	get_user_name( id, szAdminName, 31 );
	get_user_name( iPlayer, szPlayerName, 31 );

	if( !iPlayer )
		return PLUGIN_HANDLED;

	if( !is_user_alive( iPlayer ) ) {

		client_print( id, print_console, "Jucatorul %s nu este in viata !", szPlayerName );
		return 1;
	}

	if( g_HasHarryWand[ iPlayer ] ) {

		client_print( id, print_console, "Jucatorul %s are deja bagheta !", szPlayerName );
		return 1;
	}

	else {
	
		new AmmoForMagic = str_to_num( szAmmoHarry );

		ColorChat( 0, GREEN, "^x04%s^x01 Adminul^x03 %s i-a dat lui^x03 %s^x01 bagheta lui Harry cu^x03 %d ammo^x01 !", Tag, szAdminName, szPlayerName, szAmmoHarry );

		get_harry( iPlayer );
		Harry_Ammo[ iPlayer ] += AmmoForMagic;
	}

	return PLUGIN_CONTINUE;
}

public get_harry( id ) {

	if( is_user_alive( id ) ) {

		g_HasHarryWand[ id ] = true;
		engclient_cmd( id, "weapon_knife" );

		Harry_Ammo[ id ] = get_pcvar_num( HarryAmmo );
	}

	else {

		client_print( id, print_console, "Jucatorul nu este in viata! " );
		g_HasHarryWand[ id ] = false;

		return 1;
	}

	return 1;
}

public CurrentWeapon( id )
	if( get_user_weapon( id ) == CSW_KNIFE && g_HasHarryWand[ id ] )
		set_pev( id, pev_viewmodel2, HarryModel );

public Ham_SpawnCallback( id ) {
	
	if( !is_user_alive( id ) )
		return 1;
	
	g_HasHarryWand[ id ] = false;
	
	return 0;
}

public Harry_CmdStart( id, uc_handle, seed ) {
	
	if( is_user_alive( id ) && g_HasHarryWand[ id ] ) {
		
		static CurButton;
		CurButton = get_uc( uc_handle, UC_Buttons );
		new Float:flNextAttack = get_pdata_float( id, 83, 5 );

		if( CurButton & IN_ATTACK ) {

			if( get_user_weapon( id ) == CSW_KNIFE && g_HasHarryWand[ id ] ) {

				if( Harry_Ammo[ id ] > 0  && flNextAttack <= 0.0 ) {

					if( get_gametime(  ) - HarryLastShotTime[ id ] > HARRY_WAND_SPEED ) {
						
						set_weapon_anim( id, HARRY_WAND_FIRE );
						emit_sound( id, CHAN_WEAPON, HarryFireSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
						
						Harry_Fire( id );

						if( Harry_Ammo[ id ] > 0 ) {
							
							set_hudmessage( 0, 127, 255, 0.01, 0.85, 0, 6.0, 1.0 );
							show_hudmessage( id, "Remaining Ammo: %d !", Harry_Ammo[ id ] );
						}
						
						else if( Harry_Ammo[ id ] <= 0 ) {
							
							set_hudmessage( 255, 0, 0, 0.01, 0.90, 0, 6.0, 1.0 );
							show_hudmessage( id, "No Ammo !" );
							
						}
						
						static Float:Punch_Angles[ 3 ];
						
						Punch_Angles[ 0]  = -5.0;
						Punch_Angles[ 1 ] = HARRY_WAND_RECOIL;
						Punch_Angles[ 2 ] = HARRY_WAND_RECOIL;
						
						set_pev( id, pev_punchangle, Punch_Angles );

						Harry_Ammo[ id ] -= 1;
						HarryLastShotTime[ id ] = get_gametime(  );
						
					}	
				}
				
				CurButton &= ~IN_ATTACK;
				set_uc( uc_handle, UC_Buttons, CurButton );
			}		
		}
		
		else if( CurButton & IN_ATTACK2 ) {

			if( get_user_weapon( id ) == CSW_KNIFE && g_HasHarryWand[ id ] ) {

				if( Harry_Ammo[ id ] >= 5  && flNextAttack <= 0.0 ) {

					if( get_gametime(  ) - HarryLastShotTime[ id ] > HARRY_WAND_SPEED2 ) {
						
						set_weapon_anim( id, HARRY_WAND_FIRE2 );
						emit_sound( id, CHAN_WEAPON, HarryFireSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
						
						Harry_Fire2( id );

						set_hudmessage( 0, 127, 255, 0.01, 0.85, 0, 6.0, 1.0 );
						show_hudmessage( id, "Remaining Ammo: %d !", Harry_Ammo[ id ] );
						
						static Float:Punch_Angles[ 3 ];
						
						Punch_Angles[ 0 ] = -5.0;
						Punch_Angles[ 1 ] = HARRY_WAND_RECOIL;
						Punch_Angles[ 2 ] = HARRY_WAND_RECOIL;
						
						set_pev( id, pev_punchangle, Punch_Angles );

						Harry_Ammo[ id ] -= 3;
						HarryLastShotTime[ id ] = get_gametime(  );
						
					}	
				}
				
				CurButton &= ~IN_ATTACK2;
				set_uc( uc_handle, UC_Buttons, CurButton );
			}
		}
	}
	
	else if( is_user_alive ( id ) && !g_HasHarryWand[ id ] )
		return PLUGIN_CONTINUE;

	return PLUGIN_CONTINUE;
}

public Harry_Fire( id ) {
	
	static Victim, Body, EndOrigin[ 3 ], BeamOrigin[ 3 ];
	get_user_origin( id, BeamOrigin, 3 );
	get_user_origin( id, EndOrigin, 3 );

	message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
	write_byte( 1 );
	write_short( id | 0x1000 );
	write_coord( BeamOrigin[ 0 ] );	// Start X
	write_coord( BeamOrigin[ 1 ] );	// Start Y
	write_coord( BeamOrigin[ 2 ] );	// Start Z
	write_short( HarryBeam);		// Sprite
	write_byte( 1 );      		// Start frame				
	write_byte( 1 );     		// Frame rate					
	write_byte( 1 );			// Life
	write_byte( 40 );   		// Line width				
	write_byte( 0 );    		// Noise
	write_byte( 108 ); 		// Red
	write_byte( 236 );			// Green
	write_byte( 23 );			// Blue
	write_byte( 150 );     		// Brightness					
	write_byte( 25 );      		// Scroll speed					
	message_end(  );

	message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
	write_byte( 3 );
	write_coord( EndOrigin[ 0 ] );
	write_coord( EndOrigin[ 1 ] );
	write_coord( EndOrigin[ 2 ] );
	write_short( HarryExp );	// sprite
	write_byte( 10 );		// scale in 0.1's
	write_byte( 15 );		// framerate
	write_byte( 4 );		// flags
	message_end(  );
	
	get_user_aiming( id, Victim, Body, get_pcvar_num( HarryDistance ) );

	if( is_user_connected( Victim ) ) {

		new Float:Damage = float( get_damage_body( Body, get_pcvar_float( HarryDamageCvar ) ) );
		
		new Float:VictimOrigin[ 3 ];
		VictimOrigin[ 0 ] = float( EndOrigin[ 0 ] );
		VictimOrigin[ 1 ] = float( EndOrigin[ 1 ] );
		VictimOrigin[ 2 ] = float( EndOrigin[ 2 ] );
		
		if( get_user_health( Victim ) - get_pcvar_float( HarryDamageCvar ) >= 1 && is_user_alive( Victim ) && !fm_get_user_godmode( Victim ) && get_user_team( Victim ) != get_user_team( id ) ) {

			new iOrigin[ 3 ];
			get_user_origin( Victim, iOrigin, 0 );

			message_begin( MSG_PVS, SVC_TEMPENTITY, iOrigin ); 
			write_byte( 21 );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] + 60 );	// end axis + radius
			write_short( HarryExp );	// sprite
			write_byte( 0 );		// startfrate
			write_byte( 0 );		// framerate
			write_byte( 10 );		// life in 0.1 sec
			write_byte( 60 );		// width
			write_byte( 0 );		// amplitude
			write_byte( 0 );		// red
			write_byte( 200 );		// green
			write_byte( 200 );		// blue
			write_byte( 153 );		// brightness
			write_byte( 0 );		// speed
			message_end(  );
			
			message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
			write_byte( 15 );
			write_coord( iOrigin[ 0 ] ); 	// start position (X)
			write_coord( iOrigin[ 1 ] ); 	// start position (Y)
			write_coord( iOrigin[ 2 ] + 40 ); // start position (Z)
			write_coord( iOrigin[ 0 ] ); 	// end position (X)
			write_coord( iOrigin[ 1 ] );	// end position (Y)
			write_coord( iOrigin[ 2 ] );	// end position (Z)
			write_short( DeathSprite );	// sprite index
			write_byte( 50 );		// count
			write_byte( 20 );		// life in 0.1's
			write_byte( 2 );		// scale in 0.1's
			write_byte( 50 );		// velocity along vector in 10's
			write_byte( 10 );		// randomness of velocity in 10's
			message_end(  );
			
			make_knockback( Victim, VictimOrigin, 3 * get_pcvar_float( HarryDamageCvar ) );
			
			ExecuteHam( Ham_TakeDamage, Victim, id, id, Damage, DMG_NERVEGAS );
			
			message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "Damage" ), _, Victim );
			write_byte( 0 );
			write_byte( 0 );
			write_long( DMG_SHOCK );
			write_coord( 0 );
			write_coord( 0 );
			write_coord( 0 );
			message_end(  );
			
			FadeScreen( Victim, 4.0, 255, 122, 122, 100 );
			ShakeScreen( Victim, 3.0 );
		}

		else if( get_user_health( Victim ) - get_pcvar_float( HarryDamageCvar ) < 1 && is_user_alive( Victim ) && !fm_get_user_godmode( Victim ) && get_user_team( Victim ) != get_user_team( id ) ) {
			
			new iOrigin[ 3 ];
			get_user_origin( Victim, iOrigin, 0 );

			message_begin( MSG_PVS, SVC_TEMPENTITY, iOrigin ); 
			write_byte( 21 );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] + 60 );	// end axis + radius
			write_short( HarryExp );	// sprite
			write_byte( 0 );		// startfrate
			write_byte( 0 );		// framerate
			write_byte( 10 );		// life in 0.1 sec
			write_byte( 60 );		// width
			write_byte( 0 );		// amplitude
			write_byte( 0 );		// red
			write_byte( 200 );		// green
			write_byte( 200 );		// blue
			write_byte( 153 );		// brightness
			write_byte( 0 );		// speed
			message_end(  );
			
			message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
			write_byte( 15 );
			write_coord( iOrigin[ 0 ] ); 	// start position (X)
			write_coord( iOrigin[ 1 ] ); 	// start position (Y)
			write_coord( iOrigin[ 2 ] + 40 ); // start position (Z)
			write_coord( iOrigin[ 0 ] ); 	// end position (X)
			write_coord( iOrigin[ 1 ] );	// end position (Y)
			write_coord( iOrigin[ 2 ] );	// end position (Z)
			write_short( DeathSprite );	// sprite index
			write_byte( 50 );		// count
			write_byte( 20 );		// life in 0.1's
			write_byte( 2 );		// scale in 0.1's
			write_byte( 50 );		// velocity along vector in 10's
			write_byte( 10 );		// randomness of velocity in 10's
			message_end(  );
			
			make_knockback( Victim, VictimOrigin, 3 * get_pcvar_float( HarryDamageCvar ) );
			
			death_message( id, Victim, 1, "Magic Wand" );
		}
	}

	else {

		static ClassName[ 32 ];
		pev( Victim, pev_classname, ClassName, charsmax( ClassName ) );

		if( equal( ClassName, "func_breakable" ) )
			if( entity_get_float( Victim, EV_FL_health ) <= 80 )
				force_use( id, Victim );
	}
	
	emit_sound( id, CHAN_WEAPON, HarryHitSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
}

public Harry_Fire2( id ) {
	
	static Victim, Body, EndOrigin[3], BeamOrigin[3];
	get_user_origin( id, BeamOrigin, 3 ) ;
	get_user_origin( id, EndOrigin, 3 );

	message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
	write_byte( 1 );
	write_short( id | 0x1000 );
	write_coord( BeamOrigin[ 0 ] );	// Start X
	write_coord( BeamOrigin[ 1 ] );	// Start Y
	write_coord( BeamOrigin[ 2 ] );	// Start Z
	write_short( HarryBeam );	// Sprite
	write_byte( 1 );      		// Start frame				
	write_byte( 1 );     		// Frame rate					
	write_byte( 1 );			// Life
	write_byte( 40 );   		// Line width				
	write_byte( 0 );    		// Noise
	write_byte( 150 ); 		// Red
	write_byte( 22 );			// Green
	write_byte( 235 );			// Blue
	write_byte( 150 );     		// Brightness					
	write_byte( 25 );      		// Scroll speed					
	message_end(  );

	message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
	write_byte( 3 );
	write_coord( EndOrigin[ 0 ] );
	write_coord( EndOrigin[ 1 ] );
	write_coord( EndOrigin[ 2 ] );
	write_short( HarryExp2 );
	write_byte( 10 );
	write_byte( 15 );
	write_byte( 4 );
	message_end(  );
	
	get_user_aiming( id, Victim, Body, get_pcvar_num( HarryDistance ) );

	if( is_user_alive( Victim ) ) {

		new Float:Damage = float( get_damage_body( Body, get_pcvar_float( HarryDamageCvar ) ) );

		new Float:VictimOrigin[ 3 ];
		VictimOrigin[ 0 ] = float( EndOrigin[ 0 ] );
		VictimOrigin[ 1 ] = float( EndOrigin[ 1 ] );
		VictimOrigin[ 2 ] = float( EndOrigin[ 2 ] );
		
		if( get_user_health( Victim ) - get_pcvar_float( HarryDamageCvar2 ) >= 1 && is_user_alive( Victim ) && !fm_get_user_godmode( Victim ) && get_user_team( Victim ) != get_user_team( id ) ) {
			
			new iOrigin[ 3 ];
			get_user_origin( Victim, iOrigin, 0 );

			message_begin( MSG_PVS, SVC_TEMPENTITY, iOrigin ); 
			write_byte( 21 );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] + 60 );	// end axis + radius
			write_short( HarryExp2 );	// sprite
			write_byte( 0 );		// startfrate
			write_byte( 0 );		// framerate
			write_byte( 10 );		// life in 0.1 sec
			write_byte( 60 );		// width
			write_byte( 0 );		// amplitude
			write_byte( 217 );		// red
			write_byte( 132 );		// green
			write_byte( 47 );		// blue
			write_byte( 153 );		// brightness
			write_byte( 0 );		// speed
			message_end(  );
			
			message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
			write_byte( 15 );
			write_coord( iOrigin[ 0 ] ); 	// start position (X)
			write_coord( iOrigin[ 1 ] ); 	// start position (Y)
			write_coord( iOrigin[ 2 ] + 40 ); // start position (Z)
			write_coord( iOrigin[ 0 ] ); 	// end position (X)
			write_coord( iOrigin[ 1 ] );	// end position (Y)
			write_coord( iOrigin[ 2 ] );	// end position (Z)
			write_short( DeathSprite );	// sprite index
			write_byte( 50 );		// count
			write_byte( 20 );		// life in 0.1's
			write_byte( 2 );		// scale in 0.1's
			write_byte( 50 );		// velocity along vector in 10's
			write_byte( 10 );		// randomness of velocity in 10's
			message_end(  );
			
			make_knockback( Victim, VictimOrigin, 3 * get_pcvar_float( HarryDamageCvar2 ) );
			
			ExecuteHam( Ham_TakeDamage, Victim, id, id, Damage, DMG_NERVEGAS );
			
			message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "Damage" ), _, Victim );
			write_byte( 0 );
			write_byte( 0 );
			write_long( DMG_NERVEGAS );
			write_coord( 0 ) ;
			write_coord( 0 );
			write_coord( 0 );
			message_end(  );
			
			FadeScreen( Victim, 4.0, 0, 255, 0, 100 );
			ShakeScreen( Victim, 3.0 );
		}

		else if( get_user_health( Victim ) - get_pcvar_float( HarryDamageCvar2 ) < 1 && is_user_alive( Victim ) && !fm_get_user_godmode( Victim ) && get_user_team( Victim ) != get_user_team( id ) ) {
			
			new iOrigin[ 3 ];
			get_user_origin( Victim, iOrigin, 0 );

			message_begin( MSG_PVS, SVC_TEMPENTITY, iOrigin ); 
			write_byte( 21 );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] + 60 );	// end axis + radius
			write_short( HarryExp2 );	// sprite
			write_byte( 0 );		// startfrate
			write_byte( 0 );		// framerate
			write_byte( 10 );		// life in 0.1 sec
			write_byte( 60 );		// width
			write_byte( 0 );		// amplitude
			write_byte( 217 );		// red
			write_byte( 132 );		// green
			write_byte( 47 );		// blue
			write_byte( 153 );		// brightness
			write_byte( 0 );		// speed
			message_end(  );
			
			message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
			write_byte( 15 );
			write_coord( iOrigin[ 0 ] ); 	// start position (X)
			write_coord( iOrigin[ 1 ] ); 	// start position (Y)
			write_coord( iOrigin[ 2 ] + 40 ); // start position (Z)
			write_coord( iOrigin[ 0 ] ); 	// end position (X)
			write_coord( iOrigin[ 1 ] );	// end position (Y)
			write_coord( iOrigin[ 2 ] );	// end position (Z)
			write_short( DeathSprite );	// sprite index
			write_byte( 50 );		// count
			write_byte( 20 );		// life in 0.1's
			write_byte( 2 );		// scale in 0.1's
			write_byte( 50 );		// velocity along vector in 10's
			write_byte( 10 );		// randomness of velocity in 10's
			message_end(  );
			
			make_knockback( Victim, VictimOrigin, 3 * get_pcvar_float( HarryDamageCvar2 ) );
			
			death_message( id, Victim, 1, "Double Magic Wand" );
		}
	}

	else {

		static ClassName[ 32 ];
		pev( Victim, pev_classname, ClassName, charsmax( ClassName ) );

		if( equal( ClassName, "func_breakable" ) )
			if( entity_get_float( Victim, EV_FL_health ) <= 80 )
				force_use( id, Victim );
	}

	emit_sound( id, CHAN_WEAPON, HarryHitSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
}

public make_knockback( Victim, Float:origin[ 3 ], Float:maxspeed ) {

	new Float:fVelocity[ 3 ];
	
	kickback( Victim, origin, maxspeed, fVelocity );
	entity_set_vector( Victim, EV_VEC_velocity, fVelocity );
	
	return( 1 );
}

stock ShakeScreen( id, const Float:iSeconds ) {

	message_begin( MSG_ONE, get_user_msgid( "ScreenShake" ), { 0, 0, 0 }, id );
	write_short( floatround( 4096.0 * iSeconds, floatround_round ) );
	write_short( floatround( 4096.0 * iSeconds, floatround_round ) );
	write_short( 1<<13 );
	message_end(  );
}

stock FadeScreen( id, const Float:iSeconds, const iRed, const iGreen, const iBlue, const iAlpha ) {
      
	message_begin( MSG_ONE, get_user_msgid( "ScreenFade" ), _, id );
	write_short( floatround( 4096.0 * iSeconds, floatround_round ) );
	write_short( floatround( 4096.0 * iSeconds, floatround_round ) );
	write_short( 0x0000 );
	write_byte( iRed );
	write_byte( iGreen );
	write_byte( iBlue );
	write_byte( iAlpha );
	message_end(  );
}		

stock kickback( ent, Float:fOrigin[ 3 ], Float:fSpeed, Float:fVelocity[ 3 ] ) {

	new Float:fEntOrigin[ 3 ];
	entity_get_vector( ent, EV_VEC_origin, fEntOrigin );
	
	new Float:fDistance[ 3 ];
	fDistance[ 0 ] = fEntOrigin[ 0 ] - fOrigin[ 0 ];
	fDistance[ 1 ] = fEntOrigin[ 1 ] - fOrigin[ 1 ];
	fDistance[ 2 ] = fEntOrigin[ 2 ] - fOrigin[ 2 ];

	new Float:fTime =( vector_distance( fEntOrigin, fOrigin ) / fSpeed );
	fVelocity[ 0 ] = fDistance[ 0 ] / fTime;
	fVelocity[ 1 ] = fDistance[ 1 ] / fTime;
	fVelocity[ 2 ] = fDistance[ 2 ] / fTime;
	
	return( fVelocity[ 0 ] && fVelocity[ 1 ] && fVelocity[ 2 ] );
}

// stock from "m79"
stock death_message( Killer, Victim, ScoreBoard, const Weapon[  ] ) {
	
	set_msg_block( get_user_msgid( "DeathMsg" ), BLOCK_SET );

	ExecuteHamB( Ham_Killed, Victim, Killer, 2 );

	set_msg_block( get_user_msgid( "DeathMsg" ), BLOCK_NOT );

	make_deathmsg( Killer, Victim, 0, Weapon );
	cs_set_user_money( Killer, cs_get_user_money( Killer ) + get_pcvar_num( HarryKillMoney ) );
	
	if( ScoreBoard ) {

		message_begin( MSG_BROADCAST, get_user_msgid( "ScoreInfo" ) );
		write_byte( Killer );
		write_short( pev( Killer, pev_frags ) );
		write_short( cs_get_user_deaths( Killer ) );
		write_short( 0 );
		write_short( get_user_team( Killer ) );
		message_end(  );
		
		message_begin( MSG_BROADCAST, get_user_msgid( "ScoreInfo" ) );
		write_byte( Victim );
		write_short( pev( Victim, pev_frags ) );
		write_short( cs_get_user_deaths( Victim ) );
		write_short( 0 );
		write_short( get_user_team( Victim ) );
		message_end(  );
	}
}

stock set_weapon_anim( id, anim ) {

	set_pev( id, pev_weaponanim, anim );

	if( is_user_alive( id ) ) {

		message_begin( MSG_ONE, SVC_WEAPONANIM, _, id );
		write_byte( anim );
		write_byte( pev( id, pev_body ) );
		message_end(  );
	}
}

stock get_damage_body( body, Float:fDamage ) {

	switch( body ) {

		case HIT_HEAD: fDamage *= 4.0;

		case HIT_STOMACH: fDamage *= 1.1;

		case HIT_CHEST: fDamage *= 1.5;

		case HIT_LEFTARM: fDamage *= 0.77;

		case HIT_RIGHTARM: fDamage *= 0.77;

		case HIT_LEFTLEG: fDamage *= 0.75;

		case HIT_RIGHTLEG: fDamage *= 0.75;

		default: fDamage *= 1.0;
	}
	
	return floatround( fDamage );
}

// stock from "fakemeta_util"
stock fm_get_user_godmode( index ) {

	new Float:val;
	pev( index, pev_takedamage, val );

	return ( val == DAMAGE_NO );
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
SMA v0.0.3 | Afiseaza codul
/* Plugin generated by AMXX-Studio */

#include < amxmodx >
#include < amxmisc >
#include < hamsandwich >
#include < fakemeta >
#include < engine >
#include < message_const >
#include < CC_ColorChat >

#define PLUGIN_NAME	"Harry Potter's Magic Wand"
#define PLUGIN_VERSION	"0.0.3"
#define PLUGIN_AUTHOR	"Hades Ownage & YONTU"

#define HARRY_WAND_RECOIL 	0.0			// Recoil
#define HARRY_WAND_SPEED 	0.35			// Click stanga
#define HARRY_WAND_SPEED2 	0.75			// Click dreapta
#define HARRY_WAND_FIRE	random_num( 3, 6 )	// Animatie cand trage cu click stanga
#define HARRY_WAND_FIRE2	random_num( 5, 10 )	// Animatie cand trage cu click dreapta

#define TE_BEAMENTPOINT	1
#define TE_EXPLOSION		3
#define TE_SPRITETRAIL		15
#define TE_BEAMCYLINDER		21

/* Aici stergeti // din fata in functie de ce sistem de credite/puncte/xp folositi.
*  Acest plugin este compatibil cu sistemul de credite al lui Askhanar, Aragon, un sistem de puncte, si default, cu bani.
*/
#define ASKHANAR_CREDITS
//#define ARAGON_CREDITS
//#define POINTS
//#define MONEY

#if defined ASKHANAR_CREDITS
	native fcs_get_user_credits( id );
	native fcs_set_user_credits( id, amounts );
#endif

#if defined ARAGON_CREDITS
	native get_user_credits( id );
	native set_user_credits( id, amounts );
#endif

#if defined POINTS
	native get_user_points( id );
	native set_points( id, amounts );
#endif

#if defined MONEY
	native cs_get_user_money( id );
	native cs_set_user_money( id, amounts );
#endif


new const Tag[  ] = "[Harry Magic Wand]";

new HarryFireSound[  ] = "harry_wand/harry_shoot1.wav";
new HarryHitSound[  ] = "harry_wand/harry_hit.wav";
new HarryHitSound2[  ] = "harry_wand/harry_shoot2.wav";
new HarryModel[  ] = "models/harry_wand/v_harry_wand.mdl";

new HarryBeam, HarryExp, HarryExp2, DeathSprite;

new bool:g_HasHarryWand[ 33 ];

new Harry_Ammo[ 33 ];
new Float:HarryLastShotTime[ 33 ];

new HarryDamageCvar, HarryDamageCvar2, HarryAmmo, HarryKillMoney, HarryDistance, HarryMagicCost;

public plugin_init(  ) {

	register_event( "CurWeapon", "CurrentWeapon", "be", "1=1" );
	
	register_forward( FM_CmdStart, "Harry_CmdStart" );
	
	RegisterHam( Ham_Spawn, "player", "Ham_SpawnCallback", 1 );
	
	HarryDamageCvar = register_cvar( "harry_damage", "80.0" );
	HarryDamageCvar2 = register_cvar( "harry_damage2", "135.0" );
	HarryAmmo = register_cvar( "harry_ammo", "300" );
	HarryKillMoney = register_cvar( "harry_kill_reward", "10" );
	HarryDistance = register_cvar( "harry_distance", "90909" );
	HarryMagicCost = register_cvar( "harry_cost", "70" );

	register_concmd( "amx_get_harry", "GiveHarry", ADMIN_BAN, "< nume > < ammo >" );

	register_clcmd( "say /magic", "ClCmdBuyMagicWand" );
	register_clcmd( "say_team /magic", "ClCmdBuyMagicWand" );
}

public plugin_precache(  ) {

	register_plugin( PLUGIN_NAME, 
			PLUGIN_VERSION, 
			PLUGIN_AUTHOR );

	precache_sound( HarryFireSound );
	precache_sound( HarryHitSound );
	precache_sound( HarryHitSound2 );

	precache_model( HarryModel );

	HarryBeam = precache_model( "sprites/harry_wand/harry_plasma_beam.spr" );
	HarryExp = precache_model( "sprites/harry_wand/harry_plasma_exp2.spr" );
	HarryExp2 = precache_model( "sprites/harry_wand/harry_plasma_exp3.spr" );
	DeathSprite = precache_model( "sprites/harry_wand/harry_skull.spr" );
}

public client_putinserver( id ) {
		
	g_HasHarryWand[ id ] = false;
	Harry_Ammo[ id ] = false;
}

public client_disconnect( id ) {
	
	g_HasHarryWand[ id ] = false;
	Harry_Ammo[ id ] = false;
}

public ClCmdBuyMagicWand( id ) {

	new HarryCost = get_pcvar_num( HarryMagicCost );

	new CostIn;
	#if defined ASKHANAR_CREDITS
		CostIn = fcs_get_user_credits( id );
	#endif

	#if defined ARAGON_CREDITS
		CostIn = get_user_credits( id );
	#endif

	#if defined POINTS
		CostIn = get_user_points( id );
	#endif

	#if defined MONEY
		CostIn = cs_get_user_money( id );
	#endif

	if( g_HasHarryWand[ id ] ) {

		ColorChat( id, GREEN, "^x04%s^x03 Ai deja bagheta !", Tag );
		return 1;
	}

	else if( !is_user_alive( id ) ) {

		ColorChat( id, GREEN, "^x04%s^x01 Nu poti cumpara bagheta cat timp esti mort.", Tag );
		return 1;
	}

	else if( CostIn < HarryCost ) {

		#if defined ASKHANAR_CREDITS
			ColorChat( id, GREEN, "^x04%s^x01 Mai ai nevoie de^x03 %i credite^x01 pentru a cumpara bagheta !", Tag, HarryCost - CostIn );
		#endif

		#if defined ARAGON_CREDITS
			ColorChat( id, GREEN, "^x04%s^x01 Mai ai nevoie de^x03 %i credite^x01 pentru a cumpara bagheta !", Tag, HarryCost - CostIn );
		#endif

		#if defined POINTS
			ColorChat( id, GREEN, "^x04%s^x01 Mai ai nevoie de^x03 %i puncte^x01 pentru a cumpara bagheta !", Tag, HarryCost - CostIn );
		#endif

		#if defined MONEY
			ColorChat( id, GREEN, "^x04%s^x01 Mai ai nevoie de^x03 %i $^x01 pentru a cumpara bagheta !", Tag, HarryCost - CostIn );
		#endif

		return 1;
	}

	else {

		get_harry( id );

		#if defined ASKHANAR_CREDITS
			fcs_set_user_credits( id, CostIn - HarryCost );
			ColorChat( id, GREEN, "^x04%s^x01 Ai cumparat bagheta pentru^x03 %i credite^x01.", Tag, HarryCost );
		#endif

		#if defined ARAGON_CREDITS
			set_user_credits( id, CostIn - HarryCost );
			ColorChat( id, GREEN, "^x04%s^x01 Ai cumparat bagheta pentru^x03 %i credite^x01.", Tag, HarryCost );
		#endif

		#if defined POINTS
			set_user_points( id, CostIn - HarryCost );
			ColorChat( id, GREEN, "^x04%s^x01 Ai cumparat bagheta pentru^x03 %i puncte^x01.", Tag, HarryCost );
		#endif

		#if defined MONEY
			cs_set_user_money( id, CostIn - HarryCost );
			ColorChat( id, GREEN, "^x04%s^x01 Ai cumparat bagheta pentru^x03 %i $^x01.", Tag, HarryCost );
		#endif

		return 1;
	}

	return 1;
}

public GiveHarry( id, level, cid ) {
	
	if( !cmd_access( id, level, cid, 3 ) ) 
		return PLUGIN_HANDLED;
	
	new szTtarget[ 32 ], szAmmoHarry[ 21 ];
	
	read_argv( 1, szTtarget, 31 );
	read_argv( 2, szAmmoHarry, 20 );

	new iPlayer = cmd_target( id, szTtarget, 8 );

	new szAdminName[ 32 ], szPlayerName[ 32 ];

	get_user_name( id, szAdminName, 31 );
	get_user_name( iPlayer, szPlayerName, 31 );

	if( !iPlayer )
		return PLUGIN_HANDLED;

	if( !is_user_alive( iPlayer ) ) {

		client_print( id, print_console, "Jucatorul %s nu este in viata !", szPlayerName );
		return 1;
	}

	if( g_HasHarryWand[ iPlayer ] ) {

		client_print( id, print_console, "Jucatorul %s are deja bagheta !", szPlayerName );
		return 1;
	}

	else {
	
		new AmmoForMagic = str_to_num( szAmmoHarry );

		ColorChat( 0, GREEN, "^x04%s^x01 Adminul^x03 %s^x01 i-a dat lui^x03 %s^x01 bagheta lui Harry cu^x03 %d ammo^x01 !", Tag, szAdminName, szPlayerName, szAmmoHarry );

		get_harry( iPlayer );
		Harry_Ammo[ iPlayer ] += AmmoForMagic;
	}

	return PLUGIN_CONTINUE;
}

public get_harry( id ) {

	if( is_user_alive( id ) ) {

		g_HasHarryWand[ id ] = true;
		engclient_cmd( id, "weapon_knife" );

		Harry_Ammo[ id ] = get_pcvar_num( HarryAmmo );
	}

	else {

		client_print( id, print_console, "Jucatorul nu este in viata! " );
		g_HasHarryWand[ id ] = false;

		return 1;
	}

	return 1;
}

public CurrentWeapon( id )
	if( get_user_weapon( id ) == CSW_KNIFE && g_HasHarryWand[ id ] )
		set_pev( id, pev_viewmodel2, HarryModel );

public Ham_SpawnCallback( id ) {
	
	if( !is_user_alive( id ) )
		return 1;
	
	g_HasHarryWand[ id ] = false;
	
	return 0;
}

public Harry_CmdStart( id, uc_handle, seed ) {
	
	if( is_user_alive( id ) && g_HasHarryWand[ id ] ) {
		
		static CurButton;
		CurButton = get_uc( uc_handle, UC_Buttons );
		new Float:flNextAttack = get_pdata_float( id, 83, 5 );

		if( CurButton & IN_ATTACK ) {

			if( get_user_weapon( id ) == CSW_KNIFE && g_HasHarryWand[ id ] ) {

				if( Harry_Ammo[ id ] > 0  && flNextAttack <= 0.0 ) {

					if( get_gametime(  ) - HarryLastShotTime[ id ] > HARRY_WAND_SPEED ) {
						
						set_weapon_anim( id, HARRY_WAND_FIRE );
						emit_sound( id, CHAN_WEAPON, HarryFireSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
						
						Harry_Fire( id );

						if( Harry_Ammo[ id ] > 0 ) {
							
							set_hudmessage( 0, 127, 255, 0.01, 0.85, 0, 6.0, 1.0 );
							show_hudmessage( id, "Remaining Ammo: %d !", Harry_Ammo[ id ] );
						}
						
						else if( Harry_Ammo[ id ] <= 0 ) {
							
							set_hudmessage( 255, 0, 0, 0.01, 0.90, 0, 6.0, 1.0 );
							show_hudmessage( id, "No Ammo !" );
							
						}
						
						static Float:Punch_Angles[ 3 ];
						
						Punch_Angles[ 0]  = -5.0;
						Punch_Angles[ 1 ] = HARRY_WAND_RECOIL;
						Punch_Angles[ 2 ] = HARRY_WAND_RECOIL;
						
						set_pev( id, pev_punchangle, Punch_Angles );

						Harry_Ammo[ id ] -= 1;
						HarryLastShotTime[ id ] = get_gametime(  );
						
					}	
				}
				
				CurButton &= ~IN_ATTACK;
				set_uc( uc_handle, UC_Buttons, CurButton );
			}		
		}
		
		else if( CurButton & IN_ATTACK2 ) {

			if( get_user_weapon( id ) == CSW_KNIFE && g_HasHarryWand[ id ] ) {

				if( Harry_Ammo[ id ] >= 5  && flNextAttack <= 0.0 ) {

					if( get_gametime(  ) - HarryLastShotTime[ id ] > HARRY_WAND_SPEED2 ) {
						
						set_weapon_anim( id, HARRY_WAND_FIRE2 );
						emit_sound( id, CHAN_WEAPON, HarryFireSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
						
						Harry_Fire2( id );

						set_hudmessage( 0, 127, 255, 0.01, 0.85, 0, 6.0, 1.0 );
						show_hudmessage( id, "Remaining Ammo: %d !", Harry_Ammo[ id ] );
						
						static Float:Punch_Angles[ 3 ];
						
						Punch_Angles[ 0 ] = -5.0;
						Punch_Angles[ 1 ] = HARRY_WAND_RECOIL;
						Punch_Angles[ 2 ] = HARRY_WAND_RECOIL;
						
						set_pev( id, pev_punchangle, Punch_Angles );

						Harry_Ammo[ id ] -= 3;
						HarryLastShotTime[ id ] = get_gametime(  );
						
					}	
				}
				
				CurButton &= ~IN_ATTACK2;
				set_uc( uc_handle, UC_Buttons, CurButton );
			}
		}
	}
	
	else if( is_user_alive ( id ) && !g_HasHarryWand[ id ] )
		return PLUGIN_CONTINUE;

	return PLUGIN_CONTINUE;
}

public Harry_Fire( id ) {
	
	static Victim, Body, EndOrigin[ 3 ], BeamOrigin[ 3 ];
	get_user_origin( id, BeamOrigin, 3 );
	get_user_origin( id, EndOrigin, 3 );

	message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
	write_byte( 1 );
	write_short( id | 0x1000 );
	write_coord( BeamOrigin[ 0 ] );	// Start X
	write_coord( BeamOrigin[ 1 ] );	// Start Y
	write_coord( BeamOrigin[ 2 ] );	// Start Z
	write_short( HarryBeam);		// Sprite
	write_byte( 1 );      		// Start frame				
	write_byte( 1 );     		// Frame rate					
	write_byte( 1 );			// Life
	write_byte( 40 );   		// Line width				
	write_byte( 0 );    		// Noise
	write_byte( 108 ); 		// Red
	write_byte( 236 );			// Green
	write_byte( 23 );			// Blue
	write_byte( 150 );     		// Brightness					
	write_byte( 25 );      		// Scroll speed					
	message_end(  );

	message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
	write_byte( 3 );
	write_coord( EndOrigin[ 0 ] );
	write_coord( EndOrigin[ 1 ] );
	write_coord( EndOrigin[ 2 ] );
	write_short( HarryExp );	// sprite
	write_byte( 10 );		// scale in 0.1's
	write_byte( 15 );		// framerate
	write_byte( 4 );		// flags
	message_end(  );
	
	get_user_aiming( id, Victim, Body, get_pcvar_num( HarryDistance ) );

	if( is_user_connected( Victim ) ) {

		new Float:Damage = float( get_damage_body( Body, get_pcvar_float( HarryDamageCvar ) ) );
		
		new Float:VictimOrigin[ 3 ];
		VictimOrigin[ 0 ] = float( EndOrigin[ 0 ] );
		VictimOrigin[ 1 ] = float( EndOrigin[ 1 ] );
		VictimOrigin[ 2 ] = float( EndOrigin[ 2 ] );
		
		if( get_user_health( Victim ) - get_pcvar_float( HarryDamageCvar ) >= 1 && is_user_alive( Victim ) && !fm_get_user_godmode( Victim ) && get_user_team( Victim ) != get_user_team( id ) ) {

			new iOrigin[ 3 ];
			get_user_origin( Victim, iOrigin, 0 );

			message_begin( MSG_PVS, SVC_TEMPENTITY, iOrigin ); 
			write_byte( 21 );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] + 60 );	// end axis + radius
			write_short( HarryExp );	// sprite
			write_byte( 0 );		// startfrate
			write_byte( 0 );		// framerate
			write_byte( 10 );		// life in 0.1 sec
			write_byte( 60 );		// width
			write_byte( 0 );		// amplitude
			write_byte( 0 );		// red
			write_byte( 200 );		// green
			write_byte( 200 );		// blue
			write_byte( 153 );		// brightness
			write_byte( 0 );		// speed
			message_end(  );
			
			message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
			write_byte( 15 );
			write_coord( iOrigin[ 0 ] ); 	// start position (X)
			write_coord( iOrigin[ 1 ] ); 	// start position (Y)
			write_coord( iOrigin[ 2 ] + 40 ); // start position (Z)
			write_coord( iOrigin[ 0 ] ); 	// end position (X)
			write_coord( iOrigin[ 1 ] );	// end position (Y)
			write_coord( iOrigin[ 2 ] );	// end position (Z)
			write_short( DeathSprite );	// sprite index
			write_byte( 50 );		// count
			write_byte( 20 );		// life in 0.1's
			write_byte( 2 );		// scale in 0.1's
			write_byte( 50 );		// velocity along vector in 10's
			write_byte( 10 );		// randomness of velocity in 10's
			message_end(  );
			
			make_knockback( Victim, VictimOrigin, 3 * get_pcvar_float( HarryDamageCvar ) );
			
			ExecuteHam( Ham_TakeDamage, Victim, id, id, Damage, DMG_NERVEGAS );
			
			message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "Damage" ), _, Victim );
			write_byte( 0 );
			write_byte( 0 );
			write_long( DMG_SHOCK );
			write_coord( 0 );
			write_coord( 0 );
			write_coord( 0 );
			message_end(  );
			
			FadeScreen( Victim, 4.0, 255, 122, 122, 100 );
			ShakeScreen( Victim, 3.0 );
		}

		else if( get_user_health( Victim ) - get_pcvar_float( HarryDamageCvar ) < 1 && is_user_alive( Victim ) && !fm_get_user_godmode( Victim ) && get_user_team( Victim ) != get_user_team( id ) ) {
			
			new iOrigin[ 3 ];
			get_user_origin( Victim, iOrigin, 0 );

			message_begin( MSG_PVS, SVC_TEMPENTITY, iOrigin ); 
			write_byte( 21 );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] + 60 );	// end axis + radius
			write_short( HarryExp );	// sprite
			write_byte( 0 );		// startfrate
			write_byte( 0 );		// framerate
			write_byte( 10 );		// life in 0.1 sec
			write_byte( 60 );		// width
			write_byte( 0 );		// amplitude
			write_byte( 0 );		// red
			write_byte( 200 );		// green
			write_byte( 200 );		// blue
			write_byte( 153 );		// brightness
			write_byte( 0 );		// speed
			message_end(  );
			
			message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
			write_byte( 15 );
			write_coord( iOrigin[ 0 ] ); 	// start position (X)
			write_coord( iOrigin[ 1 ] ); 	// start position (Y)
			write_coord( iOrigin[ 2 ] + 40 ); // start position (Z)
			write_coord( iOrigin[ 0 ] ); 	// end position (X)
			write_coord( iOrigin[ 1 ] );	// end position (Y)
			write_coord( iOrigin[ 2 ] );	// end position (Z)
			write_short( DeathSprite );	// sprite index
			write_byte( 50 );		// count
			write_byte( 20 );		// life in 0.1's
			write_byte( 2 );		// scale in 0.1's
			write_byte( 50 );		// velocity along vector in 10's
			write_byte( 10 );		// randomness of velocity in 10's
			message_end(  );
			
			make_knockback( Victim, VictimOrigin, 3 * get_pcvar_float( HarryDamageCvar ) );
			
			death_message( id, Victim, 1, "Magic Wand" );
		}
	}

	else {

		static ClassName[ 32 ];
		pev( Victim, pev_classname, ClassName, charsmax( ClassName ) );

		if( equal( ClassName, "func_breakable" ) )
			if( entity_get_float( Victim, EV_FL_health ) <= 80 )
				force_use( id, Victim );
	}
	
	emit_sound( id, CHAN_WEAPON, HarryHitSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
}

public Harry_Fire2( id ) {
	
	static Victim, Body, EndOrigin[3], BeamOrigin[3];
	get_user_origin( id, BeamOrigin, 3 ) ;
	get_user_origin( id, EndOrigin, 3 );

	message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
	write_byte( 1 );
	write_short( id | 0x1000 );
	write_coord( BeamOrigin[ 0 ] );	// Start X
	write_coord( BeamOrigin[ 1 ] );	// Start Y
	write_coord( BeamOrigin[ 2 ] );	// Start Z
	write_short( HarryBeam );	// Sprite
	write_byte( 1 );      		// Start frame				
	write_byte( 1 );     		// Frame rate					
	write_byte( 1 );			// Life
	write_byte( 40 );   		// Line width				
	write_byte( 0 );    		// Noise
	write_byte( 150 ); 		// Red
	write_byte( 22 );			// Green
	write_byte( 235 );			// Blue
	write_byte( 150 );     		// Brightness					
	write_byte( 25 );      		// Scroll speed					
	message_end(  );

	message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
	write_byte( 3 );
	write_coord( EndOrigin[ 0 ] );
	write_coord( EndOrigin[ 1 ] );
	write_coord( EndOrigin[ 2 ] );
	write_short( HarryExp2 );
	write_byte( 10 );
	write_byte( 15 );
	write_byte( 4 );
	message_end(  );
	
	get_user_aiming( id, Victim, Body, get_pcvar_num( HarryDistance ) );

	if( is_user_alive( Victim ) ) {

		new Float:Damage = float( get_damage_body( Body, get_pcvar_float( HarryDamageCvar ) ) );

		new Float:VictimOrigin[ 3 ];
		VictimOrigin[ 0 ] = float( EndOrigin[ 0 ] );
		VictimOrigin[ 1 ] = float( EndOrigin[ 1 ] );
		VictimOrigin[ 2 ] = float( EndOrigin[ 2 ] );
		
		if( get_user_health( Victim ) - get_pcvar_float( HarryDamageCvar2 ) >= 1 && is_user_alive( Victim ) && !fm_get_user_godmode( Victim ) && get_user_team( Victim ) != get_user_team( id ) ) {
			
			new iOrigin[ 3 ];
			get_user_origin( Victim, iOrigin, 0 );

			message_begin( MSG_PVS, SVC_TEMPENTITY, iOrigin ); 
			write_byte( 21 );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] + 60 );	// end axis + radius
			write_short( HarryExp2 );	// sprite
			write_byte( 0 );		// startfrate
			write_byte( 0 );		// framerate
			write_byte( 10 );		// life in 0.1 sec
			write_byte( 60 );		// width
			write_byte( 0 );		// amplitude
			write_byte( 217 );		// red
			write_byte( 132 );		// green
			write_byte( 47 );		// blue
			write_byte( 153 );		// brightness
			write_byte( 0 );		// speed
			message_end(  );
			
			message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
			write_byte( 15 );
			write_coord( iOrigin[ 0 ] ); 	// start position (X)
			write_coord( iOrigin[ 1 ] ); 	// start position (Y)
			write_coord( iOrigin[ 2 ] + 40 ); // start position (Z)
			write_coord( iOrigin[ 0 ] ); 	// end position (X)
			write_coord( iOrigin[ 1 ] );	// end position (Y)
			write_coord( iOrigin[ 2 ] );	// end position (Z)
			write_short( DeathSprite );	// sprite index
			write_byte( 50 );		// count
			write_byte( 20 );		// life in 0.1's
			write_byte( 2 );		// scale in 0.1's
			write_byte( 50 );		// velocity along vector in 10's
			write_byte( 10 );		// randomness of velocity in 10's
			message_end(  );
			
			make_knockback( Victim, VictimOrigin, 3 * get_pcvar_float( HarryDamageCvar2 ) );
			
			ExecuteHam( Ham_TakeDamage, Victim, id, id, Damage, DMG_NERVEGAS );
			
			message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "Damage" ), _, Victim );
			write_byte( 0 );
			write_byte( 0 );
			write_long( DMG_NERVEGAS );
			write_coord( 0 ) ;
			write_coord( 0 );
			write_coord( 0 );
			message_end(  );
			
			FadeScreen( Victim, 4.0, 0, 255, 0, 100 );
			ShakeScreen( Victim, 3.0 );
		}

		else if( get_user_health( Victim ) - get_pcvar_float( HarryDamageCvar2 ) < 1 && is_user_alive( Victim ) && !fm_get_user_godmode( Victim ) && get_user_team( Victim ) != get_user_team( id ) ) {
			
			new iOrigin[ 3 ];
			get_user_origin( Victim, iOrigin, 0 );

			message_begin( MSG_PVS, SVC_TEMPENTITY, iOrigin ); 
			write_byte( 21 );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] + 60 );	// end axis + radius
			write_short( HarryExp2 );	// sprite
			write_byte( 0 );		// startfrate
			write_byte( 0 );		// framerate
			write_byte( 10 );		// life in 0.1 sec
			write_byte( 60 );		// width
			write_byte( 0 );		// amplitude
			write_byte( 217 );		// red
			write_byte( 132 );		// green
			write_byte( 47 );		// blue
			write_byte( 153 );		// brightness
			write_byte( 0 );		// speed
			message_end(  );
			
			message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
			write_byte( 15 );
			write_coord( iOrigin[ 0 ] ); 	// start position (X)
			write_coord( iOrigin[ 1 ] ); 	// start position (Y)
			write_coord( iOrigin[ 2 ] + 40 ); // start position (Z)
			write_coord( iOrigin[ 0 ] ); 	// end position (X)
			write_coord( iOrigin[ 1 ] );	// end position (Y)
			write_coord( iOrigin[ 2 ] );	// end position (Z)
			write_short( DeathSprite );	// sprite index
			write_byte( 50 );		// count
			write_byte( 20 );		// life in 0.1's
			write_byte( 2 );		// scale in 0.1's
			write_byte( 50 );		// velocity along vector in 10's
			write_byte( 10 );		// randomness of velocity in 10's
			message_end(  );
			
			make_knockback( Victim, VictimOrigin, 3 * get_pcvar_float( HarryDamageCvar2 ) );
			
			death_message( id, Victim, 1, "Double Magic Wand" );
		}
	}

	else {

		static ClassName[ 32 ];
		pev( Victim, pev_classname, ClassName, charsmax( ClassName ) );

		if( equal( ClassName, "func_breakable" ) )
			if( entity_get_float( Victim, EV_FL_health ) <= 80 )
				force_use( id, Victim );
	}

	emit_sound( id, CHAN_WEAPON, HarryHitSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
}

public make_knockback( Victim, Float:origin[ 3 ], Float:maxspeed ) {

	new Float:fVelocity[ 3 ];
	
	kickback( Victim, origin, maxspeed, fVelocity );
	entity_set_vector( Victim, EV_VEC_velocity, fVelocity );
	
	return( 1 );
}

stock ShakeScreen( id, const Float:iSeconds ) {

	message_begin( MSG_ONE, get_user_msgid( "ScreenShake" ), { 0, 0, 0 }, id );
	write_short( floatround( 4096.0 * iSeconds, floatround_round ) );
	write_short( floatround( 4096.0 * iSeconds, floatround_round ) );
	write_short( 1<<13 );
	message_end(  );
}

stock FadeScreen( id, const Float:iSeconds, const iRed, const iGreen, const iBlue, const iAlpha ) {
      
	message_begin( MSG_ONE, get_user_msgid( "ScreenFade" ), _, id );
	write_short( floatround( 4096.0 * iSeconds, floatround_round ) );
	write_short( floatround( 4096.0 * iSeconds, floatround_round ) );
	write_short( 0x0000 );
	write_byte( iRed );
	write_byte( iGreen );
	write_byte( iBlue );
	write_byte( iAlpha );
	message_end(  );
}		

stock kickback( ent, Float:fOrigin[ 3 ], Float:fSpeed, Float:fVelocity[ 3 ] ) {

	new Float:fEntOrigin[ 3 ];
	entity_get_vector( ent, EV_VEC_origin, fEntOrigin );
	
	new Float:fDistance[ 3 ];
	fDistance[ 0 ] = fEntOrigin[ 0 ] - fOrigin[ 0 ];
	fDistance[ 1 ] = fEntOrigin[ 1 ] - fOrigin[ 1 ];
	fDistance[ 2 ] = fEntOrigin[ 2 ] - fOrigin[ 2 ];

	new Float:fTime =( vector_distance( fEntOrigin, fOrigin ) / fSpeed );
	fVelocity[ 0 ] = fDistance[ 0 ] / fTime;
	fVelocity[ 1 ] = fDistance[ 1 ] / fTime;
	fVelocity[ 2 ] = fDistance[ 2 ] / fTime;
	
	return( fVelocity[ 0 ] && fVelocity[ 1 ] && fVelocity[ 2 ] );
}

// stock from "m79"
stock death_message( Killer, Victim, ScoreBoard, const Weapon[  ] ) {
	
	set_msg_block( get_user_msgid( "DeathMsg" ), BLOCK_SET );

	ExecuteHamB( Ham_Killed, Victim, Killer, 2 );

	set_msg_block( get_user_msgid( "DeathMsg" ), BLOCK_NOT );

	make_deathmsg( Killer, Victim, 0, Weapon );

	new Reward;
	#if defined ASKHANAR_CREDITS
		Reward = fcs_get_user_credits( Killer );
	#endif

	#if defined ARAGON_CREDITS
		Reward = get_user_credits( Killer );
	#endif

	#if defined POINTS
		Reward = get_user_points( Killer );
	#endif

	#if defined MONEY
		Reward = cs_get_user_money( Killer );
	#endif

	#if defined ASKHANAR_CREDITS
		fcs_set_user_credits( Killer, Reward + get_pcvar_num( HarryKillMoney ) );
	#endif

	#if defined ARAGON_CREDITS
		set_user_credits( Killer, Reward + get_pcvar_num( HarryKillMoney ) );
	#endif

	#if defined POINTS
		set_user_points( Killer, Reward + get_pcvar_num( HarryKillMoney ) );
	#endif

	#if defined MONEY
		cs_set_user_money( Killer, Reward + get_pcvar_num( HarryKillMoney ) );
	#endif
	
	if( ScoreBoard ) {

		message_begin( MSG_BROADCAST, get_user_msgid( "ScoreInfo" ) );
		write_byte( Killer );
		write_short( pev( Killer, pev_frags ) );
		write_short( get_user_deaths( Killer ) );
		write_short( 0 );
		write_short( get_user_team( Killer ) );
		message_end(  );
		
		message_begin( MSG_BROADCAST, get_user_msgid( "ScoreInfo" ) );
		write_byte( Victim );
		write_short( pev( Victim, pev_frags ) );
		write_short( get_user_deaths( Victim ) );
		write_short( 0 );
		write_short( get_user_team( Victim ) );
		message_end(  );
	}
}

stock set_weapon_anim( id, anim ) {

	set_pev( id, pev_weaponanim, anim );

	if( is_user_alive( id ) ) {

		message_begin( MSG_ONE, SVC_WEAPONANIM, _, id );
		write_byte( anim );
		write_byte( pev( id, pev_body ) );
		message_end(  );
	}
}

stock get_damage_body( body, Float:fDamage ) {

	switch( body ) {

		case HIT_HEAD: fDamage *= 4.0;

		case HIT_STOMACH: fDamage *= 1.1;

		case HIT_CHEST: fDamage *= 1.5;

		case HIT_LEFTARM: fDamage *= 0.77;

		case HIT_RIGHTARM: fDamage *= 0.77;

		case HIT_LEFTLEG: fDamage *= 0.75;

		case HIT_RIGHTLEG: fDamage *= 0.75;

		default: fDamage *= 1.0;
	}
	
	return floatround( fDamage );
}

// stock from "fakemeta_util"
stock fm_get_user_godmode( index ) {

	new Float:val;
	pev( index, pev_takedamage, val );

	return ( val == DAMAGE_NO );
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
SMA v0.0.3 for ZP 4.3 | Afiseaza codul
/* Plugin generated by AMXX-Studio */

#include < amxmodx >
#include < amxmisc >
#include < hamsandwich >
#include < fakemeta >
#include < engine >
#include < message_const >
#include < CC_ColorChat >
#include < zombieplague >

#define PLUGIN_NAME	"Harry Potter's Magic Wand"
#define PLUGIN_VERSION	"0.0.3"
#define PLUGIN_AUTHOR	"Hades Ownage & YONTU"

#define HARRY_WAND_RECOIL 	0.0			// Recoil
#define HARRY_WAND_SPEED 	0.35			// Click stanga
#define HARRY_WAND_SPEED2 	0.75			// Click dreapta
#define HARRY_WAND_FIRE	random_num( 3, 6 )	// Animatie cand trage cu click stanga
#define HARRY_WAND_FIRE2	random_num( 5, 10 )	// Animatie cand trage cu click dreapta

#define TE_BEAMENTPOINT	1
#define TE_EXPLOSION		3
#define TE_SPRITETRAIL		15
#define TE_BEAMCYLINDER		21

new const Tag[  ] = "[Harry Magic Wand]";

new HarryFireSound[  ] = "harry_wand/harry_shoot1.wav";
new HarryHitSound[  ] = "harry_wand/harry_hit.wav";
new HarryHitSound2[  ] = "harry_wand/harry_shoot2.wav";
new HarryModel[  ] = "models/harry_wand/v_harry_wand.mdl";

new HarryBeam, HarryExp, HarryExp2, DeathSprite;

new bool:g_HasHarryWand[ 33 ];

new Harry_Ammo[ 33 ];
new Float:HarryLastShotTime[ 33 ];

new HarryDamageCvar, HarryDamageCvar2, HarryAmmo, HarryKillAmmoPacks, HarryDistance;
new g_Item;

public plugin_init(  ) {

	register_event( "CurWeapon", "CurrentWeapon", "be", "1=1" );
	
	register_forward( FM_CmdStart, "Harry_CmdStart" );
	
	RegisterHam( Ham_Spawn, "player", "Ham_SpawnCallback", 1 );
	
	HarryDamageCvar = register_cvar( "harry_damage", "80.0" );
	HarryDamageCvar2 = register_cvar( "harry_damage2", "135.0" );
	HarryAmmo = register_cvar( "harry_ammo", "300" );
	HarryKillAmmoPacks = register_cvar( "harry_kill_reward_ammo_packs", "10" );	// in amoo packs
	HarryDistance = register_cvar( "harry_distance", "90909" );

	register_concmd( "amx_get_harry", "GiveHarry", ADMIN_BAN, "< nume > < ammo >" );

	g_Item = zp_register_extra_item( "Harry Potter's Magic Wand", 20, ZP_TEAM_HUMAN );
}

public plugin_precache(  ) {

	register_plugin( PLUGIN_NAME, 
			PLUGIN_VERSION, 
			PLUGIN_AUTHOR );

	precache_sound( HarryFireSound );
	precache_sound( HarryHitSound );
	precache_sound( HarryHitSound2 );

	precache_model( HarryModel );

	HarryBeam = precache_model( "sprites/harry_wand/harry_plasma_beam.spr" );
	HarryExp = precache_model( "sprites/harry_wand/harry_plasma_exp2.spr" );
	HarryExp2 = precache_model( "sprites/harry_wand/harry_plasma_exp3.spr" );
	DeathSprite = precache_model( "sprites/harry_wand/harry_skull.spr" );
}

public client_putinserver( id ) {
		
	g_HasHarryWand[ id ] = false;
	Harry_Ammo[ id ] = false;
}

public client_disconnect( id ) {
	
	g_HasHarryWand[ id ] = false;
	Harry_Ammo[ id ] = false;
}

public GiveHarry( id, level, cid ) {
	
	if( !cmd_access( id, level, cid, 3 ) ) 
		return PLUGIN_HANDLED;
	
	new szTtarget[ 32 ], szAmmoHarry[ 21 ];
	
	read_argv( 1, szTtarget, 31 );
	read_argv( 2, szAmmoHarry, 20 );

	new iPlayer = cmd_target( id, szTtarget, 8 );

	new szAdminName[ 32 ], szPlayerName[ 32 ];

	get_user_name( id, szAdminName, 31 );
	get_user_name( iPlayer, szPlayerName, 31 );

	if( !iPlayer )
		return PLUGIN_HANDLED;

	if( !is_user_alive( iPlayer ) ) {

		client_print( id, print_console, "Jucatorul %s nu este in viata !", szPlayerName );
		return 1;
	}

	if( g_HasHarryWand[ iPlayer ] ) {

		client_print( id, print_console, "Jucatorul %s are deja bagheta !", szPlayerName );
		return 1;
	}

	else {
	
		new AmmoForMagic = str_to_num( szAmmoHarry );

		ColorChat( 0, GREEN, "^x04%s^x01 Adminul^x03 %s^x01 i-a dat lui^x03 %s^x01 bagheta lui Harry cu^x03 %d ammo^x01 !", Tag, szAdminName, szPlayerName, szAmmoHarry );

		get_harry( iPlayer );
		Harry_Ammo[ iPlayer ] += AmmoForMagic;
	}

	return PLUGIN_CONTINUE;
}

public get_harry( id ) {

	if( is_user_alive( id ) ) {

		g_HasHarryWand[ id ] = true;
		engclient_cmd( id, "weapon_knife" );

		Harry_Ammo[ id ] = get_pcvar_num( HarryAmmo );
	}

	else {

		client_print( id, print_console, "Jucatorul nu este in viata! " );
		g_HasHarryWand[ id ] = false;

		return 1;
	}

	return 1;
}

public CurrentWeapon( id )
	if( get_user_weapon( id ) == CSW_KNIFE && g_HasHarryWand[ id ] )
		set_pev( id, pev_viewmodel2, HarryModel );

public Ham_SpawnCallback( id ) {
	
	if( !is_user_alive( id ) || zp_get_user_zombie( id ) )
		return 1;
	
	g_HasHarryWand[ id ] = false;
	
	return 0;
}

public zp_user_infected_post( id )
	if( zp_get_user_zombie( id ) )
		g_HasHarryWand[ id ] = false;

public zp_extra_item_selected( player, itemid )
	if( itemid == g_Item )
		get_harry( player );

public Harry_CmdStart( id, uc_handle, seed ) {
	
	if( is_user_alive( id ) && g_HasHarryWand[ id ] && zp_get_user_zombie( id ) ) {
		
		static CurButton;
		CurButton = get_uc( uc_handle, UC_Buttons );
		new Float:flNextAttack = get_pdata_float( id, 83, 5 );

		if( CurButton & IN_ATTACK ) {

			if( get_user_weapon( id ) == CSW_KNIFE && g_HasHarryWand[ id ] ) {

				if( Harry_Ammo[ id ] > 0  && flNextAttack <= 0.0 ) {

					if( get_gametime(  ) - HarryLastShotTime[ id ] > HARRY_WAND_SPEED ) {
						
						set_weapon_anim( id, HARRY_WAND_FIRE );
						emit_sound( id, CHAN_WEAPON, HarryFireSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
						
						Harry_Fire( id );

						if( Harry_Ammo[ id ] > 0 ) {
							
							set_hudmessage( 0, 127, 255, 0.01, 0.85, 0, 6.0, 1.0 );
							show_hudmessage( id, "Remaining Ammo: %d !", Harry_Ammo[ id ] );
						}
						
						else if( Harry_Ammo[ id ] <= 0 ) {
							
							set_hudmessage( 255, 0, 0, 0.01, 0.90, 0, 6.0, 1.0 );
							show_hudmessage( id, "No Ammo !" );
							
						}
						
						static Float:Punch_Angles[ 3 ];
						
						Punch_Angles[ 0]  = -5.0;
						Punch_Angles[ 1 ] = HARRY_WAND_RECOIL;
						Punch_Angles[ 2 ] = HARRY_WAND_RECOIL;
						
						set_pev( id, pev_punchangle, Punch_Angles );

						Harry_Ammo[ id ] -= 1;
						HarryLastShotTime[ id ] = get_gametime(  );
						
					}	
				}
				
				CurButton &= ~IN_ATTACK;
				set_uc( uc_handle, UC_Buttons, CurButton );
			}		
		}
		
		else if( CurButton & IN_ATTACK2 ) {

			if( get_user_weapon( id ) == CSW_KNIFE && g_HasHarryWand[ id ] ) {

				if( Harry_Ammo[ id ] >= 5  && flNextAttack <= 0.0 ) {

					if( get_gametime(  ) - HarryLastShotTime[ id ] > HARRY_WAND_SPEED2 ) {
						
						set_weapon_anim( id, HARRY_WAND_FIRE2 );
						emit_sound( id, CHAN_WEAPON, HarryFireSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
						
						Harry_Fire2( id );

						set_hudmessage( 0, 127, 255, 0.01, 0.85, 0, 6.0, 1.0 );
						show_hudmessage( id, "Remaining Ammo: %d !", Harry_Ammo[ id ] );
						
						static Float:Punch_Angles[ 3 ];
						
						Punch_Angles[ 0 ] = -5.0;
						Punch_Angles[ 1 ] = HARRY_WAND_RECOIL;
						Punch_Angles[ 2 ] = HARRY_WAND_RECOIL;
						
						set_pev( id, pev_punchangle, Punch_Angles );

						Harry_Ammo[ id ] -= 3;
						HarryLastShotTime[ id ] = get_gametime(  );
						
					}	
				}
				
				CurButton &= ~IN_ATTACK2;
				set_uc( uc_handle, UC_Buttons, CurButton );
			}
		}
	}
	
	else if( is_user_alive( id ) && !g_HasHarryWand[ id ] && zp_get_user_zombie( id ) )
		return PLUGIN_CONTINUE;

	return PLUGIN_CONTINUE;
}

public Harry_Fire( id ) {
	
	static Victim, Body, EndOrigin[ 3 ], BeamOrigin[ 3 ];
	get_user_origin( id, BeamOrigin, 3 );
	get_user_origin( id, EndOrigin, 3 );

	message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
	write_byte( 1 );
	write_short( id | 0x1000 );
	write_coord( BeamOrigin[ 0 ] );	// Start X
	write_coord( BeamOrigin[ 1 ] );	// Start Y
	write_coord( BeamOrigin[ 2 ] );	// Start Z
	write_short( HarryBeam);		// Sprite
	write_byte( 1 );      		// Start frame				
	write_byte( 1 );     		// Frame rate					
	write_byte( 1 );			// Life
	write_byte( 40 );   		// Line width				
	write_byte( 0 );    		// Noise
	write_byte( 108 ); 		// Red
	write_byte( 236 );			// Green
	write_byte( 23 );			// Blue
	write_byte( 150 );     		// Brightness					
	write_byte( 25 );      		// Scroll speed					
	message_end(  );

	message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
	write_byte( 3 );
	write_coord( EndOrigin[ 0 ] );
	write_coord( EndOrigin[ 1 ] );
	write_coord( EndOrigin[ 2 ] );
	write_short( HarryExp );	// sprite
	write_byte( 10 );		// scale in 0.1's
	write_byte( 15 );		// framerate
	write_byte( 4 );		// flags
	message_end(  );
	
	get_user_aiming( id, Victim, Body, get_pcvar_num( HarryDistance ) );

	if( is_user_connected( Victim ) ) {

		new Float:Damage = float( get_damage_body( Body, get_pcvar_float( HarryDamageCvar ) ) );
		
		new Float:VictimOrigin[ 3 ];
		VictimOrigin[ 0 ] = float( EndOrigin[ 0 ] );
		VictimOrigin[ 1 ] = float( EndOrigin[ 1 ] );
		VictimOrigin[ 2 ] = float( EndOrigin[ 2 ] );
		
		if( get_user_health( Victim ) - get_pcvar_float( HarryDamageCvar ) >= 1 && is_user_alive( Victim ) && zp_get_user_zombie( Victim ) && !fm_get_user_godmode( Victim ) && get_user_team( Victim ) != get_user_team( id ) ) {

			new iOrigin[ 3 ];
			get_user_origin( Victim, iOrigin, 0 );

			message_begin( MSG_PVS, SVC_TEMPENTITY, iOrigin ); 
			write_byte( 21 );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] + 60 );	// end axis + radius
			write_short( HarryExp );	// sprite
			write_byte( 0 );		// startfrate
			write_byte( 0 );		// framerate
			write_byte( 10 );		// life in 0.1 sec
			write_byte( 60 );		// width
			write_byte( 0 );		// amplitude
			write_byte( 0 );		// red
			write_byte( 200 );		// green
			write_byte( 200 );		// blue
			write_byte( 153 );		// brightness
			write_byte( 0 );		// speed
			message_end(  );
			
			message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
			write_byte( 15 );
			write_coord( iOrigin[ 0 ] ); 	// start position (X)
			write_coord( iOrigin[ 1 ] ); 	// start position (Y)
			write_coord( iOrigin[ 2 ] + 40 ); // start position (Z)
			write_coord( iOrigin[ 0 ] ); 	// end position (X)
			write_coord( iOrigin[ 1 ] );	// end position (Y)
			write_coord( iOrigin[ 2 ] );	// end position (Z)
			write_short( DeathSprite );	// sprite index
			write_byte( 50 );		// count
			write_byte( 20 );		// life in 0.1's
			write_byte( 2 );		// scale in 0.1's
			write_byte( 50 );		// velocity along vector in 10's
			write_byte( 10 );		// randomness of velocity in 10's
			message_end(  );
			
			make_knockback( Victim, VictimOrigin, 3 * get_pcvar_float( HarryDamageCvar ) );
			
			ExecuteHam( Ham_TakeDamage, Victim, id, id, Damage, DMG_NERVEGAS );
			
			message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "Damage" ), _, Victim );
			write_byte( 0 );
			write_byte( 0 );
			write_long( DMG_SHOCK );
			write_coord( 0 );
			write_coord( 0 );
			write_coord( 0 );
			message_end(  );
			
			FadeScreen( Victim, 4.0, 255, 122, 122, 100 );
			ShakeScreen( Victim, 3.0 );
		}

		else if( get_user_health( Victim ) - get_pcvar_float( HarryDamageCvar ) < 1 && is_user_alive( Victim ) && zp_get_user_zombie( Victim ) && !fm_get_user_godmode( Victim ) && get_user_team( Victim ) != get_user_team( id ) ) {
			
			new iOrigin[ 3 ];
			get_user_origin( Victim, iOrigin, 0 );

			message_begin( MSG_PVS, SVC_TEMPENTITY, iOrigin ); 
			write_byte( 21 );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] + 60 );	// end axis + radius
			write_short( HarryExp );	// sprite
			write_byte( 0 );		// startfrate
			write_byte( 0 );		// framerate
			write_byte( 10 );		// life in 0.1 sec
			write_byte( 60 );		// width
			write_byte( 0 );		// amplitude
			write_byte( 0 );		// red
			write_byte( 200 );		// green
			write_byte( 200 );		// blue
			write_byte( 153 );		// brightness
			write_byte( 0 );		// speed
			message_end(  );
			
			message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
			write_byte( 15 );
			write_coord( iOrigin[ 0 ] ); 	// start position (X)
			write_coord( iOrigin[ 1 ] ); 	// start position (Y)
			write_coord( iOrigin[ 2 ] + 40 ); // start position (Z)
			write_coord( iOrigin[ 0 ] ); 	// end position (X)
			write_coord( iOrigin[ 1 ] );	// end position (Y)
			write_coord( iOrigin[ 2 ] );	// end position (Z)
			write_short( DeathSprite );	// sprite index
			write_byte( 50 );		// count
			write_byte( 20 );		// life in 0.1's
			write_byte( 2 );		// scale in 0.1's
			write_byte( 50 );		// velocity along vector in 10's
			write_byte( 10 );		// randomness of velocity in 10's
			message_end(  );
			
			make_knockback( Victim, VictimOrigin, 3 * get_pcvar_float( HarryDamageCvar ) );
			
			death_message( id, Victim, 1, "Magic Wand" );
		}
	}

	else {

		static ClassName[ 32 ];
		pev( Victim, pev_classname, ClassName, charsmax( ClassName ) );

		if( equal( ClassName, "func_breakable" ) )
			if( entity_get_float( Victim, EV_FL_health ) <= 80 )
				force_use( id, Victim );
	}
	
	emit_sound( id, CHAN_WEAPON, HarryHitSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
}

public Harry_Fire2( id ) {
	
	static Victim, Body, EndOrigin[3], BeamOrigin[3];
	get_user_origin( id, BeamOrigin, 3 ) ;
	get_user_origin( id, EndOrigin, 3 );

	message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
	write_byte( 1 );
	write_short( id | 0x1000 );
	write_coord( BeamOrigin[ 0 ] );	// Start X
	write_coord( BeamOrigin[ 1 ] );	// Start Y
	write_coord( BeamOrigin[ 2 ] );	// Start Z
	write_short( HarryBeam );	// Sprite
	write_byte( 1 );      		// Start frame				
	write_byte( 1 );     		// Frame rate					
	write_byte( 1 );			// Life
	write_byte( 40 );   		// Line width				
	write_byte( 0 );    		// Noise
	write_byte( 150 ); 		// Red
	write_byte( 22 );			// Green
	write_byte( 235 );			// Blue
	write_byte( 150 );     		// Brightness					
	write_byte( 25 );      		// Scroll speed					
	message_end(  );

	message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
	write_byte( 3 );
	write_coord( EndOrigin[ 0 ] );
	write_coord( EndOrigin[ 1 ] );
	write_coord( EndOrigin[ 2 ] );
	write_short( HarryExp2 );
	write_byte( 10 );
	write_byte( 15 );
	write_byte( 4 );
	message_end(  );
	
	get_user_aiming( id, Victim, Body, get_pcvar_num( HarryDistance ) );

	if( is_user_alive( Victim ) ) {

		new Float:Damage = float( get_damage_body( Body, get_pcvar_float( HarryDamageCvar ) ) );

		new Float:VictimOrigin[ 3 ];
		VictimOrigin[ 0 ] = float( EndOrigin[ 0 ] );
		VictimOrigin[ 1 ] = float( EndOrigin[ 1 ] );
		VictimOrigin[ 2 ] = float( EndOrigin[ 2 ] );
		
		if( get_user_health( Victim ) - get_pcvar_float( HarryDamageCvar2 ) >= 1 && is_user_alive( Victim ) && zp_get_user_zombie( Victim ) && !fm_get_user_godmode( Victim ) && get_user_team( Victim ) != get_user_team( id ) ) {
			
			new iOrigin[ 3 ];
			get_user_origin( Victim, iOrigin, 0 );

			message_begin( MSG_PVS, SVC_TEMPENTITY, iOrigin ); 
			write_byte( 21 );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] + 60 );	// end axis + radius
			write_short( HarryExp2 );	// sprite
			write_byte( 0 );		// startfrate
			write_byte( 0 );		// framerate
			write_byte( 10 );		// life in 0.1 sec
			write_byte( 60 );		// width
			write_byte( 0 );		// amplitude
			write_byte( 217 );		// red
			write_byte( 132 );		// green
			write_byte( 47 );		// blue
			write_byte( 153 );		// brightness
			write_byte( 0 );		// speed
			message_end(  );
			
			message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
			write_byte( 15 );
			write_coord( iOrigin[ 0 ] ); 	// start position (X)
			write_coord( iOrigin[ 1 ] ); 	// start position (Y)
			write_coord( iOrigin[ 2 ] + 40 ); // start position (Z)
			write_coord( iOrigin[ 0 ] ); 	// end position (X)
			write_coord( iOrigin[ 1 ] );	// end position (Y)
			write_coord( iOrigin[ 2 ] );	// end position (Z)
			write_short( DeathSprite );	// sprite index
			write_byte( 50 );		// count
			write_byte( 20 );		// life in 0.1's
			write_byte( 2 );		// scale in 0.1's
			write_byte( 50 );		// velocity along vector in 10's
			write_byte( 10 );		// randomness of velocity in 10's
			message_end(  );
			
			make_knockback( Victim, VictimOrigin, 3 * get_pcvar_float( HarryDamageCvar2 ) );
			
			ExecuteHam( Ham_TakeDamage, Victim, id, id, Damage, DMG_NERVEGAS );
			
			message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "Damage" ), _, Victim );
			write_byte( 0 );
			write_byte( 0 );
			write_long( DMG_NERVEGAS );
			write_coord( 0 ) ;
			write_coord( 0 );
			write_coord( 0 );
			message_end(  );
			
			FadeScreen( Victim, 4.0, 0, 255, 0, 100 );
			ShakeScreen( Victim, 3.0 );
		}

		else if( get_user_health( Victim ) - get_pcvar_float( HarryDamageCvar2 ) < 1 && is_user_alive( Victim ) && zp_get_user_zombie( Victim ) && !fm_get_user_godmode( Victim ) && get_user_team( Victim ) != get_user_team( id ) ) {
			
			new iOrigin[ 3 ];
			get_user_origin( Victim, iOrigin, 0 );

			message_begin( MSG_PVS, SVC_TEMPENTITY, iOrigin ); 
			write_byte( 21 );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] + 60 );	// end axis + radius
			write_short( HarryExp2 );	// sprite
			write_byte( 0 );		// startfrate
			write_byte( 0 );		// framerate
			write_byte( 10 );		// life in 0.1 sec
			write_byte( 60 );		// width
			write_byte( 0 );		// amplitude
			write_byte( 217 );		// red
			write_byte( 132 );		// green
			write_byte( 47 );		// blue
			write_byte( 153 );		// brightness
			write_byte( 0 );		// speed
			message_end(  );
			
			message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
			write_byte( 15 );
			write_coord( iOrigin[ 0 ] ); 	// start position (X)
			write_coord( iOrigin[ 1 ] ); 	// start position (Y)
			write_coord( iOrigin[ 2 ] + 40 ); // start position (Z)
			write_coord( iOrigin[ 0 ] ); 	// end position (X)
			write_coord( iOrigin[ 1 ] );	// end position (Y)
			write_coord( iOrigin[ 2 ] );	// end position (Z)
			write_short( DeathSprite );	// sprite index
			write_byte( 50 );		// count
			write_byte( 20 );		// life in 0.1's
			write_byte( 2 );		// scale in 0.1's
			write_byte( 50 );		// velocity along vector in 10's
			write_byte( 10 );		// randomness of velocity in 10's
			message_end(  );
			
			make_knockback( Victim, VictimOrigin, 3 * get_pcvar_float( HarryDamageCvar2 ) );
			
			death_message( id, Victim, 1, "Double Magic Wand" );
		}
	}

	else {

		static ClassName[ 32 ];
		pev( Victim, pev_classname, ClassName, charsmax( ClassName ) );

		if( equal( ClassName, "func_breakable" ) )
			if( entity_get_float( Victim, EV_FL_health ) <= 80 )
				force_use( id, Victim );
	}

	emit_sound( id, CHAN_WEAPON, HarryHitSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
}

public make_knockback( Victim, Float:origin[ 3 ], Float:maxspeed ) {

	new Float:fVelocity[ 3 ];
	
	kickback( Victim, origin, maxspeed, fVelocity );
	entity_set_vector( Victim, EV_VEC_velocity, fVelocity );
	
	return( 1 );
}

stock ShakeScreen( id, const Float:iSeconds ) {

	message_begin( MSG_ONE, get_user_msgid( "ScreenShake" ), { 0, 0, 0 }, id );
	write_short( floatround( 4096.0 * iSeconds, floatround_round ) );
	write_short( floatround( 4096.0 * iSeconds, floatround_round ) );
	write_short( 1<<13 );
	message_end(  );
}

stock FadeScreen( id, const Float:iSeconds, const iRed, const iGreen, const iBlue, const iAlpha ) {
      
	message_begin( MSG_ONE, get_user_msgid( "ScreenFade" ), _, id );
	write_short( floatround( 4096.0 * iSeconds, floatround_round ) );
	write_short( floatround( 4096.0 * iSeconds, floatround_round ) );
	write_short( 0x0000 );
	write_byte( iRed );
	write_byte( iGreen );
	write_byte( iBlue );
	write_byte( iAlpha );
	message_end(  );
}		

stock kickback( ent, Float:fOrigin[ 3 ], Float:fSpeed, Float:fVelocity[ 3 ] ) {

	new Float:fEntOrigin[ 3 ];
	entity_get_vector( ent, EV_VEC_origin, fEntOrigin );
	
	new Float:fDistance[ 3 ];
	fDistance[ 0 ] = fEntOrigin[ 0 ] - fOrigin[ 0 ];
	fDistance[ 1 ] = fEntOrigin[ 1 ] - fOrigin[ 1 ];
	fDistance[ 2 ] = fEntOrigin[ 2 ] - fOrigin[ 2 ];

	new Float:fTime =( vector_distance( fEntOrigin, fOrigin ) / fSpeed );
	fVelocity[ 0 ] = fDistance[ 0 ] / fTime;
	fVelocity[ 1 ] = fDistance[ 1 ] / fTime;
	fVelocity[ 2 ] = fDistance[ 2 ] / fTime;
	
	return( fVelocity[ 0 ] && fVelocity[ 1 ] && fVelocity[ 2 ] );
}

// stock from "m79"
stock death_message( Killer, Victim, ScoreBoard, const Weapon[  ] ) {
	
	set_msg_block( get_user_msgid( "DeathMsg" ), BLOCK_SET );

	ExecuteHamB( Ham_Killed, Victim, Killer, 2 );

	set_msg_block( get_user_msgid( "DeathMsg" ), BLOCK_NOT );

	make_deathmsg( Killer, Victim, 0, Weapon );

	zp_set_user_ammo_packs( Killer, zp_get_user_ammo_packs( Killer ) + get_pcvar_num( HarryKillAmmoPacks ) );

	if( ScoreBoard ) {

		message_begin( MSG_BROADCAST, get_user_msgid( "ScoreInfo" ) );
		write_byte( Killer );
		write_short( pev( Killer, pev_frags ) );
		write_short( get_user_deaths( Killer ) );
		write_short( 0 );
		write_short( get_user_team( Killer ) );
		message_end(  );
		
		message_begin( MSG_BROADCAST, get_user_msgid( "ScoreInfo" ) );
		write_byte( Victim );
		write_short( pev( Victim, pev_frags ) );
		write_short( get_user_deaths( Victim ) );
		write_short( 0 );
		write_short( get_user_team( Victim ) );
		message_end(  );
	}
}

stock set_weapon_anim( id, anim ) {

	set_pev( id, pev_weaponanim, anim );

	if( is_user_alive( id ) ) {

		message_begin( MSG_ONE, SVC_WEAPONANIM, _, id );
		write_byte( anim );
		write_byte( pev( id, pev_body ) );
		message_end(  );
	}
}

stock get_damage_body( body, Float:fDamage ) {

	switch( body ) {

		case HIT_HEAD: fDamage *= 4.0;

		case HIT_STOMACH: fDamage *= 1.1;

		case HIT_CHEST: fDamage *= 1.5;

		case HIT_LEFTARM: fDamage *= 0.77;

		case HIT_RIGHTARM: fDamage *= 0.77;

		case HIT_LEFTLEG: fDamage *= 0.75;

		case HIT_RIGHTLEG: fDamage *= 0.75;

		default: fDamage *= 1.0;
	}
	
	return floatround( fDamage );
}

// stock from "fakemeta_util"
stock fm_get_user_godmode( index ) {

	new Float:val;
	pev( index, pev_takedamage, val );

	return ( val == DAMAGE_NO );
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Nume: Harry Potter's Magic Wand
Autor: Hades Ownage & YONTU
Versiune: 0.0.3
Link oficial: Aici.

Instalare:
1. Fisierul Harry_Magic_Wand.sma il puneti in addons/amxmodx/scripting !
2. Fisierul Harry_Magic_Wand.amxx il puneti in addons/amxmodx/plugins !
3. Fisierele .spr le puneti in cstrike/sprites !
4. Fisierele .wav le puneti in cstrike/sound !
5. Fisierul .mdl le puneti in cstrike/models !
6. Intrati in fisierul addons/amxmodx/configs/plugins.ini si adaugati la urma:

Code: Select all

Harry_Magic_Wand.amxx
7. Alti pasi necesari...
Cvar-uri (se adauga in fisierul amxmodx\configs\amxx.cfg):
  • harry_damage "80.0" - Cate daune( dmg ) sa provoace bagheta cu click stanga( recomand sa lasati cu zecimala ".0" altfel cade serverul
    harry_damage2 "135.0" - Cate daune( dmg ) sa provoace bagheta cu click dreapta( recomand sa lasati cu zecimala ".0" altfel cade serverul
    harry_ammo "500" - Cata munitie sa primeasca la bagheta
    harry_money_reward "600" - Cati bani sa primeasti bonus cand faci un frag cu bagheta
    harry_distance "90000" - Pana la ce distanta poti trage cu bagheta
    harry_cost "10000" - Cati $/puncte/credite sa coste bagheta!
Comenzi administrative (se tasteaza in consola si trebuie sa fiti administrator):
  • amx_get_harry < nume > < munitie > - oferi unui jucator bagheta fara a o mai cumpara el din chat! De asemenea ii setezi si cata munitie sa primeasca!
Comenzi publice (se tasteaza in joc prin apasarea tastei Y):
  • /magic - cumperi bagheta direct din chat
Module necesare (se sterge ; din fata modulului de mai jos; acestea le gasiti in fisierul amxmodx\configs\modules.ini):
- CStrike;
- Fakemeta;
- Hamsandwich;
- Engine;
Imagini | Afiseaza codul
Image

Image

Image

Image

Image

Image

Image

Image

Image
Credite | Afiseaza codul
NiHiLaNTh - pentru un stock: sa se salveze fragurile facute cu bagheta
Hades Ownage - Plugin extras din Harry vs. Volde( 0.0.1 ) + imbunatatiri facute de mine
cyby: compatibilitatea pluginului cu sistemele de credite, puncte, bani
sDs|Aragon* : cateva particele din cod
Informatii: Pentru Update-uri / Imbunatatiri sau erori intalnite pe parcursul jocului din cauza baghetei, postati in acest topic! Pluginul este finalizat din septembrie 2013 asa ca multa lume il cauta asa ca la cererea mai multor utilizatori l-am postat postat!

v0.0.3: M-am gandit sa fac o alta versiune compatibila cu sistemul de credite la lui Askhanar, Aragon, un sistem de puncte oricare, si default, bani.
Cautati in sursa liniile

Code: Select all

#define ASKHANAR_CREDITS
//#define ARAGON_CREDITS
//#define POINTS
//#define MONEY
si stergeti "//" din fata sistemului pe care il folositi.
Ex: Folosesc sistemul de credite al lui Askhanar. Atunci adaug "//" in fata la //#define MONEY si sterg "//" din fata la #define ASKHANAR_CREDITS !
Have Fun!!! ;)
Last edited by YONTU on 25 Jan 2014, 22:13, edited 5 times in total.
„Peste douăzeci de ani vei fi dezamăgit din cauza lucrurilor pe care nu le-ai făcut, nu din cauza celor pe care le-ai făcut.” - Mark Twain
„Asa e si in viata, hotii castiga, prostii care invata pierd.” - Mihai Nemeș
Pluginurile mele publice | Afiseaza codul
Control HE Damage(s)
[Zombie mod] Liderul oamenilor
NO RUSH (MANUAL)
Salvatorul Craciunului
Harry Potter's Magic Wand [0.0.3]
New HE Grenade Effects
Upgrades Menu -> Health/Armor/Damage
Serverele care au achizitonat pluginurile mele: #1 #2

CONTACT: sef_yontu@yahoo.com | skype: cyp_yontu
eXtreamSHOP
User avatar
Truth*
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 776
Joined: 11 Oct 2013, 10:08
Detinator Steam: Da
SteamID: Ezeru
Reputatie: Moderator ajutator
Membru Club eXtreamCS (4 luni)
Nume anterior: HyperioN.
Scripter eXtreamCS
0.2 / 3
Fond eXtream: 0
Location: Sibiu
Has thanked: 46 times
Been thanked: 123 times
Contact:

24 Jan 2014, 19:50

:O :O :O Super tare YONTU Felicitari !!! =D> =D> =D>
P.S.: Netestat = Nu am avut timp să mă uit atent peste cod. Deci ceea ce am scris este posibil să fie greşit sau să aibă erori.

If i helped you and you wanna thank me, you can donate at this link : here
This will motivate me to help you in the future.
[If you want a private plugin send me a PM.(No complex plugins please, I am a student and I don't have the time to make those)]
User avatar
DaNNe.
Fost moderator
Fost moderator
Posts: 2906
Joined: 08 Nov 2013, 20:43
Detinator Steam: Da
CS Status: Activitate scăzută
SteamID: /id/FurienMaster
Reputatie: Nick anterior: DnD. Gold, Emrys
0.5/3
Fost moderator ajutator
Fost Membru Club eXtreamCS (doua luni)
Has thanked: 242 times
Been thanked: 138 times
Contact:

24 Jan 2014, 20:25

Ooooo OOO ooooo
Si pana la urma l-ai postat, nu ? :))
Unele specimene nu-l merita. Eu sunt primul care am avut acest Plugin si sunt mandru de acest lucru. :D
La mai multe ! :)>-
Contact: Activitate scazuta.
User avatar
YONTU
Moderator ajutator
Moderator ajutator
Posts: 2480
Joined: 10 May 2013, 13:25
Detinator Steam: Nu
CS Status: Everyone is looking at ur shoes
Reputatie: Moderator ajutator
Fost scripter eXtreamCS
Location: Gura Humorului
Has thanked: 260 times
Been thanked: 279 times
Contact:

24 Jan 2014, 20:28

Hai multam >:) !
„Peste douăzeci de ani vei fi dezamăgit din cauza lucrurilor pe care nu le-ai făcut, nu din cauza celor pe care le-ai făcut.” - Mark Twain
„Asa e si in viata, hotii castiga, prostii care invata pierd.” - Mihai Nemeș
Pluginurile mele publice | Afiseaza codul
Control HE Damage(s)
[Zombie mod] Liderul oamenilor
NO RUSH (MANUAL)
Salvatorul Craciunului
Harry Potter's Magic Wand [0.0.3]
New HE Grenade Effects
Upgrades Menu -> Health/Armor/Damage
Serverele care au achizitonat pluginurile mele: #1 #2

CONTACT: sef_yontu@yahoo.com | skype: cyp_yontu
User avatar
roberteeel
Membru eXtream
Membru eXtream
Posts: 4782
Joined: 05 Sep 2012, 10:39
Detinator Steam: Nu
Reputatie: Nick anterior: QAZW, Robert.ultrasFarul, CT 18 ROS
Restrictie schimbare nume
Fost moderator
Fost Membru Club eXtreamCS (doua luni)
Has thanked: 348 times
Been thanked: 380 times

24 Jan 2014, 20:30

Foarte frumos plugin-ul! :)
Merci frumos, meriti respect pentru toata munca pe care o depui.
User avatar
YONTU
Moderator ajutator
Moderator ajutator
Posts: 2480
Joined: 10 May 2013, 13:25
Detinator Steam: Nu
CS Status: Everyone is looking at ur shoes
Reputatie: Moderator ajutator
Fost scripter eXtreamCS
Location: Gura Humorului
Has thanked: 260 times
Been thanked: 279 times
Contact:

24 Jan 2014, 20:52

Askhanar, mancatas ochisorii :)) e o onoare pentru mine! :)
Mersi QAZW ! :)>-
„Peste douăzeci de ani vei fi dezamăgit din cauza lucrurilor pe care nu le-ai făcut, nu din cauza celor pe care le-ai făcut.” - Mark Twain
„Asa e si in viata, hotii castiga, prostii care invata pierd.” - Mihai Nemeș
Pluginurile mele publice | Afiseaza codul
Control HE Damage(s)
[Zombie mod] Liderul oamenilor
NO RUSH (MANUAL)
Salvatorul Craciunului
Harry Potter's Magic Wand [0.0.3]
New HE Grenade Effects
Upgrades Menu -> Health/Armor/Damage
Serverele care au achizitonat pluginurile mele: #1 #2

CONTACT: sef_yontu@yahoo.com | skype: cyp_yontu
User avatar
FlyingSnow
Membru, skill +2
Membru, skill +2
Posts: 841
Joined: 01 Oct 2012, 01:22
Detinator Steam: Da
Detinator server CS: Dap.
SteamID: Nu-i public.
Has thanked: 26 times
Been thanked: 52 times
Contact:

24 Jan 2014, 20:59

Felicitari, in sfarsit ceva de calitate fara sa ceri $. Apreciez. ( Cu toate ca nu-l folosesc) :)
User avatar
Alyn^H3k3r
Membru, skill +1
Membru, skill +1
Posts: 111
Joined: 26 Nov 2013, 18:17
Detinator Steam: Nu
Detinator server CS: Da
Location: Galati
Has thanked: 14 times
Been thanked: 2 times
Contact:

24 Jan 2014, 22:33

Poti sa il faci sa coste credite? (pe nativele de la pluginul lui askhanar)
Ajut la modificarea/creearea de addons-uri/pluginuri CS1.6 de orice mod, ajutorul meu nu consta in nimic, o fac din pura placere!

ContacT:
Skype: novuslink.h3k3r
Messenger: novuslink.h3k3r
E-mail: novuslink.h3k3r@yahoo.com

User avatar
Truth*
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 776
Joined: 11 Oct 2013, 10:08
Detinator Steam: Da
SteamID: Ezeru
Reputatie: Moderator ajutator
Membru Club eXtreamCS (4 luni)
Nume anterior: HyperioN.
Scripter eXtreamCS
0.2 / 3
Fond eXtream: 0
Location: Sibiu
Has thanked: 46 times
Been thanked: 123 times
Contact:

24 Jan 2014, 23:26

Poftim :
SMA | Afiseaza codul
/* Plugin generated by AMXX-Studio */

#include < amxmodx >
#include < amxmisc >
#include < cstrike >
#include < hamsandwich >
#include < fakemeta >
#include < engine >
#include < message_const >
#include < CC_ColorChat >

#define PLUGIN_NAME		"Harry Potter's Magic Wand"
#define PLUGIN_VERSION	"0.0.2"
#define PLUGIN_AUTHOR	"Hades Ownage & YONTU"

native fcs_get_user_credits(client);
native fcs_set_user_credits(client, credits);

#define HARRY_WAND_RECOIL 	0.0			// Recoil
#define HARRY_WAND_SPEED 	0.35			// Click stanga
#define HARRY_WAND_SPEED2 	0.75			// Click dreapta
#define HARRY_WAND_FIRE	random_num( 3, 6 )	// Animatie cand trage cu click stanga
#define HARRY_WAND_FIRE2	random_num( 5, 10 )	// Animatie cand trage cu click dreapta

#define TE_BEAMENTPOINT	1
#define TE_EXPLOSION		3
#define TE_SPRITETRAIL		15
#define TE_BEAMCYLINDER		21

new const Tag[  ] = "[Harry Magic Wand]";

new HarryFireSound[  ] = "harry_wand/harry_shoot1.wav";
new HarryHitSound[  ] = "harry_wand/harry_hit.wav";
new HarryHitSound2[  ] = "harry_wand/harry_shoot2.wav";
new HarryModel[  ] = "models/harry_wand/v_harry_wand.mdl";

new HarryBeam, HarryExp, HarryExp2, DeathSprite;

new bool:g_HasHarryWand[ 33 ];

new Harry_Ammo[ 33 ];
new Float:HarryLastShotTime[ 33 ];

new HarryDamageCvar, HarryDamageCvar2, HarryAmmo, HarryKillMoney, HarryDistance, HarryMagicCost;

public plugin_init(  ) {

	register_event( "CurWeapon", "CurrentWeapon", "be", "1=1" );
	
	register_forward( FM_CmdStart, "Harry_CmdStart" );
	
	RegisterHam( Ham_Spawn, "player", "Ham_SpawnCallback", 1 );
	
	HarryDamageCvar = register_cvar( "harry_damage", "80.0" );
	HarryDamageCvar2 = register_cvar( "harry_damage2", "135.0" );
	HarryAmmo = register_cvar( "harry_ammo", "300" );
	HarryKillMoney = register_cvar( "harry_money_reward", "5000" );
	HarryDistance = register_cvar( "harry_distance", "90909" );
	HarryMagicCost = register_cvar( "harry_cost", "50" );

	register_concmd( "amx_get_harry", "GiveHarry", ADMIN_BAN, "< nume > < ammo >" );

	register_clcmd( "say /magic", "ClCmdBuyMagicWand" );
	register_clcmd( "say_team /magic", "ClCmdBuyMagicWand" );
}

public plugin_precache(  ) {
	
	register_plugin( PLUGIN_NAME, 
			PLUGIN_VERSION, 
			PLUGIN_AUTHOR );

	precache_sound( HarryFireSound );
	precache_sound( HarryHitSound );
	precache_sound( HarryHitSound2 );

	precache_model( HarryModel );

	HarryBeam = precache_model( "sprites/harry_wand/harry_plasma_beam.spr" );
	HarryExp = precache_model( "sprites/harry_wand/harry_plasma_exp2.spr" );
	HarryExp2 = precache_model( "sprites/harry_wand/harry_plasma_exp3.spr" );
	DeathSprite = precache_model( "sprites/harry_wand/harry_skull.spr" );
}

public client_putinserver( id ) {
		
	g_HasHarryWand[ id ] = false;
	Harry_Ammo[ id ] = false;
}

public client_disconnect( id ) {
	
	g_HasHarryWand[ id ] = false;
	Harry_Ammo[ id ] = false;
}

public ClCmdBuyMagicWand( id ) {

	new HarryCost = get_pcvar_num( HarryMagicCost );

	if( g_HasHarryWand[ id ] ) {

		ColorChat( id, GREEN, "^x04%s^x03 Ai deja bagheta !", Tag );
		return 1;
	}

	else if( !is_user_alive( id ) ) {

		ColorChat( id, GREEN, "^x04%s^x01 Nu poti cumpara bagheta cat timp esti mort.", Tag );
		return 1;
	}

	else if( fcs_get_user_credits( id ) < HarryCost ) {

		ColorChat( id, GREEN, "^x04%s^x01 Mai ai nevoie de^x03 %i $^x01 pentru a cumpara bagheta !", Tag, HarryCost - cs_get_user_money( id ) );
		return 1;
	}

	else {

		get_harry( id );

		ColorChat( id, GREEN, "^x04%s^x01 Ai cumparat bagheta pentru^x03 %i $^x01", Tag, HarryCost );
		fcs_set_user_credits( id, fcs_get_user_credits( id ) - HarryCost );

		return 1;
	}

	return 1;
}

public GiveHarry( id, level, cid ) {
	
	if( !cmd_access( id, level, cid, 3 ) ) 
		return PLUGIN_HANDLED;
	
	new szTtarget[ 32 ], szAmmoHarry[ 21 ];
	
	read_argv( 1, szTtarget, 31 );
	read_argv( 2, szAmmoHarry, 20 );

	new iPlayer = cmd_target( id, szTtarget, 8 );

	new szAdminName[ 32 ], szPlayerName[ 32 ];

	get_user_name( id, szAdminName, 31 );
	get_user_name( iPlayer, szPlayerName, 31 );

	if( !iPlayer )
		return PLUGIN_HANDLED;

	if( !is_user_alive( iPlayer ) ) {

		client_print( id, print_console, "Jucatorul %s nu este in viata !", szPlayerName );
		return 1;
	}

	if( g_HasHarryWand[ iPlayer ] ) {

		client_print( id, print_console, "Jucatorul %s are deja bagheta !", szPlayerName );
		return 1;
	}

	else {
	
		new AmmoForMagic = str_to_num( szAmmoHarry );

		ColorChat( 0, GREEN, "^x04%s^x01 Adminul^x03 %s i-a dat lui^x03 %s^x01 bagheta lui Harry cu^x03 %d ammo^x01 !", Tag, szAdminName, szPlayerName, szAmmoHarry );

		get_harry( iPlayer );
		Harry_Ammo[ iPlayer ] += AmmoForMagic;
	}

	return PLUGIN_CONTINUE;
}

public get_harry( id ) {

	if( is_user_alive( id ) ) {

		g_HasHarryWand[ id ] = true;
		engclient_cmd( id, "weapon_knife" );

		Harry_Ammo[ id ] = get_pcvar_num( HarryAmmo );
	}

	else {

		client_print( id, print_console, "Jucatorul nu este in viata! " );
		g_HasHarryWand[ id ] = false;

		return 1;
	}

	return 1;
}

public CurrentWeapon( id )
	if( get_user_weapon( id ) == CSW_KNIFE && g_HasHarryWand[ id ] )
		set_pev( id, pev_viewmodel2, HarryModel );

public Ham_SpawnCallback( id ) {
	
	if( !is_user_alive( id ) )
		return 1;
	
	g_HasHarryWand[ id ] = false;
	
	return 0;
}

public Harry_CmdStart( id, uc_handle, seed ) {
	
	if( is_user_alive( id ) && g_HasHarryWand[ id ] ) {
		
		static CurButton;
		CurButton = get_uc( uc_handle, UC_Buttons );
		new Float:flNextAttack = get_pdata_float( id, 83, 5 );

		if( CurButton & IN_ATTACK ) {

			if( get_user_weapon( id ) == CSW_KNIFE && g_HasHarryWand[ id ] ) {

				if( Harry_Ammo[ id ] > 0  && flNextAttack <= 0.0 ) {

					if( get_gametime(  ) - HarryLastShotTime[ id ] > HARRY_WAND_SPEED ) {
						
						set_weapon_anim( id, HARRY_WAND_FIRE );
						emit_sound( id, CHAN_WEAPON, HarryFireSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
						
						Harry_Fire( id );

						if( Harry_Ammo[ id ] > 0 ) {
							
							set_hudmessage( 0, 127, 255, 0.01, 0.85, 0, 6.0, 1.0 );
							show_hudmessage( id, "Remaining Ammo: %d !", Harry_Ammo[ id ] );
						}
						
						else if( Harry_Ammo[ id ] <= 0 ) {
							
							set_hudmessage( 255, 0, 0, 0.01, 0.90, 0, 6.0, 1.0 );
							show_hudmessage( id, "No Ammo !" );
							
						}
						
						static Float:Punch_Angles[ 3 ];
						
						Punch_Angles[ 0]  = -5.0;
						Punch_Angles[ 1 ] = HARRY_WAND_RECOIL;
						Punch_Angles[ 2 ] = HARRY_WAND_RECOIL;
						
						set_pev( id, pev_punchangle, Punch_Angles );

						Harry_Ammo[ id ] -= 1;
						HarryLastShotTime[ id ] = get_gametime(  );
						
					}	
				}
				
				CurButton &= ~IN_ATTACK;
				set_uc( uc_handle, UC_Buttons, CurButton );
			}		
		}
		
		else if( CurButton & IN_ATTACK2 ) {

			if( get_user_weapon( id ) == CSW_KNIFE && g_HasHarryWand[ id ] ) {

				if( Harry_Ammo[ id ] >= 5  && flNextAttack <= 0.0 ) {

					if( get_gametime(  ) - HarryLastShotTime[ id ] > HARRY_WAND_SPEED2 ) {
						
						set_weapon_anim( id, HARRY_WAND_FIRE2 );
						emit_sound( id, CHAN_WEAPON, HarryFireSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
						
						Harry_Fire2( id );

						set_hudmessage( 0, 127, 255, 0.01, 0.85, 0, 6.0, 1.0 );
						show_hudmessage( id, "Remaining Ammo: %d !", Harry_Ammo[ id ] );
						
						static Float:Punch_Angles[ 3 ];
						
						Punch_Angles[ 0 ] = -5.0;
						Punch_Angles[ 1 ] = HARRY_WAND_RECOIL;
						Punch_Angles[ 2 ] = HARRY_WAND_RECOIL;
						
						set_pev( id, pev_punchangle, Punch_Angles );

						Harry_Ammo[ id ] -= 3;
						HarryLastShotTime[ id ] = get_gametime(  );
						
					}	
				}
				
				CurButton &= ~IN_ATTACK2;
				set_uc( uc_handle, UC_Buttons, CurButton );
			}
		}
	}
	
	else if( is_user_alive ( id ) && !g_HasHarryWand[ id ] )
		return PLUGIN_CONTINUE;

	return PLUGIN_CONTINUE;
}

public Harry_Fire( id ) {
	
	static Victim, Body, EndOrigin[ 3 ], BeamOrigin[ 3 ];
	get_user_origin( id, BeamOrigin, 3 );
	get_user_origin( id, EndOrigin, 3 );

	message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
	write_byte( 1 );
	write_short( id | 0x1000 );
	write_coord( BeamOrigin[ 0 ] );	// Start X
	write_coord( BeamOrigin[ 1 ] );	// Start Y
	write_coord( BeamOrigin[ 2 ] );	// Start Z
	write_short( HarryBeam);		// Sprite
	write_byte( 1 );      		// Start frame				
	write_byte( 1 );     		// Frame rate					
	write_byte( 1 );			// Life
	write_byte( 40 );   		// Line width				
	write_byte( 0 );    		// Noise
	write_byte( 108 ); 		// Red
	write_byte( 236 );			// Green
	write_byte( 23 );			// Blue
	write_byte( 150 );     		// Brightness					
	write_byte( 25 );      		// Scroll speed					
	message_end(  );

	message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
	write_byte( 3 );
	write_coord( EndOrigin[ 0 ] );
	write_coord( EndOrigin[ 1 ] );
	write_coord( EndOrigin[ 2 ] );
	write_short( HarryExp );	// sprite
	write_byte( 10 );		// scale in 0.1's
	write_byte( 15 );		// framerate
	write_byte( 4 );		// flags
	message_end(  );
	
	get_user_aiming( id, Victim, Body, get_pcvar_num( HarryDistance ) );

	if( is_user_connected( Victim ) ) {

		new Float:Damage = float( get_damage_body( Body, get_pcvar_float( HarryDamageCvar ) ) );
		
		new Float:VictimOrigin[ 3 ];
		VictimOrigin[ 0 ] = float( EndOrigin[ 0 ] );
		VictimOrigin[ 1 ] = float( EndOrigin[ 1 ] );
		VictimOrigin[ 2 ] = float( EndOrigin[ 2 ] );
		
		if( get_user_health( Victim ) - get_pcvar_float( HarryDamageCvar ) >= 1 && is_user_alive( Victim ) && !fm_get_user_godmode( Victim ) && get_user_team( Victim ) != get_user_team( id ) ) {

			new iOrigin[ 3 ];
			get_user_origin( Victim, iOrigin, 0 );

			message_begin( MSG_PVS, SVC_TEMPENTITY, iOrigin ); 
			write_byte( 21 );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] + 60 );	// end axis + radius
			write_short( HarryExp );	// sprite
			write_byte( 0 );		// startfrate
			write_byte( 0 );		// framerate
			write_byte( 10 );		// life in 0.1 sec
			write_byte( 60 );		// width
			write_byte( 0 );		// amplitude
			write_byte( 0 );		// red
			write_byte( 200 );		// green
			write_byte( 200 );		// blue
			write_byte( 153 );		// brightness
			write_byte( 0 );		// speed
			message_end(  );
			
			message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
			write_byte( 15 );
			write_coord( iOrigin[ 0 ] ); 	// start position (X)
			write_coord( iOrigin[ 1 ] ); 	// start position (Y)
			write_coord( iOrigin[ 2 ] + 40 ); // start position (Z)
			write_coord( iOrigin[ 0 ] ); 	// end position (X)
			write_coord( iOrigin[ 1 ] );	// end position (Y)
			write_coord( iOrigin[ 2 ] );	// end position (Z)
			write_short( DeathSprite );	// sprite index
			write_byte( 50 );		// count
			write_byte( 20 );		// life in 0.1's
			write_byte( 2 );		// scale in 0.1's
			write_byte( 50 );		// velocity along vector in 10's
			write_byte( 10 );		// randomness of velocity in 10's
			message_end(  );
			
			make_knockback( Victim, VictimOrigin, 3 * get_pcvar_float( HarryDamageCvar ) );
			
			ExecuteHam( Ham_TakeDamage, Victim, id, id, Damage, DMG_NERVEGAS );
			
			message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "Damage" ), _, Victim );
			write_byte( 0 );
			write_byte( 0 );
			write_long( DMG_SHOCK );
			write_coord( 0 );
			write_coord( 0 );
			write_coord( 0 );
			message_end(  );
			
			FadeScreen( Victim, 4.0, 255, 122, 122, 100 );
			ShakeScreen( Victim, 3.0 );
		}

		else if( get_user_health( Victim ) - get_pcvar_float( HarryDamageCvar ) < 1 && is_user_alive( Victim ) && !fm_get_user_godmode( Victim ) && get_user_team( Victim ) != get_user_team( id ) ) {
			
			new iOrigin[ 3 ];
			get_user_origin( Victim, iOrigin, 0 );

			message_begin( MSG_PVS, SVC_TEMPENTITY, iOrigin ); 
			write_byte( 21 );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] + 60 );	// end axis + radius
			write_short( HarryExp );	// sprite
			write_byte( 0 );		// startfrate
			write_byte( 0 );		// framerate
			write_byte( 10 );		// life in 0.1 sec
			write_byte( 60 );		// width
			write_byte( 0 );		// amplitude
			write_byte( 0 );		// red
			write_byte( 200 );		// green
			write_byte( 200 );		// blue
			write_byte( 153 );		// brightness
			write_byte( 0 );		// speed
			message_end(  );
			
			message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
			write_byte( 15 );
			write_coord( iOrigin[ 0 ] ); 	// start position (X)
			write_coord( iOrigin[ 1 ] ); 	// start position (Y)
			write_coord( iOrigin[ 2 ] + 40 ); // start position (Z)
			write_coord( iOrigin[ 0 ] ); 	// end position (X)
			write_coord( iOrigin[ 1 ] );	// end position (Y)
			write_coord( iOrigin[ 2 ] );	// end position (Z)
			write_short( DeathSprite );	// sprite index
			write_byte( 50 );		// count
			write_byte( 20 );		// life in 0.1's
			write_byte( 2 );		// scale in 0.1's
			write_byte( 50 );		// velocity along vector in 10's
			write_byte( 10 );		// randomness of velocity in 10's
			message_end(  );
			
			make_knockback( Victim, VictimOrigin, 3 * get_pcvar_float( HarryDamageCvar ) );
			
			death_message( id, Victim, 1, "Magic Wand" );
		}
	}

	else {

		static ClassName[ 32 ];
		pev( Victim, pev_classname, ClassName, charsmax( ClassName ) );

		if( equal( ClassName, "func_breakable" ) )
			if( entity_get_float( Victim, EV_FL_health ) <= 80 )
				force_use( id, Victim );
	}
	
	emit_sound( id, CHAN_WEAPON, HarryHitSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
}

public Harry_Fire2( id ) {
	
	static Victim, Body, EndOrigin[3], BeamOrigin[3];
	get_user_origin( id, BeamOrigin, 3 ) ;
	get_user_origin( id, EndOrigin, 3 );

	message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
	write_byte( 1 );
	write_short( id | 0x1000 );
	write_coord( BeamOrigin[ 0 ] );	// Start X
	write_coord( BeamOrigin[ 1 ] );	// Start Y
	write_coord( BeamOrigin[ 2 ] );	// Start Z
	write_short( HarryBeam );	// Sprite
	write_byte( 1 );      		// Start frame				
	write_byte( 1 );     		// Frame rate					
	write_byte( 1 );			// Life
	write_byte( 40 );   		// Line width				
	write_byte( 0 );    		// Noise
	write_byte( 150 ); 		// Red
	write_byte( 22 );			// Green
	write_byte( 235 );			// Blue
	write_byte( 150 );     		// Brightness					
	write_byte( 25 );      		// Scroll speed					
	message_end(  );

	message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
	write_byte( 3 );
	write_coord( EndOrigin[ 0 ] );
	write_coord( EndOrigin[ 1 ] );
	write_coord( EndOrigin[ 2 ] );
	write_short( HarryExp2 );
	write_byte( 10 );
	write_byte( 15 );
	write_byte( 4 );
	message_end(  );
	
	get_user_aiming( id, Victim, Body, get_pcvar_num( HarryDistance ) );

	if( is_user_alive( Victim ) ) {

		new Float:Damage = float( get_damage_body( Body, get_pcvar_float( HarryDamageCvar ) ) );

		new Float:VictimOrigin[ 3 ];
		VictimOrigin[ 0 ] = float( EndOrigin[ 0 ] );
		VictimOrigin[ 1 ] = float( EndOrigin[ 1 ] );
		VictimOrigin[ 2 ] = float( EndOrigin[ 2 ] );
		
		if( get_user_health( Victim ) - get_pcvar_float( HarryDamageCvar2 ) >= 1 && is_user_alive( Victim ) && !fm_get_user_godmode( Victim ) && get_user_team( Victim ) != get_user_team( id ) ) {
			
			new iOrigin[ 3 ];
			get_user_origin( Victim, iOrigin, 0 );

			message_begin( MSG_PVS, SVC_TEMPENTITY, iOrigin ); 
			write_byte( 21 );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] + 60 );	// end axis + radius
			write_short( HarryExp2 );	// sprite
			write_byte( 0 );		// startfrate
			write_byte( 0 );		// framerate
			write_byte( 10 );		// life in 0.1 sec
			write_byte( 60 );		// width
			write_byte( 0 );		// amplitude
			write_byte( 217 );		// red
			write_byte( 132 );		// green
			write_byte( 47 );		// blue
			write_byte( 153 );		// brightness
			write_byte( 0 );		// speed
			message_end(  );
			
			message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
			write_byte( 15 );
			write_coord( iOrigin[ 0 ] ); 	// start position (X)
			write_coord( iOrigin[ 1 ] ); 	// start position (Y)
			write_coord( iOrigin[ 2 ] + 40 ); // start position (Z)
			write_coord( iOrigin[ 0 ] ); 	// end position (X)
			write_coord( iOrigin[ 1 ] );	// end position (Y)
			write_coord( iOrigin[ 2 ] );	// end position (Z)
			write_short( DeathSprite );	// sprite index
			write_byte( 50 );		// count
			write_byte( 20 );		// life in 0.1's
			write_byte( 2 );		// scale in 0.1's
			write_byte( 50 );		// velocity along vector in 10's
			write_byte( 10 );		// randomness of velocity in 10's
			message_end(  );
			
			make_knockback( Victim, VictimOrigin, 3 * get_pcvar_float( HarryDamageCvar2 ) );
			
			ExecuteHam( Ham_TakeDamage, Victim, id, id, Damage, DMG_NERVEGAS );
			
			message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "Damage" ), _, Victim );
			write_byte( 0 );
			write_byte( 0 );
			write_long( DMG_NERVEGAS );
			write_coord( 0 ) ;
			write_coord( 0 );
			write_coord( 0 );
			message_end(  );
			
			FadeScreen( Victim, 4.0, 0, 255, 0, 100 );
			ShakeScreen( Victim, 3.0 );
		}

		else if( get_user_health( Victim ) - get_pcvar_float( HarryDamageCvar2 ) < 1 && is_user_alive( Victim ) && !fm_get_user_godmode( Victim ) && get_user_team( Victim ) != get_user_team( id ) ) {
			
			new iOrigin[ 3 ];
			get_user_origin( Victim, iOrigin, 0 );

			message_begin( MSG_PVS, SVC_TEMPENTITY, iOrigin ); 
			write_byte( 21 );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] );
			write_coord( iOrigin[ 0 ] );
			write_coord( iOrigin[ 1 ] );
			write_coord( iOrigin[ 2 ] + 60 );	// end axis + radius
			write_short( HarryExp2 );	// sprite
			write_byte( 0 );		// startfrate
			write_byte( 0 );		// framerate
			write_byte( 10 );		// life in 0.1 sec
			write_byte( 60 );		// width
			write_byte( 0 );		// amplitude
			write_byte( 217 );		// red
			write_byte( 132 );		// green
			write_byte( 47 );		// blue
			write_byte( 153 );		// brightness
			write_byte( 0 );		// speed
			message_end(  );
			
			message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
			write_byte( 15 );
			write_coord( iOrigin[ 0 ] ); 	// start position (X)
			write_coord( iOrigin[ 1 ] ); 	// start position (Y)
			write_coord( iOrigin[ 2 ] + 40 ); // start position (Z)
			write_coord( iOrigin[ 0 ] ); 	// end position (X)
			write_coord( iOrigin[ 1 ] );	// end position (Y)
			write_coord( iOrigin[ 2 ] );	// end position (Z)
			write_short( DeathSprite );	// sprite index
			write_byte( 50 );		// count
			write_byte( 20 );		// life in 0.1's
			write_byte( 2 );		// scale in 0.1's
			write_byte( 50 );		// velocity along vector in 10's
			write_byte( 10 );		// randomness of velocity in 10's
			message_end(  );
			
			make_knockback( Victim, VictimOrigin, 3 * get_pcvar_float( HarryDamageCvar2 ) );
			
			death_message( id, Victim, 1, "Double Magic Wand" );
		}
	}

	else {

		static ClassName[ 32 ];
		pev( Victim, pev_classname, ClassName, charsmax( ClassName ) );

		if( equal( ClassName, "func_breakable" ) )
			if( entity_get_float( Victim, EV_FL_health ) <= 80 )
				force_use( id, Victim );
	}

	emit_sound( id, CHAN_WEAPON, HarryHitSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
}

public make_knockback( Victim, Float:origin[ 3 ], Float:maxspeed ) {

	new Float:fVelocity[ 3 ];
	
	kickback( Victim, origin, maxspeed, fVelocity );
	entity_set_vector( Victim, EV_VEC_velocity, fVelocity );
	
	return( 1 );
}

stock ShakeScreen( id, const Float:iSeconds ) {

	message_begin( MSG_ONE, get_user_msgid( "ScreenShake" ), { 0, 0, 0 }, id );
	write_short( floatround( 4096.0 * iSeconds, floatround_round ) );
	write_short( floatround( 4096.0 * iSeconds, floatround_round ) );
	write_short( 1<<13 );
	message_end(  );
}

stock FadeScreen( id, const Float:iSeconds, const iRed, const iGreen, const iBlue, const iAlpha ) {
      
	message_begin( MSG_ONE, get_user_msgid( "ScreenFade" ), _, id );
	write_short( floatround( 4096.0 * iSeconds, floatround_round ) );
	write_short( floatround( 4096.0 * iSeconds, floatround_round ) );
	write_short( 0x0000 );
	write_byte( iRed );
	write_byte( iGreen );
	write_byte( iBlue );
	write_byte( iAlpha );
	message_end(  );
}		

stock kickback( ent, Float:fOrigin[ 3 ], Float:fSpeed, Float:fVelocity[ 3 ] ) {

	new Float:fEntOrigin[ 3 ];
	entity_get_vector( ent, EV_VEC_origin, fEntOrigin );
	
	new Float:fDistance[ 3 ];
	fDistance[ 0 ] = fEntOrigin[ 0 ] - fOrigin[ 0 ];
	fDistance[ 1 ] = fEntOrigin[ 1 ] - fOrigin[ 1 ];
	fDistance[ 2 ] = fEntOrigin[ 2 ] - fOrigin[ 2 ];

	new Float:fTime =( vector_distance( fEntOrigin, fOrigin ) / fSpeed );
	fVelocity[ 0 ] = fDistance[ 0 ] / fTime;
	fVelocity[ 1 ] = fDistance[ 1 ] / fTime;
	fVelocity[ 2 ] = fDistance[ 2 ] / fTime;
	
	return( fVelocity[ 0 ] && fVelocity[ 1 ] && fVelocity[ 2 ] );
}

// stock from "m79"
stock death_message( Killer, Victim, ScoreBoard, const Weapon[  ] ) {
	
	set_msg_block( get_user_msgid( "DeathMsg" ), BLOCK_SET );

	ExecuteHamB( Ham_Killed, Victim, Killer, 2 );

	set_msg_block( get_user_msgid( "DeathMsg" ), BLOCK_NOT );

	make_deathmsg( Killer, Victim, 0, Weapon );
	cs_set_user_money( Killer, cs_get_user_money( Killer ) + get_pcvar_num( HarryKillMoney ) );
	
	if( ScoreBoard ) {

		message_begin( MSG_BROADCAST, get_user_msgid( "ScoreInfo" ) );
		write_byte( Killer );
		write_short( pev( Killer, pev_frags ) );
		write_short( cs_get_user_deaths( Killer ) );
		write_short( 0 );
		write_short( get_user_team( Killer ) );
		message_end(  );
		
		message_begin( MSG_BROADCAST, get_user_msgid( "ScoreInfo" ) );
		write_byte( Victim );
		write_short( pev( Victim, pev_frags ) );
		write_short( cs_get_user_deaths( Victim ) );
		write_short( 0 );
		write_short( get_user_team( Victim ) );
		message_end(  );
	}
}

stock set_weapon_anim( id, anim ) {

	set_pev( id, pev_weaponanim, anim );

	if( is_user_alive( id ) ) {

		message_begin( MSG_ONE, SVC_WEAPONANIM, _, id );
		write_byte( anim );
		write_byte( pev( id, pev_body ) );
		message_end(  );
	}
}

stock get_damage_body( body, Float:fDamage ) {

	switch( body ) {

		case HIT_HEAD: fDamage *= 4.0;

		case HIT_STOMACH: fDamage *= 1.1;

		case HIT_CHEST: fDamage *= 1.5;

		case HIT_LEFTARM: fDamage *= 0.77;

		case HIT_RIGHTARM: fDamage *= 0.77;

		case HIT_LEFTLEG: fDamage *= 0.75;

		case HIT_RIGHTLEG: fDamage *= 0.75;

		default: fDamage *= 1.0;
	}
	
	return floatround( fDamage );
}

// stock from "fakemeta_util"
stock fm_get_user_godmode( index ) {

	new Float:val;
	pev( index, pev_takedamage, val );

	return ( val == DAMAGE_NO );
}
P.S.: Netestat = Nu am avut timp să mă uit atent peste cod. Deci ceea ce am scris este posibil să fie greşit sau să aibă erori.

If i helped you and you wanna thank me, you can donate at this link : here
This will motivate me to help you in the future.
[If you want a private plugin send me a PM.(No complex plugins please, I am a student and I don't have the time to make those)]
User avatar
Adventx
Membru, skill +4
Membru, skill +4
Posts: 1890
Joined: 17 Sep 2013, 20:44
Detinator Steam: Da
Reputatie: Fost moderator ajutator
Has thanked: 125 times
Been thanked: 154 times
Contact:

24 Jan 2014, 23:54

:O Bravo man, super tare!
Bafta!
User avatar
FaTzZu
Fost moderator
Fost moderator
Posts: 1445
Joined: 22 Dec 2012, 18:37
Detinator Steam: Da
Reputatie: Fost moderator ajutator
Has thanked: 124 times
Been thanked: 177 times
Contact:

25 Jan 2014, 08:40

Trebuie sa recunosc :)) ce e frumos e frumos .... bravo.
A fool's brain digests philosophy into folly, science into superstition, and art into pedantry.

#RETIRED.
User avatar
YONTU
Moderator ajutator
Moderator ajutator
Posts: 2480
Joined: 10 May 2013, 13:25
Detinator Steam: Nu
CS Status: Everyone is looking at ur shoes
Reputatie: Moderator ajutator
Fost scripter eXtreamCS
Location: Gura Humorului
Has thanked: 260 times
Been thanked: 279 times
Contact:

25 Jan 2014, 11:18

Update! :) A aparut versiunea 0.0.3! Vedeti primul post! :)
„Peste douăzeci de ani vei fi dezamăgit din cauza lucrurilor pe care nu le-ai făcut, nu din cauza celor pe care le-ai făcut.” - Mark Twain
„Asa e si in viata, hotii castiga, prostii care invata pierd.” - Mihai Nemeș
Pluginurile mele publice | Afiseaza codul
Control HE Damage(s)
[Zombie mod] Liderul oamenilor
NO RUSH (MANUAL)
Salvatorul Craciunului
Harry Potter's Magic Wand [0.0.3]
New HE Grenade Effects
Upgrades Menu -> Health/Armor/Damage
Serverele care au achizitonat pluginurile mele: #1 #2

CONTACT: sef_yontu@yahoo.com | skype: cyp_yontu
Post Reply

Return to “Pluginuri eXtream”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests