Raised This Month: $32 Target: $400
 8% 

Pointer to g_pGameRules and it's offsets


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Immortal_BLG
Member
Join Date: Feb 2010
Location: RUSSIA
Old 04-02-2010 , 05:12   Pointer to g_pGameRules and it's offsets
Reply With Quote #1

Offset to g_pGameRules relative ServerDeactivate is 11.

Code:
const void *const g_pGameRules (reinterpret_cast <const void *const *const *const> (reinterpret_cast <const unsigned char *const> (ServerDeactivate) + 11u)[0u][0u]);
Code:
	Offset_IsFreezePeriod                              = 4u,									// TRUE at beginning of round, set to FALSE when the period expires (as bool, but BOOL)

	//--> CVoiceGameMngr START
		Offset_MessagePlayerVoiceMask                  = 6u,									// (as int)
		Offset_MessageRequestState                     = 7u,									// (as int)
		Offset_Helper                                  = 8u,									// (as IVoiceGameMngrHelper *)
		Offset_MaximumPlayers                          = 9u,									// (as int)
		Offset_UpdateIntervalTime                      = 10u,									// (as double)
	//<-- CVoiceGameMngr END

	Offset_IsBombDropped                               = 8u,									// (as bool)
	Offset_RestartRoundTime                            = 12u,									// The global time when the round is supposed to end, if this is not 0 (as float)

	Offset_RoundCount                                  = 14u,									// (as float)
	Offset_RoundTime                                   = 15u,									// (From mp_roundtime) - How many seconds long this round is. (as unsigned int)
	Offset_RoundTimeSecs                               = 16u,									// (Current) round timer - set to 'Offset_IntroRoundTime', then 'Offset_RoundTime'. (as unsigned int)
	Offset_IntroRoundTime                              = 17u,									// (From mp_freezetime) - How many seconds long the intro round (when players are frozen) is. (as unsigned int)
	Offset_IntroRoundCount                             = 18u,									// The global time when the intro round ends and the real one starts. (as float)

	Offset_Account                                     = 19u,									// (as unsigned int)
		Offset_AccountTerrorist                        = Offset_Account,						// (as unsigned int)
		Offset_AccountCounterTerrorist                 = Offset_Account + 1u,					// (as unsigned int)

	// The number of players on the team (this is generated at the end of a round)
	Offset_PlayerCount                                 = 21u,									// (as unsigned int)
		Offset_PlayerCount_Terrorist                   = Offset_PlayerCount,					// The number of terrorists on the team (this is generated at the end of a round) (as unsigned int)
		Offset_PlayerCount_CounterTerrorist            = Offset_PlayerCount + 1u,				// The number of CTs on the team (this is generated at the end of a round) (as unsigned int)

	Offset_SpawnableNumber                             = 23u,									// (as unsigned int)
		Offset_SpawnableNumber_Terrorist               = Offset_SpawnableNumber,				// (as unsigned int)
		Offset_SpawnableNumber_CounterTerrorist        = Offset_SpawnableNumber + 1u,			// (as unsigned int)

	Offset_SpawnPointCount                             = 25u,									// (as unsigned int)
		Offset_SpawnPointCount_Terrorist               = Offset_SpawnPointCount,				// Number of Terrorist spawn points. (as unsigned int)
		Offset_SpawnPointCount_CounterTerrorist        = Offset_SpawnPointCount + 1u,			// Number of CT spawn points. (as unsigned int)

	Offset_HostagesRescued                             = 27u,									// (as unsigned int)
	Offset_HostagesTouched                             = 28u,									// (as unsigned int)
	Offset_RoundWinStatus                              = 29u,									// 1 == CT's won last round, 2 == Terrorists did, 3 == Draw, no winner. (as unsigned int)
	Offset_IsMapHasVIPSafetyZone                       = 33u,									// 0 = uninitialized; 1 = has VIP safety zone; 2 = DOES not have VIP safetyzone (as unsigned int)
