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

Solved [TF2][HELP] How to detect market garden


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
J0BL3SS
Senior Member
Join Date: Sep 2020
Location: Turkey/Istanbul
Old 04-01-2021 , 05:29   [TF2][HELP] How to detect market garden
Reply With Quote #1

Im trying to detect market garden via SDKHooks. The code I made works in a sketchy way, sometimes it can detect it, but sometimes even if it does not detect it at all, but its still counts a market garden.

Code:
public Action Hook_OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &weapon, float damageForce[3], float damagePosition[3], int damagecustom)
{
    if(IsValidClient(victim) && IsValidClient(attacker) && victim != attacker)
    {
    	
	if(GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex") == 416)
	{
		if(TF2_IsPlayerInCondition(attacker, TFCond_BlastJumping))
		{
			// its a market garden, do things
		}
		else if(damagetype & DMG_CRIT || damagetype == DMG_CRIT)
		{
			// its a market garden, do things
		}
	}
    }
    return Plugin_Continue;
}
__________________
My Steam Profile
My Discord Name: J0BL3SS#5320 | j0bl3ss

I don't really look at steam or alliedmodders, contact me from discord if you need it.

Last edited by J0BL3SS; 05-02-2021 at 04:09. Reason: solved
J0BL3SS is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 04-03-2021 , 03:10   Re: [TF2][HELP] How to detect market garden
Reply With Quote #2

You'll need to provide more information on what you are trying to accomplish.

When do you want to check for the Market Garden? When it is equipped? When it is the active weapon? When it does damage? When somebody dies?

If the player has a Market Garden, then what?

The code you provided only detects when a player actively using the Market Garden does damage while rocket jumping OR when the player does critical damage with the Market Garden.
PC Gamer is offline
StrikeR14
AlliedModders Donor
Join Date: Apr 2016
Location: Behind my PC
Old 04-04-2021 , 15:59   Re: [TF2][HELP] How to detect market garden
Reply With Quote #3

I'd use:

PHP Code:
bool InMarketAir[MAXPLAYERS+1];

public 
void OnPluginStart()
{
      
HookEvent("rocket_jump"RocketJumpedEventHookMode_Pre);
      
HookEvent("rocket_jump_landed"RocketJumpLandedEventHookMode_Post);
}

...

public 
Action RocketJumped(Handle event, const char[] namebool dontBroadcast)
{
    
InMarketAir[GetClientOfUserId(GetEventInt(event"userid"))] = true;
    return 
Plugin_Continue;
}

public 
Action RocketJumpLanded(Handle event, const char[] namebool dontBroadcast)
{
    
InMarketAir[GetClientOfUserId(GetEventInt(event"userid"))] = false;
    return 
Plugin_Continue;


On your SDK TakeDamage event, use if (InMarketAir[attacker]) with your m_iItemDefinitionIndex checks.
__________________
Currently taking TF2/CSGO paid private requests!

My Plugins | My Discord Account

Last edited by StrikeR14; 04-04-2021 at 16:00.
StrikeR14 is offline
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 04-04-2021 , 18:38   Re: [TF2][HELP] How to detect market garden
Reply With Quote #4

Quote:
Originally Posted by StrikeR14 View Post
I'd use:

PHP Code:
bool InMarketAir[MAXPLAYERS+1];

public 
void OnPluginStart()
{
      
HookEvent("rocket_jump"RocketJumpedEventHookMode_Pre);
      
HookEvent("rocket_jump_landed"RocketJumpLandedEventHookMode_Post);
}

...

public 
Action RocketJumped(Handle event, const char[] namebool dontBroadcast)
{
    
InMarketAir[GetClientOfUserId(GetEventInt(event"userid"))] = true;
    return 
Plugin_Continue;
}

public 
Action RocketJumpLanded(Handle event, const char[] namebool dontBroadcast)
{
    
InMarketAir[GetClientOfUserId(GetEventInt(event"userid"))] = false;
    return 
Plugin_Continue;


On your SDK TakeDamage event, use if (InMarketAir[attacker]) with your m_iItemDefinitionIndex checks.
Not saying it won’t work, however, they already attempted to check if they were in the condition that is applied while rocket jumping.
ThatKidWhoGames is offline
StrikeR14
AlliedModders Donor
Join Date: Apr 2016
Location: Behind my PC
Old 04-05-2021 , 17:26   Re: [TF2][HELP] How to detect market garden
Reply With Quote #5

Quote:
Originally Posted by ThatKidWhoGames View Post
Not saying it won’t work, however, they already attempted to check if they were in the condition that is applied while rocket jumping.
True, but I've been using this snippet for a couple of years without any of the troubles the author stated.
__________________
Currently taking TF2/CSGO paid private requests!

My Plugins | My Discord Account
StrikeR14 is offline
J0BL3SS
Senior Member
Join Date: Sep 2020
Location: Turkey/Istanbul
Old 05-02-2021 , 04:10   Re: [TF2][HELP] How to detect market garden
Reply With Quote #6

Quote:
Originally Posted by StrikeR14 View Post
I'd use:

PHP Code:
bool InMarketAir[MAXPLAYERS+1];

public 
void OnPluginStart()
{
      
HookEvent("rocket_jump"RocketJumpedEventHookMode_Pre);
      
HookEvent("rocket_jump_landed"RocketJumpLandedEventHookMode_Post);
}

...

public 
Action RocketJumped(Handle event, const char[] namebool dontBroadcast)
{
    
InMarketAir[GetClientOfUserId(GetEventInt(event"userid"))] = true;
    return 
Plugin_Continue;
}

public 
Action RocketJumpLanded(Handle event, const char[] namebool dontBroadcast)
{
    
InMarketAir[GetClientOfUserId(GetEventInt(event"userid"))] = false;
    return 
Plugin_Continue;


On your SDK TakeDamage event, use if (InMarketAir[attacker]) with your m_iItemDefinitionIndex checks.
Used this to detect rocket jump, thanks it works very accurate now
__________________
My Steam Profile
My Discord Name: J0BL3SS#5320 | j0bl3ss

I don't really look at steam or alliedmodders, contact me from discord if you need it.
J0BL3SS is offline
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 05:17.


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