removed Handle:myself from OnPluginStart

added GetMyHandle to get handle now, but there's no use...

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40542
This commit is contained in:
David Anderson 2007-02-26 08:32:20 +00:00
parent 5cb299014a
commit 78eb5b7747
4 changed files with 32 additions and 12 deletions

View File

@ -82,6 +82,13 @@ static cell_t sm_CloneHandle(IPluginContext *pContext, const cell_t *params)
} }
} }
static cell_t sm_GetMyHandle(IPluginContext *pContext, const cell_t *params)
{
CPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
return pPlugin->GetMyHandle();
}
REGISTER_NATIVES(handles) REGISTER_NATIVES(handles)
{ {
{"IsValidHandle", sm_IsValidHandle}, {"IsValidHandle", sm_IsValidHandle},

View File

@ -92,6 +92,11 @@ void CPlugin::InitIdentity()
} }
} }
Handle_t CPlugin::GetMyHandle()
{
return m_handle;
}
CPlugin *CPlugin::CreatePlugin(const char *file, char *error, size_t maxlength) CPlugin *CPlugin::CreatePlugin(const char *file, char *error, size_t maxlength)
{ {
char fullpath[PLATFORM_MAX_PATH+1]; char fullpath[PLATFORM_MAX_PATH+1];
@ -280,7 +285,6 @@ void CPlugin::Call_OnPluginStart()
return; return;
} }
pFunction->PushCell(m_handle);
pFunction->Execute(&result); pFunction->Execute(&result);
} }

View File

@ -210,6 +210,8 @@ public:
* Returns true if the plugin was running, but is now invalid. * Returns true if the plugin was running, but is now invalid.
*/ */
bool WasRunning(); bool WasRunning();
Handle_t GetMyHandle();
protected: protected:
void UpdateInfo(); void UpdateInfo();
void SetTimeStamp(time_t t); void SetTimeStamp(time_t t);

View File

@ -56,7 +56,7 @@ public Plugin:myinfo;
* *
* @noreturn * @noreturn
*/ */
forward OnPluginStart(Handle:myself); forward OnPluginStart();
/** /**
* Called before OnPluginStart, in case the plugin wants to check for load failure. * Called before OnPluginStart, in case the plugin wants to check for load failure.
@ -156,6 +156,13 @@ forward OnClientAuthorized(client, const String:auth[]);
*/ */
forward OnGameFrame(); forward OnGameFrame();
/**
* Returns the calling plugin's Handle.
*
* @return Handle of the calling plugin.
*/
native Handle:GetMyHandle();
/** /**
* Returns the maximum number of clients allowed on the server. * Returns the maximum number of clients allowed on the server.
* *