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(iEnt, Prop_Send, "m_hOwnerEntity") == iClient && !GetEntProp(iEnt, Prop_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 i = 0; i < 11; i++)
{
CPrintToAdmins(Admin_RCON, "%f", GetEntPropFloat(iVictim, Prop_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(iVictim, Prop_Send, "m_flItemChargeMeter", TFWeaponSlot_Secondary) >= 100.0;
}
__________________