Raised This Month: $32 Target: $400
 8% 

Dr.Hax


Post New Thread Reply   
 
Thread Tools Display Modes
Yeah=}
Member
Join Date: Apr 2010
Location: Ural, Russia
Old 01-21-2012 , 07:59   Re: Dr.Hax
Reply With Quote #11

Quote:
Originally Posted by 341464 View Post
Hm, tested in tf2, it doesn't kill.
Try to increase monitor's weight. If it wont kill, let me know ( Sry, I have not TF2 DS to test it ) and I'll add features of sdkhooks as option for TF2. )
Yeah=} is offline
404UserNotFound
BANNED
Join Date: Dec 2011
Old 01-21-2012 , 10:13   Re: Dr.Hax
Reply With Quote #12

The computer monitor model does work in TF2. So does that "hacks" sound clip. It's been tested on my server.

As for the kill thing, I haven't been able to make it kill players on hit yet. It still randomly suicides me if I spam the command.

I'd love to see something working for TF2. Glad to see people have responded to this thread.

Last edited by 404UserNotFound; 01-21-2012 at 10:13.
404UserNotFound is offline
Yeah=}
Member
Join Date: Apr 2010
Location: Ural, Russia
Old 01-21-2012 , 14:29   Re: Dr.Hax
Reply With Quote #13

Quote:
Originally Posted by abrandnewday View Post
So does that "hacks" sound clip.
I can't understand what are you talking about... If you mean that "hacks" sound already exists in default HL2 contents, you are wrong cuz this sound has diffirent translations for each language.

Quote:
Originally Posted by abrandnewday View Post
As for the kill thing, I haven't been able to make it kill players on hit yet. It still randomly suicides me if I spam the command.
It works fine for CS:S. I can try to use sdkhooks with hook on StartTouch, Touch or ShouldCollide events. But I never tried to run something on TF2
Yeah=} is offline
341464
Senior Member
Join Date: Dec 2010
Location: GetClientEyePosition
Old 01-22-2012 , 00:24   Re: Dr.Hax
Reply With Quote #14

I tried spamming commands (TF2), still can't get player death to work, maybe you should add ontouch Playersuicide or something.
It only damage the prop so far.
341464 is offline
Send a message via Skype™ to 341464
404UserNotFound
BANNED
Join Date: Dec 2011
Old 01-22-2012 , 05:08   Re: Dr.Hax
Reply With Quote #15

Quote:
Originally Posted by Yeah=} View Post
I can't understand what are you talking about... If you mean that "hacks" sound already exists in default HL2 contents, you are wrong cuz this sound has diffirent translations for each language.
I'm sure it all re-translates back to "HACKS". No big deal there. It's better than using a custom sound. And most people don't download custom sounds, which is why my version of this doesn't use custom sounds.

Quote:
Originally Posted by Yeah=} View Post
It works fine for CS:S. I can try to use sdkhooks with hook on StartTouch, Touch or ShouldCollide events. But I never tried to run something on TF2
I changed the coding of the "Touch" thing around a bit, to try and fix it. That must be why mine was making me suicide whenever I spammed it. I changed that "~GetUserFlagBits" to a simple "GetUserFlagBits(client) && ADMFLAG_RCON". Obviously, I'm the only RCON user on my server, so it suicides me if a monitor "touches" me.

I tried removing the GetUserFlagBits part, and it still suicided me. I used a valid client check. Still suicided me.

It's something wrong with the Touch thing in TF2, I think. Even though I removed the flag checks so it wouldn't check the flags of someone, and hopefully kill whoever it touches, the prop would just go right through players, then eventually disappear. If I spammed it, the pile-up would cause one to touch me on the way out, or the code would just screw up, and cause me to suicide.

Maybe someone more experienced could look into this.

The one thing I haven't tried is increasing the monitors weight. But I don't know if prop weight has any effects on players in TF2...

Last edited by 404UserNotFound; 01-22-2012 at 05:11.
404UserNotFound is offline
341464
Senior Member
Join Date: Dec 2010
Location: GetClientEyePosition
Old 01-23-2012 , 06:29   Re: Dr.Hax
Reply With Quote #16

Quote:
Originally Posted by abrandnewday View Post
The one thing I haven't tried is increasing the monitors weight. But I don't know if prop weight has any effects on players in TF2...
I'm pretty sure it doesn't, props in TF2 cannot kill player.
(At least I haven't seen any case)

Last edited by 341464; 01-23-2012 at 06:30.
341464 is offline
Send a message via Skype™ to 341464
Yeah=}
Member
Join Date: Apr 2010
Location: Ural, Russia
Old 01-23-2012 , 11:43   Re: Dr.Hax
Reply With Quote #17