//	Offset_UNKNOWN                                     = 34u,									// (something with trigger_camera in ClientPutInServer()) (as unsigned int)
	Offset_C4Timer                                     = 35u,									// How long from when the C4 is armed until it blows. (as unsigned int)
	Offset_C4Guy                                       = 36u,									// The current Terrorist who has the C4. (as unsigned int)
	Offset_LoserBonus                                  = 37u,									// The amount of money the losing team gets. This scales up as they lose more rounds in a row. (as unsigned int)

	Offset_ConsecutiveLosesNumber                      = 38u,									// The number of rounds the CT's have lost in a row. (as unsigned int)
		Offset_ConsecutiveLosesNumber_Terrorist        = Offset_ConsecutiveLosesNumber + 1u,	// The number of rounds the Terrorists have lost in a row. (as unsigned int)
		Offset_ConsecutiveLosesNumber_CounterTerrorist = Offset_ConsecutiveLosesNumber,			// The number of rounds the CT's have lost in a row. (as unsigned int)

	Offset_MaxIdlePeriod                               = 40u,									// For the idle kick functionality. This is tha max amount of time that the player has to be idle before being kicked (as float)
	Offset_LimitTeams                                  = 41u,									// Max # of players 1 team can have over another. (as unsigned int)
	Offset_RequiredEscapeRatio                         = 43u,									// (as float)
	Offset_EscapersNumber                              = 44u,									// Number of escaped terrorist (for escape maps) (as unsigned int)
	Offset_HaveEscaped                                 = 45u,									// (as unsigned int)
	Offset_C4_ExplosionRadius                          = 47u,									// (as float)
	Offset_ConsecutiveVIP                              = 48u,									// (as unsigned int)
	Offset_WeaponsNumber                               = 49u,									// (Including smoke grenade) (as unsigned int)
	Offset_GrenadesNumber                              = 50u,									// (Only HE and flashbang grenades) (as unsigned int)
	Offset_ArmorNumber                                 = 51u,									// (Assault suit and kevlar) (as unsigned int)
	Offset_UnBalancedRounds                            = 52u,									// Keeps track of the # of consecutive rounds that have gone by where one team outnumbers the other team by more than 2. (as unsigned int)
	Offset_EscapeRoundsNumber                          = 53u,									// Keeps track of the # of consecutive rounds of escape played.. Teams will be swapped after 8 rounds. (as unsigned int)
	Offset_MapsVotesNumbers                            = 54u,									// (as unsigned int *, but unsigned int[100])

	Offset_Score                                       = 60u,									// (as unsigned short)
		Offset_Score_Terrorist                         = Offset_Score + 1u,						// (as unsigned short)
		Offset_Score_CounterTerrorist                  = Offset_Score,							// (as unsigned short)

	// BOMB MAP VARIABLES
	Offset_IsTargetBombed                              = 124u,									// Whether or not the bomb has been bombed. (as bool)
	Offset_IsBombDefused                               = 125u,									// Whether or not the bomb has been defused. (as bool)
	Offset_IsMapHasBombTarget                          = 126u,									// (as bool)
	Offset_IsMapHasBombZone                            = 127u,									// (as bool)

	Offset_IsMapHasBuyZone                             = 128u,									// (as bool)
	Offset_IsMapHasRescueZone                          = 129u,									// (as bool)
	Offset_IsMapHasEscapeZone                          = 130u,									// (as bool)
	Offset_LastPick                                    = 154u,									// (as unsigned int)
	Offset_MaximumRounds                               = 156u,									// (as unsigned int)
	Offset_TotalRoundsPlayed                           = 157u,									// (as unsigned int)
	Offset_WinLimit                                    = 158u,									// (as unsigned int)
	Offset_AllowSpectators                             = 159u,									// (as int)
	Offset_ForceCamera                                 = 160u,									// (as float)
	Offset_ForceChaseCamera                            = 161u,									// (as float)
	Offset_FadeToBlack                                 = 162u,									// (as float)
	Offset_VIP                                         = 163u,									// (as Classes::BasePlayer *)
	Offset_VIPQueue                                    = 164u,									// (as Classes::BasePlayer **, but Classes::BasePlayer *[5])
	Offset_IsLevelInitialized                          = 168u,									// (as bool)
	Offset_IsRoundTerminating                          = 169u,									// (as bool)
	Offset_IsCompleteReset                             = 170u,									// Set to TRUE to have the scores reset next time round restarts. (as bool)
	Offset_IntermissionEndTime                         = 169u,									// (as float)
	Offset_IntermissionStartTime                       = 170u,									// (as float)
	Offset_NextPeriodicThinkTime                       = 172u,									// (as float)
