Raised This Month: $51 Target: $400
 12% 

m_ArmorValue difficulty (CSS)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
XARIUS
SourceMod Donor
Join Date: May 2008
Location: Atlanta, GA
Old 10-09-2008 , 14:47   m_ArmorValue difficulty (CSS)
Reply With Quote #1

I'm having problems setting m_ArmorValue. I'm not getting any errors, and I've tried two different approaches.

Code:
  g_Armor = FindSendPropOffs("CCSPlayer", "m_ArmorValue");
  if (g_Armor == -1)
  {
    SetFailState("[Headshot Only] Error - Unable to get offset for CSSPlayer::m_ArmorValue");
  }

public Action:EventPlayerHurt(Handle:event, const String:name[],bool:dontBroadcast)
{
  if (g_enabled)
  {
    new hitgroup = GetEventInt(event, "hitgroup");
    new victim = GetClientOfUserId(GetEventInt(event, "userid"));
    new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
    new dhealth = GetEventInt(event, "dmg_health");
    new darmor = GetEventInt(event, "dmg_armor");
    new health = GetEventInt(event, "health");
    new armor = GetEventInt(event, "armor");
    if (hitgroup == 1)
    {
      EmitSoundToClient(attacker, g_sound);
      return Plugin_Continue;
    }
    else
    {
      PrintToChat(victim, "Damage Taken: %i / %i", dhealth, darmor);
      SetEntData(victim, g_iHealth, (health + dhealth), 4, true);
//      SetEntData(victim, g_armor, (armor + darmor), 4, true);
      SetEntProp(victim, Prop_Send, "m_ArmorValue", 150, 4);
      return Plugin_Handled;
    }
  }
  return Plugin_Continue;
}
Setting the health back to whatever it was prior to the damage taken works no problem at all. However, when I try the same methodology to set the armor, I get nothing. No errors, either.

SentEntData and SetEntProp give the same results. Am I trying to set this improperly?

EDIT: I'm going through all this because I've not been able to find a way to block damage from occuring. If thats a wildly inaccurate assumption, please correct me!

Thanks,

X
__________________

Last edited by XARIUS; 10-09-2008 at 15:08.
XARIUS is offline
XARIUS
SourceMod Donor
Join Date: May 2008
Location: Atlanta, GA
Old 10-09-2008 , 15:39   Re: m_ArmorValue difficulty (CSS)
Reply With Quote #2

Okay so apparently it is working.. Sorta. There must be some odd logic in the armor system. When the hitgroup is NOT the head, even though I'm attempting to reverse the armor damage, it still decreases by 1 armor point per body shot. If I try and be silly and add that single hitpoint back in, you wind up with 101, instead of 99! lol

When reading m_ArmorValue, are there two pieces of armor that the total is derived from? Body armor + helmet? Maybe that's what has me confused..
__________________

Last edited by XARIUS; 10-09-2008 at 18:43.
XARIUS is offline
XARIUS
SourceMod Donor
Join Date: May 2008
Location: Atlanta, GA
Old 10-09-2008 , 19:11   Re: m_ArmorValue difficulty (CSS)
Reply With Quote #3

Well, I'm still stumped on this one. If anyone's got experience with setting armor, I'd love to hear it!

Basically, whenever I take the events armor and dmg_armor (from player_hurt), and attempt to add dmg_armor to armor (which should be exact), I wind up with one less total.

Example: armor = 74 - dmg_armor = 26. dmg_armor + armor = 99. I know, it's odd. I'm only calling this when the hitgroup is NOT 1, by the way. Is there some sort of odd splash damage occuring to the helmet, or a single point of damage occuring in hitgroup 1??
__________________
XARIUS is offline
XARIUS
SourceMod Donor
Join Date: May 2008
Location: Atlanta, GA
Old 10-10-2008 , 08:26   Re: m_ArmorValue difficulty (CSS)
Reply With Quote #4

Alrighty, there's picky, and then there's anal retentive. I'm gonna give up on this one. lol Oh well!

Armor Damaged: 5 | Armor Remaining: 94 (should be 95)
Armor Damaged: 7 | Armor Remaining: 86 (should be 87)
Armor Damaged: 7 | Armor Remaining: 78 (should be 79)
Armor Damaged: 25 | Armor Remaining: 52 (should be 53)
Armor Damaged: 6 | Armor Remaining: 45 (should be 46)

If anyone else stumbles across this. You're not crazy. It's just odd.
__________________
XARIUS is offline
Lebson506th
Veteran Member
Join Date: Jul 2008
Old 10-10-2008 , 10:03   Re: m_ArmorValue difficulty (CSS)
Reply With Quote #5

...or it totals to 99 instead of 100

What happens when you damage the armor 100?
__________________
My Plugins
Spray Tracer by Nican, maintained by me
Simple TK Manager
DoD:S Admin Weapons

Links
Resistance and Liberation (A HL2 Multiplayer Modification)
Lebson506th is offline
XARIUS
SourceMod Donor
Join Date: May 2008
Location: Atlanta, GA
Old 10-10-2008 , 10:40   Re: m_ArmorValue difficulty (CSS)
Reply With Quote #6

Dunno, never tried. GetClientArmor returns 100 though. It's all good. Very minor thing to complain about. I just hate silly stuff like that!
__________________
XARIUS 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 04:53.


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