I've written a code for tf2, can anybody test it? I can't cuz I don't have installed TF2 on my laptop.

PS. If anybody want to try this code, please, if it doesn't work remove this line:
Code:
#define ON_START_TOUCH
and try again. If it still doesn't work tell me and I will continue my tries to make it works on TF2
Attached Files
File Type: sp Get Plugin or Get Source (dr_hax_tf2_spec_1.sp - 281 views - 6.3 KB)

Last edited by Yeah=}; 01-23-2012 at 11:47.
Yeah=} is offline
341464
Senior Member
Join Date: Dec 2010
Location: GetClientEyePosition
Old 01-23-2012 , 13:54   Re: Dr.Hax
Reply With Quote #18

Nope, at least not on the bots, but now if I touch it = suicide, that's a problem for sure.
I haven't try player yet though

EDIT:
Eyup, doesn't work, except on client itself
__________________

Last edited by 341464; 01-23-2012 at 14:04. Reason: EDIT
341464 is offline
Send a message via Skype™ to 341464
Yeah=}
Member
Join Date: Apr 2010
Location: Ural, Russia
Old 01-25-2012 , 03:09   Re: Dr.Hax
Reply With Quote #19

Quote:
Originally Posted by 341464 View Post
Nope, at least not on the bots, but now if I touch it = suicide, that's a problem for sure.
I haven't try player yet though

EDIT:
Eyup, doesn't work, except on client itself
I've rewritten the code that should work in TF2. Can you try it?

Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

#define VERSION "1.2_TF2"

#define MODEL "models/props_lab/monitor01a.mdl"
#define SOUND "res/drhax/Hax.mp3"

new Handle:drhax_enabled = 				INVALID_HANDLE;
new Handle:drhax_music_path = 			INVALID_HANDLE;
new Handle:drhax_monitor_weight = 		INVALID_HANDLE;
new Handle:drhax_throwing_force =			INVALID_HANDLE;
new Handle:drhax_let_users_set_weight = 	INVALID_HANDLE;
new Handle:drhax_distance_from_spawner = INVALID_HANDLE;
new Handle:drhax_only_admins =			INVALID_HANDLE;
new Handle:drhax_entity_destroy_delay =	INVALID_HANDLE;

new Handle:g_hThrowedObjects =			INVALID_HANDLE;

public Plugin:myinfo =
{
	name = "Dr.Hax",
	author = "Push",
	description = "Fell yourself as Dr.Hax",
	version = VERSION,
	url = "http://css-quad.ru"
};

public OnPluginStart()
{
	g_hThrowedObjects = CreateArray( 2 );

	drhax_enabled =					CreateConVar( "drhax_enabled", "1", "Enable the plugin?" );
	drhax_music_path =				CreateConVar( "drhax_music_path", SOUND, "Path to the sound." );
	drhax_monitor_weight =			CreateConVar( "drhax_monitor_weight", "1.0", "Default weight of monitor." );
	drhax_throwing_force =			CreateConVar( "drhax_throwing_force", "100.0" , "Force of throwing the monitor ( More = better )." );
	drhax_let_users_set_weight =		CreateConVar( "drhax_let_users_set_weight", "1", "Do you want to let users set monitor's weight?" );
	drhax_distance_from_spawner =	CreateConVar( "drhax_distance_from_spawner", "40.0", "Distance from object's creator to a spawned object." );
	drhax_only_admins =				CreateConVar( "drhax_only_admins", "1", "Only admins can throw monitors. Disable it at your own risk :)" );
	drhax_entity_destroy_delay =		CreateConVar( "drhax_entity_destroy_delay", "5", "Delay before entity will be destroyed by entity dissolver" );
	
	AutoExecConfig( );
	
	RegConsoleCmd( "sm_hax", CommandHandler );
}

public OnPluginEnd( )
{
	CloseHandle( g_hThrowedObjects );
}

public OnConfigsExecuted( )
{
	new String:szBuffer[ PLATFORM_MAX_PATH ];
	
	GetConVarString( drhax_music_path, szBuffer, sizeof( szBuffer ) );
	
	PrecacheModel( MODEL );
	PrecacheSound( szBuffer, true );
	
	Format( szBuffer, sizeof( szBuffer ), "sound/%s", szBuffer );
	
	AddFileToDownloadsTable( szBuffer );
}

