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

[SNIPPET][TF2] Detecting if player is being healed by a dispenser


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nergal
Veteran Member
Join Date: Apr 2012
Old 04-18-2014 , 17:21   [SNIPPET][TF2] Detecting if player is being healed by a dispenser
Reply With Quote #1

PHP Code:
stock int GetHealingTarget(const int client)
{
    
int medigun GetPlayerWeaponSlot(clientTFWeaponSlot_Secondary);
    if (!
IsValidEdict(medigun) or !IsValidEntity(medigun))
        return -
1;

    
char s[32]; GetEdictClassname(medigunssizeof(s));
    if ( !
strcmp(s"tf_weapon_medigun"false) ) {
        if ( 
GetEntProp(medigunProp_Send"m_bHealing") )
            return 
GetEntPropEntmedigunProp_Send"m_hHealingTarget" );
    }
    return -
1;
}
stock bool IsNearSpencer(const int client)
{
    
int medics 0;
    for ( 
int i=MaxClients ; --) {
        if (!
IsClientInGame(i))
            continue;
        if ( 
GetHealingTarget(i) == client )
            
medics++;
    }
    return (
GetEntProp(clientProp_Send"m_nNumHealers") > medics);

__________________

Last edited by nergal; 12-13-2016 at 02:46.
nergal is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 04-22-2014 , 11:44   Re: [SNIPPET][TF2] Detecting if player is being healed by a dispenser
Reply With Quote #2

You can supposedly get the targets the dispenser is healing by using the array netprop: "healing_array_element" and GetEntDataArray

Last edited by Mitchell; 04-22-2014 at 12:17.
Mitchell is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 04-22-2014 , 11:48   Re: [SNIPPET][TF2] Detecting if player is being healed by a dispenser
Reply With Quote #3

Quote:
Originally Posted by Mitchell View Post
You can supposebly get the targets the dispenser is healing by using the array netprop: "healing_array_element" and GetEntDataArray
I was about to say that but in a different wording.
WildCard65 is offline
nergal
Veteran Member
Join Date: Apr 2012
Old 04-22-2014 , 18:23   Re: [SNIPPET][TF2] Detecting if player is being healed by a dispenser
Reply With Quote #4

Quote:
Originally Posted by Mitchell View Post
You can supposedly get the targets the dispenser is healing by using the array netprop: "healing_array_element" and GetEntDataArray
I do not know how to use that though.

Compared to something that I do not know how to use.

The above code is extremely more easier.
__________________

Last edited by nergal; 04-22-2014 at 18:23.
nergal is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 04-22-2014 , 18:27   Re: [SNIPPET][TF2] Detecting if player is being healed by a dispenser
Reply With Quote #5

Quote:
Originally Posted by nergal View Post
I do not know how to use that though.

Compared to something that I do not know how to use.

The above code is extremely more easier.
it's just an array.. you can loop through it.
Code:
	new m_Offset = FindSendPropOffs("CObjectDispenser", "healing_array_element")
	new ArrayValue[64]

	GetEntDataArray( DISPENSERENTITY, m_Offset, ArrayValue, 64, 1)
	for (new i=0; i <= 63; i++)
	{
		PrintToServer("Array %i Value: %i", i, ArrayValue[i])
	}

Last edited by Mitchell; 04-22-2014 at 18:31.
Mitchell is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-23-2014 , 04:43   Re: [SNIPPET][TF2] Detecting if player is being healed by a dispenser
Reply With Quote #6

Quote:
Originally Posted by Mitchell View Post
it's just an array.. you can loop through it.
Code:
	new m_Offset = FindSendPropOffs("CObjectDispenser", "healing_array_element")
	new ArrayValue[64]

	GetEntDataArray( DISPENSERENTITY, m_Offset, ArrayValue, 64, 1)
	for (new i=0; i <= 63; i++)
	{
		PrintToServer("Array %i Value: %i", i, ArrayValue[i])
	}
...but
netprops
Code:
 Member: healing_array_element (offset 0) (type integer) (bits 21)
 Member: "healing_array" (offset 0) (type array) (bits 0)
error
Code:
L 04/23/2014 - 11:30:24: [SM]   [0]  Line 672, E:\srcds\team fortress 2\tf\addon
s\sourcemod\scripting\include\entity.inc::GetEntDataArray()
L 04/23/2014 - 11:30:24: [SM]   [1]  Line 16, test.sp::test()
Bacardi: !test
L 04/23/2014 - 11:31:17: [SM] Native "GetEntData" reported: Offset 0 is invalid
L 04/23/2014 - 11:31:17: [SM] Displaying call stack trace for plugin "test\test.
smx":
*edit
*seems those entity outputs not in work
and there is also "m_hTouchingEntities", but not store anything.


here lousy
example...

Last edited by Bacardi; 04-23-2014 at 08:27.
Bacardi is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 04-23-2014 , 10:09   Re: [SNIPPET][TF2] Detecting if player is being healed by a dispenser
Reply With Quote #7

didnt know 'dispenser_touch_trigger' was an entity..
also you should check for disguised spies :p
Mitchell is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-23-2014 , 10:45   Re: [SNIPPET][TF2] Detecting if player is being healed by a dispenser
Reply With Quote #8

I assume, team check is enough. Haven't seen enemy dispenser healing spies :/
Bacardi is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 04-23-2014 , 11:13   Re: [SNIPPET][TF2] Detecting if player is being healed by a dispenser
Reply With Quote #9

Quote:
Originally Posted by Bacardi View Post
I assume, team check is enough. Haven't seen enemy dispenser healing spies :/
The dispensers will heal a player if they are on the other team disguised as the dispenser team.
The best part is when people troll and a medic uber charges the enemy spy so he can disable the sentries.
Mitchell is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 04-23-2014 , 11:43   Re: [SNIPPET][TF2] Detecting if player is being healed by a dispenser
Reply With Quote #10

Quote:
Originally Posted by Bacardi View Post
I assume, team check is enough. Haven't seen enemy dispenser healing spies :/
Wow Bacardi, me surprised you don't know Tf2 Logic
Here's a rundown of spy logic:
A blue spy walks onto a red teleport undisguised, red teleport allows undisguised blue spy to use it. <--Test this out on ff2 with a hale that is the spy class but can't disguise(ninja spy) and have someone on red setup a teleporter, then as ninja spy stand on entrance.
Another blue spy but disguised walks onto same teleporter and also gets teleported.
Now, first blue spy to use the red teleporter gets teleported beside a red dispenser, red dispenser is like, "Nope, no heals for you." and the red sentry nearby kills the blue spy.
2nd blue disguised spy lands in same spot and red dispenser is like, "Oh hey, your part of my team, here's a heal plus I'll replenish your ammo." and red sentry goes, "No enemy here."
Disguised blue spy walks off the ledge the nest is on and takes alot of fall damage and calls for a medic, a red medic comes by and heals the blue spy(while blue spy is disguised) and gets an uber ready, blue spy + medic take the teleporter to nest and red medic stupidly ubers the disguised blue spy and wonders why the person he's ubering is sapping the red engi's sentry nest.
And that's the quick walkthrough of tf2 spy logic.

Last edited by WildCard65; 04-23-2014 at 11:43.
WildCard65 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:24.


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