Raised This Month: $248 Target: $400
 62% 

Solved [TF2] Spy Enforcer Weapon Attributes


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 07-02-2020 , 15:53   [TF2] Spy Enforcer Weapon Attributes
Reply With Quote #1

Is it possible to remove the attribute 'dmg pierces resists absorbs' (attribute 797) from the Spy weapon called 'The Enforcer' (weapon 460)? If so, how?

I've tried to do it a couple of different ways, but after each effort I spectate the client to view their weapon it still says "Attacks pierce damage resistance effects and bonuses". I'm wondering if the effect is removed but the text is hardcoded, or if I am just unable to remove it.

What I've tried so far that didn't work:

Method 1: Used tf2items.weapon.txt file
PHP Code:
"custom_weapons_v3"
{
    
"*"
    
{
        
"460"
        
{
            
"1"    "797 ; 0"
        
}
    }

Method 2: Wrote this plugin
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <tf2_stocks>
#include <tf2attributes>
 
#define PLUGIN_VERSION "1.0"
 
public Plugin:myinfo =
{
    
name "[TF2] Remove Enforcer Resistance Penetration",
    
author "PC Gamer",
    
description "Remove Enforcer Resistance Penetration",
    
version PLUGIN_VERSION,
    
url "www.sourcemod.net"
}
 
public 
void OnPluginStart()
{
    
HookEvent("post_inventory_application"EventInventoryApplication);    
}
 
public 
EventInventoryApplication(Handle:event, const String:name[], bool:dontBroadcast)
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));
    if (
IsValidClient(client) && TF2_GetPlayerClass(client) == TFClass_Spy)
    {
        
int myslot0 GetIndexOfWeaponSlot(client0);
        if(
myslot0 == 460)//Enforcer
        
{
            
PrintToChatAll("Debug: Found Spy named %N holding The Enforcer"client);    
            
int weapon GetPlayerWeaponSlot(client0);
            
TF2Attrib_SetByDefIndex(weapon7970.0);
            
PrintToChatAll("Debug: Removed Enforcer resistance piercing ability");
        }
    }
}

stock bool:IsValidClient(clientbool:nobots true)

    if (
client <= || client MaxClients)
    {
        return 
false
    }
    return 
IsClientInGame(client); 
}  

stock GetIndexOfWeaponSlot(iClientiSlot)
{
    return 
GetWeaponIndex(GetPlayerWeaponSlot(iClientiSlot));
}

stock GetClientCloakIndex(iClient)
{
    return 
GetWeaponIndex(GetPlayerWeaponSlot(iClientTFWeaponSlot_Watch));
}

stock GetWeaponIndex(iWeapon)
{
    return 
IsValidEnt(iWeapon) ? GetEntProp(iWeaponProp_Send"m_iItemDefinitionIndex"):-1;
}

stock GetActiveIndex(iClient)
{
    return 
GetWeaponIndex(GetEntPropEnt(iClientProp_Send"m_hActiveWeapon"));
}

stock bool:IsWeaponSlotActive(iClientiSlot)
{
    return 
GetPlayerWeaponSlot(iClientiSlot) == GetEntPropEnt(iClientProp_Send"m_hActiveWeapon");
}

stock bool:IsIndexActive(iClientiIndex)
{
    return 
iIndex == GetWeaponIndex(GetEntPropEnt(iClientProp_Send"m_hActiveWeapon"));
}

stock bool:IsSlotIndex(iClientiSlotiIndex)
{
    return 
iIndex == GetIndexOfWeaponSlot(iClientiSlot);
}

stock bool:IsValidEnt(iEnt)
{
    return 
iEnt MaxClients && IsValidEntity(iEnt);
}

stock GetSlotFromPlayerWeapon(iClientiWeapon)
{
    for (new 
0<= 5i++)
    {
        if (
iWeapon == GetPlayerWeaponSlot(iClienti))
        {
            return 
i;
        }
    }
    return -
1;

Neither one prevented the text of "Attacks pierce damage resistance effects and bonuses" from being displayed when the weapon is inspected by another player.

Any assistance would be appreciated.

Last edited by PC Gamer; 07-29-2020 at 21:30.
PC Gamer is offline
 


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 10:24.


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