public Action:CommandHandler( client, args )
{
	if( GetConVarBool( drhax_enabled ) )
	{
		new Float:fMonitorWeight;
		new Float:fDefMonitorWeight;
		
		fDefMonitorWeight = GetConVarFloat( drhax_monitor_weight );
	
		if( GetConVarBool( drhax_only_admins ) )
		{
			if( GetUserAdmin( client ) == INVALID_ADMIN_ID )
			{
				PrintToChat( client, "It works only for admins." );
				return Plugin_Handled;
			}
		}
		
		if( GetCmdArgs() == 1 && GetConVarBool( drhax_let_users_set_weight ) )
		{
			new String:szMonitorWeight[16];
			
			if( GetCmdArg( 1, szMonitorWeight, sizeof( szMonitorWeight ) ) )
			{
				if( ( fMonitorWeight = StringToFloat( szMonitorWeight ) ) == 0.0 )
				{
					fMonitorWeight = fDefMonitorWeight;
				}
			}
			else
			{
				fMonitorWeight = fDefMonitorWeight;
			}
		}
		else
		{
			fMonitorWeight = fDefMonitorWeight;
		}
	
		if( IsPlayerAlive( client ) )
		{
			new Float:fPlayerPos[3];
			new Float:fPlayerAngles[3];
			new Float:fThrowingVector[3];
			new Float:fDistanceFromSpawner;
			new Float:fThrowingForce;
			
			new String:szSoundPath[ PLATFORM_MAX_PATH ];
			new String:szMonitorWeight[ PLATFORM_MAX_PATH ];
			
			Format( szMonitorWeight, sizeof( szMonitorWeight ), "%f", fMonitorWeight );
			GetConVarString( drhax_music_path, szSoundPath, sizeof( szSoundPath ) );
			
			fDistanceFromSpawner = GetConVarFloat( drhax_distance_from_spawner );
			fThrowingForce = GetConVarFloat( drhax_throwing_force );
			
			GetClientEyeAngles( client, fPlayerAngles );
			GetClientEyePosition( client, fPlayerPos );
			
			TR_TraceRayFilter( fPlayerPos, fPlayerAngles, MASK_SOLID, RayType_Infinite, DontHitSelf, client );
			
			if( TR_DidHit( ) )
			{
				new Float:fEndPosition[3];
				
				TR_GetEndPosition( fEndPosition );
				
				if( GetVectorDistance( fPlayerPos, fEndPosition ) < fDistanceFromSpawner ) // if distance from player to a target is so long...
				{
					return Plugin_Handled; // return
				}
			}
			
			EmitAmbientSound( szSoundPath, fPlayerPos, _, _, _, 5.0 ); // HAAAAAAAAAAAAAAAX
			
			new Float:fLen = fDistanceFromSpawner * Sine( DegToRad( fPlayerAngles[0] + 90.0 ) );
			
			fPlayerPos[0] = fPlayerPos[0] + fLen * Cosine( DegToRad( fPlayerAngles[1] ) );
			fPlayerPos[1] = fPlayerPos[1] + fLen * Sine( DegToRad( fPlayerAngles[1] ) );
			fPlayerPos[2] = fPlayerPos[2] + fDistanceFromSpawner * Sine( DegToRad( -1 * fPlayerAngles[0] ) ) ;
			
			new entity = CreateEntityByName( "prop_physics" );
			
			DispatchKeyValue( entity, "model", MODEL );
			DispatchKeyValue( entity, "massScale", szMonitorWeight );
			
			DispatchSpawn( entity );
			ActivateEntity( entity );

			new Float:fScal = fThrowingForce * Sine( DegToRad( fPlayerAngles[0] + 90.0 ) );
			
			fThrowingVector[0] = fScal * Cosine( DegToRad( fPlayerAngles[1] ) );
			fThrowingVector[1] = fScal * Sine( DegToRad( fPlayerAngles[1] ) );
			fThrowingVector[2] = fThrowingForce * Sine( DegToRad( -1 * fPlayerAngles[0] ) );

			new iPair[2];
			
			iPair[0] = entity;
			iPair[1] = client;
			
			PushArrayArray( g_hThrowedObjects, iPair, sizeof( iPair ) );
			SDKHook( entity, SDKHook_ShouldCollide, ShouldCollide );
			
			TeleportEntity( entity, fPlayerPos, fPlayerAngles, fThrowingVector );
			
			CreateTimer( GetConVarFloat( drhax_entity_destroy_delay ), OnTimerTick, entity );
		}
	}
	
	return Plugin_Handled;
}

