Raised This Month: $28 Target: $400
 7% 

Help with accessing a network properties outside GameRules scope


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
joao7yt
Senior Member
Join Date: Nov 2014
Location: Brazil
Old 04-30-2020 , 12:18   Help with accessing a network properties outside GameRules scope
Reply With Quote #1

So, I was searching a way to get the current round number of the match... I'm sure this can be accessed some easy way since, for example, the "mp_backup_round_file_pattern" convar accept the "%round%" variable, which replaces it with the round number in the backup file name... (https://totalcsgo.com/command/mpbackuproundfilepattern)

I used "sm_dump_netprops netprops.txt" and was taking a look in the dump file and found "m_scoreTotal"... This could be my answer... BUUUT this netprop can't be accessed using GameRules_GetProp because it's outside the GameRules scope.

I then found the source code used to get GameRules netprops: https://github.com/alliedmodders/sou...lesnatives.cpp

I was thinking of some approaches but I wanted to hear from you guys; what would be the best way to implement a safe and robust code in my plugin so I can get the "m_scoreTotal" value, or any other netprop value?

Perhaps a method like GetProp could be implemented in sourcemod as default, where you would provide the scope you want to get the prop from...

Last edited by joao7yt; 04-30-2020 at 12:19.
joao7yt is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-30-2020 , 12:39   Re: Help with accessing a network properties outside GameRules scope
Reply With Quote #2

Prop_Send.txt
Code:
CCSTeam (type DT_CSTeam)
 Table: baseclass (offset 0) (type DT_Team)
  Member: m_iTeamNum (offset 1352) (type integer) (bits 5) ()
  Member: m_bSurrendered (offset 1312) (type integer) (bits 32) ()
  Member: m_scoreTotal (offset 1316) (type integer) (bits 32) ()
  Member: m_scoreFirstHalf (offset 1320) (type integer) (bits 32) ()
...
Prop_Data.txt
Code:
CCSTeam - cs_team_manager
- m_iClassname (Offset 96) (Save|Key)(4 Bytes) - classname
- m_iGlobalname (Offset 540) (Global|Save|Key)(4 Bytes) - globalname
- m_iParent (Offset 544) (Save|Key)(4 Bytes) - parentname
...
in game sv_cheats 1, find_ent
Code:
find_ent team
Searching for entities with class/target name containing substring: 'team'
   'cs_team_manager' : '' (entindex 65)
   'cs_team_manager' : '' (entindex 66)
   'cs_team_manager' : '' (entindex 67)
   'cs_team_manager' : '' (entindex 68)
Found 4 matches.
PHP Code:
/*
find_ent team
Searching for entities with class/target name containing substring: 'team'
   'cs_team_manager' : '' (entindex 65)
   'cs_team_manager' : '' (entindex 66)
   'cs_team_manager' : '' (entindex 67)
   'cs_team_manager' : '' (entindex 68)
Found 4 matches.
*/


#include <sdktools>

public void OnPluginStart()
{
    
RegConsoleCmd("sm_test"test);
}

public 
Action test(int clientint args)
{

    
int ent = -1;
    
    while( (
ent FindEntityByClassname(ent"cs_team_manager")) != -)
    {
        
int m_iTeamNum GetEntProp(entProp_Send"m_iTeamNum");        
        
int m_scoreTotal GetEntProp(entProp_Send"m_scoreTotal");
        
        
PrintToServer("[%i]cs_team_manager, m_iTeamNum[%i] m_scoreTotal[%i]"entm_iTeamNumm_scoreTotal);
    }


    return 
Plugin_Handled;


__________________
Do not Private Message @me
Bacardi is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-30-2020 , 13:59   Re: Help with accessing a network properties outside GameRules scope
Reply With Quote #3

There is this also.

PHP Code:
PrintToServer("m_totalRoundsPlayed %i"GameRules_GetProp("m_totalRoundsPlayed")); 
__________________
Do not Private Message @me
Bacardi is offline
joao7yt
Senior Member
Join Date: Nov 2014
Location: Brazil
Old 04-30-2020 , 14:13   Re: Help with accessing a network properties outside GameRules scope
Reply With Quote #4

Quote:
Originally Posted by Bacardi View Post
There is this also.

PHP Code:
PrintToServer("m_totalRoundsPlayed %i"GameRules_GetProp("m_totalRoundsPlayed")); 
That's it, thank you man, made my day
joao7yt is offline
Reply


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 05:32.


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