//	Offset_UNKNOWN1                                    = 174u,									// (as unsigned int)
//	Offset_UNKNOWN2                                    = 175u,									// (as unsigned int)
	Offset_WinDifference                               = 176u,									// (as int)
//	Offset_UNKNOWN3                                    = 177u,									// (as unsigned int)

	// Who can and can't buy.
	Offset_IsCantBuy                                   = 184u,									// (as bool)
		Offset_IsCantBuy_Terrorist                     = Offset_IsCantBuy,						// (as bool)
		Offset_IsCantBuy_CounterTerrorist              = Offset_IsCantBuy + 1u,					// (as bool)

	Offset_EndIntermissionButtonHit                    = 684u,									// (as bool, but BOOL)
	Offset_IsGameCommenced                             = 692u,									// Set to TRUE to have the scores reset next time round restarts. (as bool)
	Offset_IsCareerMatch                               = 693u,									// (as bool)
	Offset_IsShouldSkipSpawn                           = 712u									// (as bool)

sizeof (CHalfLifeMultiplay) == 720
NOTE: All types in C++ !!!

P.S. Please, if somebody knows other CGameRules/CHalfLifeMultiplay offsets - please write it's here

Last edited by Immortal_BLG; 04-10-2010 at 08:18. Reason: ADDED: CVoiceGameMngr offsets, CHANGED: Offset_IsFirstPlayerConnected name to Offset_IsGameCommenced
Immortal_BLG is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-02-2010 , 08:21   Re: Pointer to g_pGameRules and it's offsets
Reply With Quote #2

You should not show the real offsets because g_pGameRules needs the offset *size cell. It will be less confusing to show with the size included.
I'm going to post my list too in another thread ( it was planned ), it's more or less the same since we have looked at the same place. ;)
__________________
Arkshine is offline
Immortal_BLG
Member
Join Date: Feb 2010
Location: RUSSIA
Old 04-02-2010 , 20:47   Re: Pointer to g_pGameRules and it's offsets
Reply With Quote #3

as bool cell offset == bool offset / 4
as signed/unsigned short cell offset == short offset / 2

Example1: Offset_IsShouldSkipSpawn / 4 == cell offset
Example2: Offset_Score_Terrorist / 2 == cell offset

For me the only problem with Boolean data types, because the patched instance if offset Offset_IsCareerMatch (693) is divide by 4, then the answer will 173.25 ie not an integer, which means that for this offset is necessary to find a valid flag, such as for player offset OFFSET_VIP - as bool it's 837 and check the VIP will look like this:
Code:
((bool *) pPlayer->pvPrivateData)[837] == true
, but as a cell - is 209,25 - ie 209, and now for To check whether a player is VIP, we need to do so
Code:
(((int *) pPlayer->pvPrivateData)[209] & (1 << 8))> 0
P.S. if written "as bool, but BOOL", then this offset can simply be divided by 4 and you get a cell offset because the sizeof (BOOL) is equal 4 bytes

Sorry for BAD English, but how could....

Last edited by Immortal_BLG; 04-02-2010 at 20:59.
Immortal_BLG is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-03-2010 , 08:55   Re: Pointer to g_pGameRules and it's offsets
Reply With Quote #4

Thanks for the explanation. ;)
__________________
Arkshine is offline
Immortal_BLG
Member
Join Date: Feb 2010
Location: RUSSIA
Old 04-04-2010 , 20:50   Re: Pointer to g_pGameRules and it's offsets
Reply With Quote #5

ADDED:
Code:
Offset_RequiredEscapeRatio = 43u, // (as float)
Offset_LastPick                 = 154u, // (as unsigned int)
Offset_VIPQueue               = 164u, // (as Classes::BasePlayer **, but Classes::BasePlayer *[5])

