AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [SNIPPET][TF2] Detecting if player is being healed by a dispenser (https://forums.alliedmods.net/showthread.php?t=238925)

nergal 04-18-2014 17:21

[SNIPPET][TF2] Detecting if player is being healed by a dispenser
 
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);



Mitchell 04-22-2014 11:44

Re: [SNIPPET][TF2] Detecting if player is being healed by a dispenser
 
You can supposedly get the targets the dispenser is healing by using the array netprop: "healing_array_element" and GetEntDataArray

WildCard65 04-22-2014 11:48

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

Originally Posted by Mitchell (Post 2128003)
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.

nergal 04-22-2014 18:23

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

Originally Posted by Mitchell (Post 2128003)
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.

Mitchell 04-22-2014 18:27

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

Originally Posted by nergal (Post 2128162)
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])
        }


Bacardi 04-23-2014 04:43

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

Originally Posted by Mitchell (Post 2128165)
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...

Mitchell 04-23-2014 10:09

Re: [SNIPPET][TF2] Detecting if player is being healed by a dispenser
 
didnt know 'dispenser_touch_trigger' was an entity..
also you should check for disguised spies :p

Bacardi 04-23-2014 10:45

Re: [SNIPPET][TF2] Detecting if player is being healed by a dispenser
 
I assume, team check is enough. Haven't seen enemy dispenser healing spies :/

Mitchell 04-23-2014 11:13

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

Originally Posted by Bacardi (Post 2128387)
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.

WildCard65 04-23-2014 11:43

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

Originally Posted by Bacardi (Post 2128387)
I assume, team check is enough. Haven't seen enemy dispenser healing spies :/

Wow Bacardi, me surprised you don't know Tf2 Logic :shock:
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.


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

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