From 88eae4ad1e4308ab9f016f9a38ef2226d8305690 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sat, 17 Mar 2007 20:25:08 +0000 Subject: [PATCH] added a new forward for OnServerActivate included timers from sourcemod.inc --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40649 --- core/PlayerManager.cpp | 3 +++ core/PlayerManager.h | 1 + plugins/include/sourcemod.inc | 8 ++++++++ plugins/include/timers.inc | 2 +- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/core/PlayerManager.cpp b/core/PlayerManager.cpp index d1575139..3f1edac3 100644 --- a/core/PlayerManager.cpp +++ b/core/PlayerManager.cpp @@ -60,6 +60,7 @@ void PlayerManager::OnSourceModAllInitialized() m_clcommand = g_Forwards.CreateForward("OnClientCommand", ET_Hook, 2, NULL, Param_Cell, Param_Cell); m_clinfochanged = g_Forwards.CreateForward("OnClientSettingsChanged", ET_Ignore, 1, p2); m_clauth = g_Forwards.CreateForward("OnClientAuthorized", ET_Ignore, 2, NULL, Param_Cell, Param_String); + m_onActivate = g_Forwards.CreateForward("OnServerLoad", ET_Ignore, 0, NULL); } void PlayerManager::OnSourceModShutdown() @@ -80,6 +81,7 @@ void PlayerManager::OnSourceModShutdown() g_Forwards.ReleaseForward(m_clcommand); g_Forwards.ReleaseForward(m_clinfochanged); g_Forwards.ReleaseForward(m_clauth); + g_Forwards.ReleaseForward(m_onActivate); delete [] m_Players; } @@ -97,6 +99,7 @@ void PlayerManager::OnServerActivate(edict_t *pEdictList, int edictCount, int cl memset(m_AuthQueue, 0, sizeof(unsigned int) * (m_maxClients + 1)); } + m_onActivate->Execute(NULL); } void PlayerManager::RunAuthChecks() diff --git a/core/PlayerManager.h b/core/PlayerManager.h index 1b8f31cb..fd8e3e45 100644 --- a/core/PlayerManager.h +++ b/core/PlayerManager.h @@ -111,6 +111,7 @@ private: IForward *m_clcommand; IForward *m_clinfochanged; IForward *m_clauth; + IForward *m_onActivate; CPlayer *m_Players; int m_maxClients; int m_PlayerCount; diff --git a/plugins/include/sourcemod.inc b/plugins/include/sourcemod.inc index 3c349416..e222406f 100644 --- a/plugins/include/sourcemod.inc +++ b/plugins/include/sourcemod.inc @@ -43,6 +43,7 @@ struct Plugin #include #include #include +#include /** * Declare this as a struct in your plugin to expose its information. @@ -104,6 +105,13 @@ forward OnPluginPauseChange(bool:pause); */ forward OnGameFrame(); +/** + * Called when the map is loaded and configs have been parsed. + * Note that commands are processed per-frame, and thus config + * files may not be fully loaded until a few seconds later. + */ +forward OnServerLoad(); + /** * Returns the calling plugin's Handle. * diff --git a/plugins/include/timers.inc b/plugins/include/timers.inc index 12add657..a3356243 100644 --- a/plugins/include/timers.inc +++ b/plugins/include/timers.inc @@ -67,7 +67,7 @@ funcenum Timer * @param flags Flags to set (such as repeatability or auto-Handle closing). * @return Handle to the timer object. You do not need to call CloseHandle(). */ -native Handle:CreateTimer(Float:interval, Timer:func, {Handle,_}:value, flags); +native Handle:CreateTimer(Float:interval, Timer:func, {Handle,_}:value, flags=0); /** * Kills a timer. Use this instead of CloseHandle() if you need more options.