From 0a4a60fe0871fddbaeb4d2b199eb5675934fe134 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 29 May 2008 03:59:00 +0000 Subject: [PATCH] added amb1685 - GetTickInterval() --HG-- branch : sourcemod-1.0.x extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402213 --- core/smn_timers.cpp | 8 +++++++- plugins/include/timers.inc | 9 +++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/core/smn_timers.cpp b/core/smn_timers.cpp index 362606e0..43ec3e5d 100644 --- a/core/smn_timers.cpp +++ b/core/smn_timers.cpp @@ -2,7 +2,7 @@ * vim: set ts=4 : * ============================================================================= * SourceMod - * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. + * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved. * ============================================================================= * * This program is free software; you can redistribute it and/or modify it under @@ -325,6 +325,11 @@ static cell_t smn_IsServerProcessing(IPluginContext *pContext, const cell_t *par return (gpGlobals->frametime > 0.0f) ? 1 : 0; } +static cell_t smn_GetTickInterval(IPluginContext *pContext, const cell_t *params) +{ + return sp_ftoc(gpGlobals->interval_per_tick); +} + REGISTER_NATIVES(timernatives) { {"CreateTimer", smn_CreateTimer}, @@ -335,5 +340,6 @@ REGISTER_NATIVES(timernatives) {"GetMapTimeLimit", smn_GetMapTimeLimit}, {"ExtendMapTimeLimit", smn_ExtendMapTimeLimit}, {"IsServerProcessing", smn_IsServerProcessing}, + {"GetTickInterval", smn_GetTickInterval}, {NULL, NULL} }; diff --git a/plugins/include/timers.inc b/plugins/include/timers.inc index f7b5d402..e07841f9 100644 --- a/plugins/include/timers.inc +++ b/plugins/include/timers.inc @@ -152,6 +152,15 @@ native bool:GetMapTimeLimit(&time); */ native bool:ExtendMapTimeLimit(time); +/** + * Returns the number of seconds in between game server ticks. + * + * Note: A tick, in this context, is a frame. + * + * @return Number of seconds in between ticks. + */ +native Float:GetTickInterval(); + /** * Notification that the map's time left has changed via a change in the time * limit or a change in the game rules (such as mp_restartgame). This is useful