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

[TF2] Detecting Sniper's Razorback


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 11-21-2017 , 13:52   [TF2] Detecting Sniper's Razorback
Reply With Quote #1

In OnTakeDamage I ran a quick test to try and find the charge meter for the Razorback so I can detect when the sniper has it or not.

Note that even while the razorback is broken, tf_wearable_razorback still exists on the player.

Yep. This is the process for figuring out 75% of stuff in this game.

PHP Code:
stock bool:PlayerHasRazorback(iClient)
{
    if (
TF2_GetPlayerClass(iClient) != TFClass_Sniper)
    {
        return 
false;
    }
    
    new 
iEnt = -1;
    while ((
iEnt FindEntityByClassname(iEnt"tf_wearable_razorback")) != -1)
    {
        if (
GetEntPropEnt(iEntProp_Send"m_hOwnerEntity") == iClient && !GetEntProp(iEntProp_Send"m_bDisguiseWearable"))
        {
            return 
true;
        }
    }

    return 
false;
}

/*
   Member: m_flNextRageEarnTime (offset 660) (type float) (bits 0) (NoScale)
   Member: m_bInUpgradeZone (offset 636) (type integer) (bits 1) (Unsigned)
   Table: m_flItemChargeMeter (offset 716) (type m_flItemChargeMeter)
    Member: 000 (offset 0) (type float) (bits 0) (NoScale)
    Member: 001 (offset 4) (type float) (bits 0) (NoScale)
    Member: 002 (offset 8) (type float) (bits 0) (NoScale)
    Member: 003 (offset 12) (type float) (bits 0) (NoScale)
    Member: 004 (offset 16) (type float) (bits 0) (NoScale)
    Member: 005 (offset 20) (type float) (bits 0) (NoScale)
    Member: 006 (offset 24) (type float) (bits 0) (NoScale)
    Member: 007 (offset 28) (type float) (bits 0) (NoScale)
    Member: 008 (offset 32) (type float) (bits 0) (NoScale)
    Member: 009 (offset 36) (type float) (bits 0) (NoScale)
    Member: 010 (offset 40) (type float) (bits 0) (NoScale)
   Table: m_bPlayerDominated (offset 808) (type m_bPlayerDominated)
    Member: 000 (offset 0) (type integer) (bits 1) (Unsigned)
    Member: 001 (offset 1) (type integer) (bits 1) (Unsigned)
    Member: 002 (offset 2) (type integer) (bits 1) (Unsigned)
*/


            
if (PlayerHasRazorback(iVictim))
            {
                
CPrintToAdmins(Admin_RCON"----");
                for (new 
011i++)
                {
                    
CPrintToAdmins(Admin_RCON"%f"GetEntPropFloat(iVictimProp_Send"m_flItemChargeMeter"i));
                }
                
                
flDamage 1.0;
            } 
Output from backstabbing the victim a few times:

Code:
[SM] Reloaded plugin.
----
100.000000
100.000000
100.000000
0.000000
0.000000
0.000000
0.000000
0.000000
100.000000
0.000000
0.000000
----
100.000000
8.350013
100.000000
0.000000
0.000000
0.000000
0.000000
0.000000
100.000000
0.000000
0.000000
----
100.000000
16.450035
100.000000
0.000000
0.000000
0.000000
0.000000
0.000000
100.000000
0.000000
0.000000
Resulting stock:

PHP Code:
stock bool:PlayerRazorbackIsActive(iClient)
{
    return 
GetEntPropFloat(iVictimProp_Send"m_flItemChargeMeter"TFWeaponSlot_Secondary) >= 100.0

__________________

Last edited by Chdata; 11-21-2017 at 14:35.
Chdata 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 03:06.


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