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

[TF2] Getting Wave Acquired Credits


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DragonMarcus
New Member
Join Date: Aug 2012
Old 08-19-2012 , 22:52   [TF2] Getting Wave Acquired Credits
Reply With Quote #1

I tried
PHP Code:
FindSendPropInfo("CMannVsMachineStats""m_vecWaveStats"); 
but it returns 0
PHP Code:
FindEntityByClassname(-1"CMannVsMachineStats"); 
but it returns -1
Anyone knows what's wrong with these code?

Summarized netprop
PHP Code:
<serverclass name="CMannVsMachineStats">
 <
sendtable name="DT_MannVsMachineStats">
  <
property name="m_vecWaveStats">
   <
type>datatable</type>
   <
offset>0</offset>
   <
bits>0</bits>
    <
sendtable name="_ST_m_vecWaveStats_16">
     <
property name="000">
      <
type>datatable</type>
      <
offset>0</offset>
      <
bits>0</bits>
       <
sendtable name="DT_CMannVsMachineWaveStats">
        <
property name="nCreditsAcquired">
         <
type>integer</type>
         <
offset>16</offset>
         <
bits>16</bits>
        </
property>
       </
sendtable>
     </
property>
     <
property name="001">
      <
type>datatable</type>
      <
offset>0</offset>
      <
bits>0</bits>
       <
sendtable name="DT_CMannVsMachineWaveStats">
        <
property name="nCreditsAcquired">
         <
type>integer</type>
         <
offset>16</offset>
         <
bits>16</bits>
        </
property>
       </
sendtable>
     </
property>
     <
property name="002">
      <
type>datatable</type>
      <
offset>0</offset>
      <
bits>0</bits>
       <
sendtable name="DT_CMannVsMachineWaveStats">
        <
property name="nCreditsAcquired">
         <
type>integer</type>
         <
offset>16</offset>
         <
bits>16</bits>
        </
property>
       </
sendtable>
     </
property>
     <
property name="003">
      <
type>datatable</type>
      <
offset>0</offset>
      <
bits>0</bits>
       <
sendtable name="DT_CMannVsMachineWaveStats">
        <
property name="nCreditsAcquired">
         <
type>integer</type>
         <
offset>16</offset>
         <
bits>16</bits>
        </
property>
       </
sendtable>
     </
property>
     <
property name="004">
      <
type>datatable</type>
      <
offset>0</offset>
      <
bits>0</bits>
       <
sendtable name="DT_CMannVsMachineWaveStats">
        <
property name="nCreditsAcquired">
         <
type>integer</type>
         <
offset>16</offset>
         <
bits>16</bits>
        </
property>
       </
sendtable>
     </
property>
     <
property name="005">
      <
type>datatable</type>
      <
offset>0</offset>
      <
bits>0</bits>
       <
sendtable name="DT_CMannVsMachineWaveStats">
        <
property name="nCreditsAcquired">
         <
type>integer</type>
         <
offset>16</offset>
         <
bits>16</bits>
        </
property>
       </
sendtable>
     </
property>
    </
sendtable>
  </
property>
 </
sendtable>
</
serverclass
DragonMarcus is offline
wgooch
Member
Join Date: Dec 2008
Old 08-21-2012 , 13:09   Re: [TF2] Getting Wave Acquired Credits
Reply With Quote #2

PHP Code:
new ent FindEntityByClassname(-1"tf_mann_vs_machine_stats");
if( 
IsValidEntity(ent) )
{
    new 
offs FindSendPropInfo("CMannVsMachineStats""nCreditsDropped");
    
PrintToServer("%d"offs);

This returned 12, so it seems likely that 0 is indeed the right offset location, however you should be searching for tf_mann_vs_machine_stats when finding the actual entity.

Last edited by wgooch; 08-21-2012 at 13:10.
wgooch is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 08-21-2012 , 13:21   Re: [TF2] Getting Wave Acquired Credits
Reply With Quote #3

Quote:
Originally Posted by wgooch View Post
PHP Code:
new ent FindEntityByClassname(-1"tf_mann_vs_machine_stats");
if( 
IsValidEntity(ent) )
{
    new 
offs FindSendPropInfo("CMannVsMachineStats""nCreditsDropped");
    
PrintToServer("%d"offs);

This returned 12, so it seems likely that 0 is indeed the right offset location, however you should be searching for tf_mann_vs_machine_stats when finding the actual entity.
Nope, won't work. 12 is nCreditsDropped's offset in "DT_CMannVsMachineWaveStats". However, you'll notice there's no way to get the offset of m_vecWaveStats.

This is because it's likely a CVector<CMannVsMachineWaveStats> on the C++ side, which can't be accessed directly via entity... we had the same problem trying to read a player's wearables via the CTFPlayer object's m_hMyWearables.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 08-21-2012 at 13:23.
Powerlord is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 02-26-2013 , 11:44   Re: [TF2] Getting Wave Acquired Credits
Reply With Quote #4

I'm not sure if changes to the netprops make this readable or not. You may now be able to use this to read them:

PHP Code:
GetEntProp(entProp_Send"m_runningTotalWavesStats"4, [type]) 
Where [type] is one of these numbers:
  1. nCreditsDropped
  2. nCreditsAcquired
  3. nCreditsBonus
  4. nPlayerDeaths
  5. nBuyBacks
(Note: These are actually offsets 4, 8, 12, 16, and 20... but we specified 4 as the size; there is no offset 0 listed)

Note that m_previousWaveStats and m_currentWaveStats have the same layouts.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 02-26-2013 at 11:55.
Powerlord 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 03:09.


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