Raised This Month: $51 Target: $400
 12% 

TF2 Midair (again)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
apy
Junior Member
Join Date: Oct 2008
Old 11-10-2008 , 21:02   TF2 Midair (again)
Reply With Quote #1

Awhile ago I posted a thread asking for help in creating a midair mod. I got very helpful responses and was able to create a semi-functional script thanks to the help of the replies.

After messing around with the script for a while, I began to see an important issue. If the player being shot at is any distance from the ground, even only 1cm, the player will still be instagibbed. What I need to do is create a minimum height for the rocket to do damage but I don't know how.

This script is very messy and poorly written because it is my first pawn script and I have no prior experience in any similar languages. Most of it is copied from scripts posted on this forum so thank you to the original authors. It also relies on the edited soldier ctx file which makes rockets do 250 damage, among other things.

Also, if there is any way to increase the force of rockets other then the secret console commands that would be great. Currently, the force seems to be maxed out via the console commands and I am just wondering if I could increase the force via other means.

Code:
#include <sourcemod>
#include <dukehacks>

#define PLUGIN_VERSION "6.1"

public Plugin:myinfo = 
{
	name = "midair",
	author = "matt",
	description = "air shots only",
	version = PLUGIN_VERSION,
	url = ""
}

new Handle:cvDmgMult = INVALID_HANDLE;

// Hook events
public OnPluginStart()
{
	dhAddClientHook(HK_TraceAttack, TraceAttackHook);
	HookEvent("player_hurt", Event_PlayerHurt);
}



// Air shot damage ONLY
public Action:TraceAttackHook(client, attacker, inflictor, Float:damage, &Float:multiplier)
{

new entvalue
new m_Offset
m_Offset=FindSendPropOffs("CTFPlayer","m_hGroundEntity")
//client = GetClientOfUserId(GetEventInt(event,"userid"))
entvalue=GetEntData(client,m_Offset,4)


if(entvalue > -1.000000009)
{
	multiplier *= 0.001;
	return Plugin_Changed;
}

else
{
	multiplier *= 4.0;
	return Plugin_Changed;
}
}


// Remove fall damage
public Event_PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast) 
{
		new victim = GetClientOfUserId(GetEventInt(event,"userid"));
		new attacker = GetClientOfUserId(GetEventInt(event,"attacker"));

			if(victim > 0 && IsClientInGame(victim) & FL_ONGROUND) 
			{
				new victimLost = GetEventInt(event,"damage");
				new victimHealth = GetEventInt(event,"health") + victimLost;
				new shealth = 200 - victimLost

				if(IsClientInGame(victim) && IsPlayerAlive(victim) && (GetEntityFlags(victim) & FL_ONGROUND)) 
			{
					SetEntityHealth(victim, 200);
				
		}
		}

}

Last edited by apy; 11-10-2008 at 21:07.
apy is offline
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 11-11-2008 , 07:46   Re: TF2 Midair (again)
Reply With Quote #2

You can check a player's height by tracing a ray straight down and seeing where it hits to get a height. It'd work for most cases, I'd guess. Look at TR_TraceRayEx or TR_TraceRayFilterEx.
Fyren is offline
CrimsonGT
Veteran Member
Join Date: Oct 2007
Location: Gainesville, FL
Old 11-11-2008 , 11:04   Re: TF2 Midair (again)
Reply With Quote #3

Yup, use a traceray and check the length of the ray and then do something if its less or greater than that amount.
CrimsonGT is offline
[AiF] Biggs
Member
Join Date: Jan 2008
Location: Statesboro, GA
Old 02-10-2009 , 14:20   Re: TF2 Midair (again)
Reply With Quote #4

How is this plugin coming along? Are you planning on releasing it to the public?

I've found a midair mod server and it's really fun, but it's based in Milano, Italy which makes it extremely difficult to play on count of my 150+ ping.
I'm not looking to start up a midair mod server or anything, but rather having the mod on our vanilla tf2 server for those late nights when we don't have enough people on for a regular game.
__________________
[AiF] Biggs is offline
Reply



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 15:40.


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