Last edited by Immortal_BLG; 04-04-2010 at 21:05.
Immortal_BLG is offline
Immortal_BLG
Member
Join Date: Feb 2010
Location: RUSSIA
Old 04-05-2010 , 05:41   Re: Pointer to g_pGameRules and it's offsets
Reply With Quote #6

ADDED:
Code:
Offset_VoiceGameManager = 4u, // (as Classes::VoiceGameMngr *?)
Offset_MapsVotesNumbers = 54u, // (as unsigned int *, but unsigned int[100])
Offset_AllowSpectators     = 159u, // (as int)
Offset_ForceCamera         = 160u, // (as float)
Offset_ForceChaseCamera = 161u, // (as float)
Offset_FadeToBlack          = 162u, // (as float)
Offset_WinDifference         = 176u, // (as int)

sizeof (CHalfLifeMultiplay) == 720
CHANGED:
Code:
unknown offset 172 name to Offset_NextPeriodicThinkTime

Last edited by Immortal_BLG; 04-07-2010 at 04:31. Reason: Fixed sizeof from 744 to 720, cause I'm was wrong....
Immortal_BLG is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-10-2010 , 05:58   Re: Pointer to g_pGameRules and it's offsets
Reply With Quote #7

Quote:
sizeof (CHalfLifeMultiplay) == 720
How you know that ?
__________________
Arkshine is offline
Immortal_BLG
Member
Join Date: Feb 2010
Location: RUSSIA
Old 04-10-2010 , 08:13   Re: Pointer to g_pGameRules and it's offsets
Reply With Quote #8

See InstallGameRules
Code:
operator new (unsigned int size)
Argument 'size' is size of CHalfLifeMultiplay=0x2D0u=720 or CHalfLifeTraining=0x2E8u=744. (These sizes include sizes of all virtual tables (from game rules itself and CVoiceGameMngr) - see this post)

ADDED: CVoiceGameMngr offsets, CHANGED: Offset_IsFirstPlayerConnected name to Offset_IsGameCommenced

Last edited by Immortal_BLG; 04-10-2010 at 08:25.
Immortal_BLG is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-13-2012 , 07:56   Re: Pointer to g_pGameRules and it's offsets
Reply With Quote #9

Thanks for your great work, with your help i managed to complete the list, here is what i have :

Code:
typedef struct CVoiceGameMgr_s
{
#ifndef __linux__
    void*		vtbl;
    int _dummy;
#endif
    int			m_msgPlayerVoiceMask;
    int			m_msgRequestState;

    void*		m_pHelper;
    int			m_nMaxPlayers;
    double		m_UpdateInterval;
#ifdef __linux__
    void*		vtbl;
#endif
}CVoiceGameMgr_t;

typedef struct CHalfLifeMultiplay_s
{
#ifndef __linux__
	void*			vtbl;					// windows 0
#endif
	BOOL			m_fFreezePeriod;			// 0 // windows +1
	BOOL			m_fBombDropped;				// 1 // windows +1

#ifdef __linux__
	void*			vtbl;					// linux 2
#else
	int _dummy_3_win32;
#endif

	CVoiceGameMgr_t	 	m_sVoiceGameMgr;			// 3 // windows +1 // windows 8* 4bytes, linux 7* 4bytes

	float			m_flRestartRoundTime;			// 10 // windows +2 untill the end

	int _dummy_11;

	int			m_fRoundCount;				// 12
	int			m_iRoundTime;				// 13 // secs !!!
	int			m_iRoundTimeSecs;			// 14
	int			m_iFreezeTime;				// 15

	float			m_flEndOfFreezeTime;			// 16

	int			m_iAccountTerrorist;			// 17
	int			m_iAccountCT;				// 18

	int			m_iNumTerrorist;			// 19
	int			m_iNumCT;				// 20

	int			m_iNumSpawnableTerrorist;		// 21
	int			m_iNumSpawnableCT;			// 22

	int			m_iTeSpawnsNum;				// 23
	int			m_iCtSpawnsNum;				// 24

	int			m_iHostagesRescued;			// 25
	int			m_iHostagesTouched;			// 26
	int			m_iRoundWinStatus;			// 27
	short			m_iTerroristsScore;			// 28	// 56u
	short			m_iCTsScore;				// 28	// 57u

	bool			m_bTargetBombed;			// 29
	bool			m_bBombDefused;				// 29
	bool			m_bMapHasBombTarget;			// 29
	bool			m_bMapHasBombZone;			// 29

	bool			m_bMapHasBuyZone;			// 30
	bool			m_bMapHasRescueZone;			// 30
	bool			m_bMapHasEscapeZone;			// 30
	bool _dummy_30_4;						// 30

	int			m_iMapHasVIPSafetyZone;			// 31 // == 2 no zone found

	int			m_fMapHasCamera;			// 32 // initialized to 2=Not Set, 1=Has Cam, 0=No Cam
	int			m_iC4Timer;				// 33
	int			m_iLastBomber;				// 34 // CHalfLifeMultiplay::GiveC4
	int			m_iLoserBonus;				// 35
	int			m_iCtWinningStreak;			// 36
	int			m_iTeWinningStreak;			// 37
	float			m_fMaxIdlePeriod;			// 38
	int			m_iLimitTeams;				// 39
	bool			m_bSpawnsCounted;			// 40 // Set to 0 in GameDllInit and checked in Think, if false, spawns are counted in order to fill m_iTeSpawnsNum and m_iCtSpawnsNum (see TeamFull)
	bool			m_bRoundTerminating;			// 40
	bool			m_bCompleteReset;			// 40
	bool _dummy_40_3;						// 40

	int			m_flRequiredEscapeRatio;		// 41
	int			m_iNumEscapers;				// 42
	int			m_iHaveEscaped;				// 43 // count

	bool			m_bCtShopDisabled;			// 44
	bool			m_bTeShopDisabled;			// 44
	bool _dummy_44_[2];

	float			m_flC4RadiusDamage;			// 45 // ??? /// initialized to 500.0
	int			m_iConsecutiveVIP;			// 46
	int			m_iWeaponsNum;				// 47
	int			m_iGrenadesNum;				// 48
	int			m_iArmorsNum;				// 49
	int			m_iUnBalancedRounds;			// 50
	int			m_iNumEscapeRounds;			// 51
	int			m_iMapsVotesNumbers[100];		// 52
	int			m_iLastPick;				// 152

	int _dummy_153;

	int			m_iMaxRounds;				// 154
	int			m_iTotalRoundsPlayed;			// 155
	int			m_iWinLimit;				// 156
	BOOL			m_fAllowSpectators;			// 157
	float			m_flForceCamera;			// 158
	float			m_flForceChaseCamera;			// 159
	float			m_flFadeToBlack;			// 160
	CBaseEntity*		m_pVIP;					// 161
	CBaseEntity*		m_iVipQueueCount[5];			// 162
	float			m_flIntermissionEndTime;		// 167
	float			m_flIntermissionStartTime;		// 168
	BOOL			m_fEndIntermissionButtonHit;		// 169
	float			m_flNextThink;				// 170
	bool			m_bMatchStarted;			// 171
	bool			m_bIsCareer;				// 171
	bool _dummy_171_3[2];

	float _dummy_172;
	int _dummy_173;

	int 			m_iWinDifference;			// 174

	float			m_flCareerNextThing;			// 175 // initialized to 0 // CHalfLifeMultiplay::Think() // checked in CHalfLifeMultiplay::QueueCareerRoundEndMenu and set to gametime + 3.0, return if < gametime
	bool			m_bShouldSkipSpawn;			// 176
	bool _dummy_13514[3];
}CHalfLifeMultiplay_t;
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 05-13-2012 at 10:58.
ConnorMcLeod is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 05-15-2012 , 10:28   Re: Pointer to g_pGameRules and it's offsets
Reply With Quote #10

Connor, that list of yours, I don't really understand ... Can data for all of those constants be accessed? If so, can you please explain how?
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 05-15-2012 at 10:28.
hornet 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 14:55.


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