Tf2 Modders In There ?

Discussion in 'Source' started by LeBabouin, Nov 16, 2014.

  1. LeBabouin Papio anubis

    Contributions:
    510
    Specialties:
    Scripting
    Processing:
    Graphics:
    PREMIUM
    I Donated
    Code:
    static const String:g_strWeapons[][]={"sword", "axtinguisher", "fireaxe", "battleaxe", "headtaker"};
     
     
    public OnClientPutInServer(client)
    {
        SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
    }
     
    public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
    {
        new TFClassType:class = TF2_GetPlayerClass(victim);
         
        if (class == TFClass_DemoMan || class == TFClass_Pyro || class == TFClass_Heavy){
             
              decl String:sWeapon[32];
     
              GetEdictClassname(inflictor, sWeapon, sizeof(sWeapon));   // <-- i want name instead of classname
             
              for (new iLoop = 0; iLoop < sizeof(g_strWeapons); iLoop++)
              {
                  if (StrEqual(sWeapon, g_strWeapons[iLoop], false)) 
                  {
                        damagetype |= DMG_REMOVENORAGDOLL;
                        return Plugin_Changed;
                  }
              }   
        }
        return Plugin_Continue;
    } 
    
    How would you get the weapon name the victim has been hurt with from the OnTakeDamage event ? TF2 documentation is enormous but not always useful. I want to prevent gibs from spawning at player death when i have set tf_playersgib 2 in config when peeps get sliced with cutting weapons. Is there some equivalent to GetEdictClassname but for name only?

Share This Page