public bool:ShouldCollide( entity /*Object that collides with player*/, collisiongroup, contentsmask, bool:originalResult )
{
	if( contentsmask & MASK_PLAYERSOLID )
	{
		new Float:fMaxs[3];
		GetEntPropVector( entity, Prop_Send, "m_vecMaxs", fMaxs );
		
		new Float:fPos[3];
		GetEntPropVector( entity, Prop_Send, "m_vecOrigin", fPos );
		
		new Float:fDist;
		fDist = GetVectorLength( fMaxs ) * 1.5;
		
		for( new client = 1; client < MaxClients; client++ ) // Checking all players which is on a server
		{
			if( IsClientInGame( client ) && IsPlayerAlive( client ) )
			{
				new Float:fPlayerOrigin[3];
				new Float:fPlayerEyesPose[3];
				
				GetClientAbsOrigin( client, fPlayerOrigin );
				GetClientEyePosition( client, fPlayerEyesPose );
				
				for( new Float:i = 0.0; i < GetVectorDistance( fPlayerOrigin, fPlayerEyesPose ); i+=1.0 ) // Checking all the units from player's feet to player's eyes
				{
					new Float:fPointInPlayer[3];
					new bool:bPlayerKilled;
					
					fPointInPlayer[0] = fPlayerOrigin[0];
					fPointInPlayer[1] = fPlayerOrigin[1];
					fPointInPlayer[2] = fPlayerOrigin[2] + i;
					
					if( GetVectorDistance( fPointInPlayer, fPos ) <= fDist ) // If distance from body to a monitor is too short...
					{
						new iArrSize = GetArraySize( g_hThrowedObjects );
						
						if( iArrSize != 0 )
						{
							for( new count = 0; count < iArrSize; count++ )
							{
								new iPair[2];
								
								GetArrayArray( g_hThrowedObjects, count, iPair, sizeof( iPair ) );
								if( entity == iPair[0] ) // If entity that collieds with a monitor is not a monitor's owner...
								{
									if( client != iPair[1] && IsPlayerAlive( iPair[1] ) )
									{
										bPlayerKilled = true;
										ForcePlayerSuicide( client ); // Kill it.
										
										break;
									}
								}
							}
						}
					}
					
					if( bPlayerKilled )
					{
						bPlayerKilled = false;
					
						break;
					}
					
					bPlayerKilled = false;
				}
			}
		}
	}
	
	return true;
}

public bool:DontHitSelf( entity, mask, any:data )
{
	if( entity == data )
	{
		return false;
	}
	
	return true;
}

public Action:OnTimerTick( Handle:hTimer, any:data )
{
	new iArrSize = GetArraySize( g_hThrowedObjects );
	Dissolve( data );
	
	if( iArrSize != 0 )
	{
		for( new i = 0; i < iArrSize; i++ )
		{
			new iPair[2];
			GetArrayArray( g_hThrowedObjects, i, iPair, sizeof( iPair ) );
			
			if( iPair[0] == data )
			{
				iArrSize--;
				RemoveFromArray( g_hThrowedObjects, i-- );
			}
		}
	}
	
	return Plugin_Continue;
}

stock void:Dissolve(edict)
{
	if(IsValidEntity(edict))
	{
		new String:dname[32], ent = CreateEntityByName("env_entity_dissolver");
		
		Format(dname, sizeof(dname), "dis_%d", edict);
		  
		if (ent > 0)
		{
			DispatchKeyValue(edict, "targetname", dname);
			DispatchKeyValue(ent, "dissolvetype", "3");
			DispatchKeyValue(ent, "target", dname);
			AcceptEntityInput(ent, "Dissolve");
			AcceptEntityInput(ent, "kill");
		}
	}
}

Last edited by Yeah=}; 01-25-2012 at 05:33.
Yeah=} is offline
341464
Senior Member
Join Date: Dec 2010
Location: GetClientEyePosition
Old 01-25-2012 , 06:05   Re: Dr.Hax
Reply With Quote #20

It works now
But is it suppose to teamkill
__________________

Last edited by 341464; 01-25-2012 at 06:08.
341464 is offline
Send a message via Skype™ to 341464
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:33.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode