Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions extensions/cstrike/extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ IGameConfig *g_pGameConf = NULL;
IGameEventManager2 *gameevents = NULL;
bool hooked_everything = false;
int g_msgHintText = -1;
CGlobalVars *gpGlobals;

SMEXT_LINK(&g_CStrike);

Expand Down Expand Up @@ -107,6 +108,7 @@ bool CStrike::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool
{
GET_V_IFACE_CURRENT(GetEngineFactory, gameevents, IGameEventManager2, INTERFACEVERSION_GAMEEVENTSMANAGER2);
GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
gpGlobals = ismm->GetCGlobals();

return true;
}
Expand Down
1 change: 1 addition & 0 deletions extensions/cstrike/extension.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ class CStrike :
extern IBinTools *g_pBinTools;
extern IGameConfig *g_pGameConf;
extern ISDKTools *g_pSDKTools;
extern CGlobalVars *gpGlobals;
extern int g_msgHintText;
extern bool g_pIgnoreTerminateDetour;
extern bool g_pIgnoreCSWeaponDropDetour;
Expand Down
14 changes: 13 additions & 1 deletion extensions/cstrike/timeleft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,19 @@ void TimeLeftEvents::FireGameEvent(IGameEvent *event)
if (get_new_timeleft_offset || !round_end_found)
{
get_new_timeleft_offset = false;
timersys->NotifyOfGameStart();

float flGameStartTime = gpGlobals->curtime;
uintptr_t gamerules = (uintptr_t)g_pSDKTools->GetGameRules();
if (gamerules)
{
sm_sendprop_info_t info;
if (gamehelpers->FindSendPropInfo("CCSGameRulesProxy", "m_flGameStartTime", &info))
{
flGameStartTime = *(float *)(gamerules + info.actual_offset);
}
}

timersys->NotifyOfGameStart(flGameStartTime - gpGlobals->curtime);
timersys->MapTimeLeftChanged();
}
round_end_found = false;
Expand Down