Raised This Month: $ Target: $400
 0% 

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


Post New Thread Reply   
 
Thread Tools Display Modes
arthurdead
Senior Member
Join Date: Jul 2013
Old 07-21-2014 , 11:23   Re: [SNIPPET][TF2] Detecting if player is being healed by a dispenser
Reply With Quote #21

hook player_builtobject/player_upgradedobject/player_carryobject/player_dropobject kill his dispenser build a new rd_robot_dispenser setentitymodel set some netprops
arthurdead is offline
barel31
Member
Join Date: Mar 2011
Old 07-28-2014 , 18:17   Re: [SNIPPET][TF2] Detecting if player is being healed by a dispenser
Reply With Quote #22

Quote:
Originally Posted by arthurdead View Post
hook player_builtobject/player_upgradedobject/player_carryobject/player_dropobject kill his dispenser build a new rd_robot_dispenser setentitymodel set some netprops
Where I can find the netprops list?

Last edited by barel31; 07-28-2014 at 18:17.
barel31 is offline
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 07-30-2014 , 03:00   Re: [SNIPPET][TF2] Detecting if player is being healed by a dispenser
Reply With Quote #23

Drain cloak from spies if cloaked near dispenser.

PHP Code:
public OnPreThinkPost(client)
{    
    if (
IsNearSpencer(client) && TF2_IsPlayerInCondition(clientTFCond_Cloaked))
    {
        new 
Float:cloak GetEntPropFloat(clientProp_Send"m_flCloakMeter") - 0.5// 0.0 - 100.0 cloak

        
if (cloak 0.0)
        {
            
cloak 0.0;
        }

        
SetEntPropFloat(clientProp_Send"m_flCloakMeter"cloak);

        if (
RoundFloat(GetGameTime()) == GetGameTime())
        {
            
CPrintToChat("%N DISPENSEDEBUG %f"clientGetGameTime());
        } 
    }

I'm using this in my VSH now ;p
__________________

Last edited by Chdata; 07-30-2014 at 03:01.
Chdata is offline
MasterOfTheXP
Veteran Member
Join Date: Aug 2011
Location: Cloudbank
Old 08-03-2014 , 11:44   Re: [SNIPPET][TF2] Detecting if player is being healed by a dispenser
Reply With Quote #24

Quote:
Originally Posted by barel31 View Post
Where I can find the netprops list?
In server console, sm_dump_netprops netprops.txt, and sm_dump_datamaps datamaps.txt. You'll probably have to restart your server after using these, or else clients will crash.
__________________
Plugins / My Steam / TF2 Sandbox (plugin beta testing!)
MasterOfTheXP is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 08-07-2014 , 11:07   Re: [SNIPPET][TF2] Detecting if player is being healed by a dispenser
Reply With Quote #25

Ok, looking through the vtable list for CObjectDispenser, these 2 functions sound very useful:
PHP Code:
CObjectDispenser::StartHealing(CBaseEntity *) 
and
PHP Code:
CObjectDispenser::DispenseAmmo(CTFPlayer *) 
__________________
WildCard65 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 08-07-2014 , 11:08   Re: [SNIPPET][TF2] Detecting if player is being healed by a dispenser
Reply With Quote #26

Quote:
Originally Posted by WildCard65 View Post
Ok, looking through the vtable list for CObjectDispenser, these 2 functions sound very useful:
PHP Code:
CObjectDispenser::StartHealing(CBaseEntity *) 
and
PHP Code:
CObjectDispenser::DispenseAmmo(CTFPlayer *) 
Of course, you'd need DHooks or an extension to actually hook/block those.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
nergal
Veteran Member
Join Date: Apr 2012
Old 08-07-2014 , 13:22   Re: [SNIPPET][TF2] Detecting if player is being healed by a dispenser
Reply With Quote #27

Quote:
Originally Posted by Powerlord View Post
Of course, you'd need DHooks or an extension to actually hook/block those.
How to use DHooks? I haven't gotten that advanced yet. I actually haven't even gotten as far as KeyValues.
__________________
nergal is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 08-07-2014 , 16:21   Re: [SNIPPET][TF2] Detecting if player is being healed by a dispenser
Reply With Quote #28

Quote:
Originally Posted by nergal View Post
How to use DHooks? I haven't gotten that advanced yet. I actually haven't even gotten as far as KeyValues.
Unfortunately, DHooks assumes you already have experience writing SDKCalls since the two have a very similar way of being declaring.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 08-07-2014 at 16:21.
Powerlord is offline
katiebell26
New Member
Join Date: Sep 2014
Old 09-18-2014 , 05:02   Re: [SNIPPET][TF2] Detecting if player is being healed by a dispenser
Reply With Quote #29

That's great! I have also tried using "healing_array_element" and its quite working well!
__________________
katiebell26 is offline
nergal
Veteran Member
Join Date: Apr 2012
Old 10-13-2016 , 18:21   Re: [SNIPPET][TF2] Detecting if player is being healed by a dispenser
Reply With Quote #30

improved code with less instructions

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; 10-13-2016 at 18:22.
nergal 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 22:34.


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