当前位置: 首页>>代码示例>>C++>>正文


C++ IPlugin::GetMyHandle方法代码示例

本文整理汇总了C++中IPlugin::GetMyHandle方法的典型用法代码示例。如果您正苦于以下问题:C++ IPlugin::GetMyHandle方法的具体用法?C++ IPlugin::GetMyHandle怎么用?C++ IPlugin::GetMyHandle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPlugin的用法示例。


在下文中一共展示了IPlugin::GetMyHandle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ReadPlugin

static cell_t ReadPlugin(IPluginContext *pContext, const cell_t *params)
{
	Handle_t hndl = (Handle_t)params[1];
	HandleError err;
	IPluginIterator *pIter;

	HandleSecurity sec;
	sec.pIdentity = g_pCoreIdent;
	sec.pOwner = pContext->GetIdentity();

	if ((err=handlesys->ReadHandle(hndl, g_PlIter, &sec, (void **)&pIter)) != HandleError_None)
	{
		return pContext->ThrowNativeError("Could not read Handle %x (error %d)", hndl, err);
	}

	IPlugin *pPlugin = pIter->GetPlugin();
	if (!pPlugin)
	{
		return BAD_HANDLE;
	}

	pIter->NextPlugin();

	return pPlugin->GetMyHandle();
}
开发者ID:TheMadSword,项目名称:sourcemod,代码行数:25,代码来源:smn_core.cpp

示例2: FindPluginByNumber

static cell_t FindPluginByNumber(IPluginContext *pContext, const cell_t *params)
{
	IPlugin *pPlugin = scripts->FindPluginByOrder(params[1]);
	
	if (pPlugin == NULL)
	{
		return BAD_HANDLE;
	}

	return pPlugin->GetMyHandle();
}
开发者ID:TheMadSword,项目名称:sourcemod,代码行数:11,代码来源:smn_core.cpp

示例3: sm_LogAction

static cell_t sm_LogAction(IPluginContext *pContext, const cell_t *params)
{
	char buffer[2048];
	g_pSM->SetGlobalTarget(SOURCEMOD_SERVER_LANGUAGE);
	{
		DetectExceptions eh(pContext);
		g_pSM->FormatString(buffer, sizeof(buffer), pContext, params, 3);
		if (eh.HasException())
			return 0;
	}

	IPlugin *pPlugin = scripts->FindPluginByContext(pContext->GetContext());

	LogAction(pPlugin->GetMyHandle(), 2, params[1], params[2], buffer);

	return 1;
}
开发者ID:TheMadSword,项目名称:sourcemod,代码行数:17,代码来源:smn_core.cpp

示例4: sm_AddFrameAction

static cell_t sm_AddFrameAction(IPluginContext *pContext, const cell_t *params)
{
	IPlugin *pPlugin = pluginsys->FindPluginByContext(pContext->GetContext());
	IPluginFunction *pFunction = pPlugin->GetBaseContext()->GetFunctionById(params[1]);
	if (!pFunction)
	{
		return pContext->ThrowNativeError("Invalid function id (%X)", params[1]);
	}

	IChangeableForward *pForward = forwardsys->CreateForwardEx(NULL, ET_Ignore, 1, NULL, Param_Cell);
	IdentityToken_t *pIdentity = pContext->GetIdentity();
	Handle_t Handle = handlesys->CreateHandle(g_PrivateFwdType, pForward, pIdentity, g_pCoreIdent, NULL);
	if (Handle == BAD_HANDLE)
	{
		forwardsys->ReleaseForward(pForward);
		return 0;
	}

	pForward->AddFunction(pFunction);

	SMFrameActionData *pData = new SMFrameActionData(Handle, pPlugin->GetMyHandle(), params[2]);
	g_pSM->AddFrameAction(PawnFrameAction, pData);
	return 1;
}
开发者ID:50Wliu,项目名称:sourcemod,代码行数:24,代码来源:smn_functions.cpp


注:本文中的IPlugin::GetMyHandle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。