From 20bdc2b435802b03f9443ba2a7c421a7142177af Mon Sep 17 00:00:00 2001 From: Tony Date: Wed, 30 May 2012 14:14:54 +0100 Subject: [PATCH] Added GetGameTickCount native (bug 5209, r=psychonic). --- core/smn_halflife.cpp | 6 ++++++ plugins/include/halflife.inc | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/core/smn_halflife.cpp b/core/smn_halflife.cpp index b0c7c6b5..16d7f30a 100644 --- a/core/smn_halflife.cpp +++ b/core/smn_halflife.cpp @@ -87,6 +87,11 @@ static cell_t GetGameTime(IPluginContext *pContext, const cell_t *params) return sp_ftoc(gpGlobals->curtime); } +static cell_t GetGameTickCount(IPluginContext *pContext, const cell_t *params) +{ + return gpGlobals->tickcount; +} + static cell_t CreateFakeClient(IPluginContext *pContext, const cell_t *params) { if (!g_SourceMod.IsMapRunning()) @@ -520,6 +525,7 @@ REGISTER_NATIVES(halflifeNatives) {"GetGameDescription", GetGameDescription}, {"GetGameFolderName", GetGameFolderName}, {"GetGameTime", GetGameTime}, + {"GetGameTickCount", GetGameTickCount}, {"GetRandomFloat", GetRandomFloat}, {"GetRandomInt", GetRandomInt}, {"IsDedicatedServer", IsDedicatedServer}, diff --git a/plugins/include/halflife.inc b/plugins/include/halflife.inc index f15d8588..8356e8d0 100644 --- a/plugins/include/halflife.inc +++ b/plugins/include/halflife.inc @@ -127,6 +127,13 @@ native Float:GetEngineTime(); */ native Float:GetGameTime(); +/** + * Returns the game's internal tick count. + * + * @return Game tick count. + */ +native GetGameTickCount(); + /** * Returns the game description from the mod. *