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


C++ IPluginFunction::Execute方法代码示例

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


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

示例1: SM_DoSingleExecFwds

void SM_DoSingleExecFwds(IPluginContext *ctx)
{
	IPluginFunction *pf;

	if ((pf = ctx->GetFunctionByName("OnServerCfg")) != NULL)
	{
		pf->Execute(NULL);
	}

	if ((pf = ctx->GetFunctionByName("OnConfigsExecuted")) != NULL)
	{
		pf->Execute(NULL);
	}
}
开发者ID:pmrowla,项目名称:sourcemod-1.5,代码行数:14,代码来源:CoreConfig.cpp

示例2: sm_CallFinish

static cell_t sm_CallFinish(IPluginContext *pContext, const cell_t *params)
{
	int err = SP_ERROR_NOT_RUNNABLE;
	cell_t *result;

	if (!s_CallStarted)
	{
		return pContext->ThrowNativeError("Cannot finish call when there is no call in progress");
	}

	pContext->LocalToPhysAddr(params[1], &result);

	if (s_pFunction)
	{
		IPluginFunction *pFunction = s_pFunction;
		ResetCall();
		err = pFunction->Execute(result);
	} else if (s_pForward) {
		IForward *pForward = s_pForward;
		ResetCall();
		err = pForward->Execute(result, NULL);
	}

	return err;
}
开发者ID:Nephyrin,项目名称:-furry-octo-nemesis,代码行数:25,代码来源:smn_functions.cpp

示例3: OnEmitAmbientSound

void SoundHooks::OnEmitAmbientSound(CEntityIndex index, const Vector &pos, const char *samp, float vol, 
									soundlevel_t soundlevel, int fFlags, int pitch, float delay)
{
	int entindex = index.Get();
#else
void SoundHooks::OnEmitAmbientSound(int entindex, const Vector &pos, const char *samp, float vol, 
									soundlevel_t soundlevel, int fFlags, int pitch, float delay)
{
#endif
	SoundHookIter iter;
	IPluginFunction *pFunc;
	cell_t vec[3] = {sp_ftoc(pos.x), sp_ftoc(pos.y), sp_ftoc(pos.z)};
	cell_t res = static_cast<ResultType>(Pl_Continue);
	char buffer[PLATFORM_MAX_PATH];
	strcpy(buffer, samp);

	for (iter=m_AmbientFuncs.begin(); iter!=m_AmbientFuncs.end(); iter++)
	{
		pFunc = (*iter);
		pFunc->PushStringEx(buffer, sizeof(buffer), SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
		pFunc->PushCellByRef(&entindex);
		pFunc->PushFloatByRef(&vol);
		pFunc->PushCellByRef(reinterpret_cast<cell_t *>(&soundlevel));
		pFunc->PushCellByRef(&pitch);
		pFunc->PushArray(vec, 3, SM_PARAM_COPYBACK);
		pFunc->PushCellByRef(&fFlags);
		pFunc->PushFloatByRef(&delay);
		g_InSoundHook = true;
		pFunc->Execute(&res);
		g_InSoundHook = false;

		switch (res)
		{
		case Pl_Handled:
		case Pl_Stop:
			{
				RETURN_META(MRES_SUPERCEDE);
			}
		case Pl_Changed:
			{
				Vector vec2;
				vec2.x = sp_ctof(vec[0]);
				vec2.y = sp_ctof(vec[1]);
				vec2.z = sp_ctof(vec[2]);
#if SOURCE_ENGINE == SE_DOTA
				RETURN_META_NEWPARAMS(MRES_IGNORED, &IVEngineServer::EmitAmbientSound, 
										(CEntityIndex(entindex), vec2, buffer, vol, soundlevel, fFlags, pitch, delay));
#else
				RETURN_META_NEWPARAMS(MRES_IGNORED, &IVEngineServer::EmitAmbientSound,
										(entindex, vec2, buffer, vol, soundlevel, fFlags, pitch, delay));
#endif
			}
		}
	}
}
开发者ID:LivingInPortal,项目名称:sourcemod,代码行数:55,代码来源:vsound.cpp

示例4: OnMenuCancel

void CPanelHandler::OnMenuCancel(IBaseMenu *menu, int client, MenuCancelReason reason)
{
    if (m_pFunc)
    {
        m_pFunc->PushCell(BAD_HANDLE);
        m_pFunc->PushCell(MenuAction_Cancel);
        m_pFunc->PushCell(client);
        m_pFunc->PushCell(reason);
        m_pFunc->Execute(NULL);
    }
    g_MenuHelpers.FreePanelHandler(this);
}
开发者ID:War3Evo,项目名称:sourcemod,代码行数:12,代码来源:smn_menus.cpp

示例5: sizeof

void SoundHooks::OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSample, 
							 float flVolume, float flAttenuation, int iFlags, int iPitch, const Vector *pOrigin, 
							 const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions, 
							 float soundtime, int speakerentity)
{
	SoundHookIter iter;
	IPluginFunction *pFunc;
	cell_t res = static_cast<ResultType>(Pl_Continue);
	cell_t sndlevel = static_cast<cell_t>(ATTN_TO_SNDLVL(flAttenuation));
	char buffer[PLATFORM_MAX_PATH];
	strcpy(buffer, pSample);

	for (iter=m_NormalFuncs.begin(); iter!=m_NormalFuncs.end(); iter++)
	{
		int players[64], size;
		size = _FillInPlayers(players, &filter);
		pFunc = (*iter);

		pFunc->PushArray(players, 64, SM_PARAM_COPYBACK);
		pFunc->PushCellByRef(&size);
		pFunc->PushStringEx(buffer, sizeof(buffer), SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
		pFunc->PushCellByRef(&iEntIndex);
		pFunc->PushCellByRef(&iChannel);
		pFunc->PushFloatByRef(&flVolume);
		pFunc->PushCellByRef(&sndlevel);
		pFunc->PushCellByRef(&iPitch);
		pFunc->PushCellByRef(&iFlags);
		g_InSoundHook = true;
		pFunc->Execute(&res);
		g_InSoundHook = false;

		switch (res)
		{
		case Pl_Handled:
		case Pl_Stop:
			{
				RETURN_META(MRES_SUPERCEDE);
			}
		case Pl_Changed:
			{
				CellRecipientFilter crf;
				crf.Initialize(players, size);
				RETURN_META_NEWPARAMS(
					MRES_IGNORED,
					static_cast<void (IEngineSound::*)(IRecipientFilter &, int, int, const char*, float, float, 
					int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int)>(&IEngineSound::EmitSound), 
					(crf, iEntIndex, iChannel, buffer, flVolume, SNDLVL_TO_ATTN(static_cast<soundlevel_t>(sndlevel)), 
					iFlags, iPitch, pOrigin, pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity)
					);
			}
		}
	}
}
开发者ID:Nephyrin,项目名称:-furry-octo-nemesis,代码行数:53,代码来源:vsound.cpp

示例6: OnTimer

ResultType TimerNatives::OnTimer(ITimer *pTimer, void *pData)
{
	TimerInfo *pInfo = reinterpret_cast<TimerInfo *>(pData);
	IPluginFunction *pFunc = pInfo->Hook;
	cell_t res = static_cast<ResultType>(Pl_Continue);

	pFunc->PushCell(pInfo->TimerHandle);
	pFunc->PushCell(pInfo->UserData);
	pFunc->Execute(&res);

	return static_cast<ResultType>(res);
}
开发者ID:asceth,项目名称:synapi,代码行数:12,代码来源:smn_timers.cpp

示例7: sort_adtarray_custom

int sort_adtarray_custom(const void *elem1, const void *elem2)
{
    cell_t result = 0;
    IPluginFunction *pf = g_SortInfoADT.pFunc;
    pf->PushCell(((cell_t) ((cell_t *) elem1 - g_SortInfoADT.array_base)) / g_SortInfoADT.array_bsize);
    pf->PushCell(((cell_t) ((cell_t *) elem2 - g_SortInfoADT.array_base)) / g_SortInfoADT.array_bsize);
    pf->PushCell(g_SortInfoADT.array_hndl);
    pf->PushCell(g_SortInfoADT.hndl);
    pf->Execute(&result);

    return result;
}
开发者ID:asceth,项目名称:synapi,代码行数:12,代码来源:smn_sorting.cpp

示例8: OnMenuSelect

void CPanelHandler::OnMenuSelect(IBaseMenu *menu, int client, unsigned int item)
{
    if (m_pFunc)
    {
        unsigned int old_reply = g_ChatTriggers.SetReplyTo(SM_REPLY_CHAT);
        m_pFunc->PushCell(BAD_HANDLE);
        m_pFunc->PushCell(MenuAction_Select);
        m_pFunc->PushCell(client);
        m_pFunc->PushCell(item);
        m_pFunc->Execute(NULL);
        g_ChatTriggers.SetReplyTo(old_reply);
    }
    g_MenuHelpers.FreePanelHandler(this);
}
开发者ID:War3Evo,项目名称:sourcemod,代码行数:14,代码来源:smn_menus.cpp

示例9: sort1d_amx_custom

int sort1d_amx_custom(const void *elem1, const void *elem2)
{
    cell_t c1 = *(cell_t *)elem1;
    cell_t c2 = *(cell_t *)elem2;

    cell_t result = 0;
    IPluginFunction *pf = g_SortInfo.pFunc;
    pf->PushCell(c1);
    pf->PushCell(c2);
    pf->PushCell(g_SortInfo.array_addr);
    pf->PushCell(g_SortInfo.hndl);
    pf->Execute(&result);

    return result;
}
开发者ID:asceth,项目名称:synapi,代码行数:15,代码来源:smn_sorting.cpp

示例10: OnQueryCvarValueFinished

void ConVarManager::OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *pPlayer, EQueryCvarValueStatus result, const char *cvarName, const char *cvarValue)
#endif // SE_DOTA
{
	IPluginFunction *pCallback = NULL;
	cell_t value = 0;
	List<ConVarQuery>::iterator iter;

	for (iter = m_ConVarQueries.begin(); iter != m_ConVarQueries.end(); iter++)
	{
		ConVarQuery &query = (*iter);
		if (query.cookie == cookie)
		{
			pCallback = query.pCallback;
			value = query.value;
			break;
		}
	}

	if (pCallback)
	{
		cell_t ret;

		pCallback->PushCell(cookie);
#if SOURCE_ENGINE == SE_DOTA
		pCallback->PushCell(player.Get());
#else
		pCallback->PushCell(IndexOfEdict(pPlayer));
#endif
		pCallback->PushCell(result);
		pCallback->PushString(cvarName);

		if (result == eQueryCvarValueStatus_ValueIntact)
		{
			pCallback->PushString(cvarValue);
		}
		else
		{
			pCallback->PushString("\0");
		}

		pCallback->PushCell(value);
		pCallback->Execute(&ret);

		m_ConVarQueries.erase(iter);
	}
}
开发者ID:angryzor,项目名称:sourcemod-v8,代码行数:46,代码来源:ConVarManager.cpp

示例11: OnClientQueryFinished

void ConVarManager::OnClientQueryFinished(QueryCvarCookie_t cookie,
                                          int client,
                                          EQueryCvarValueStatus result,
										  const char *cvarName,
										  const char *cvarValue)
{
	IPluginFunction *pCallback = NULL;
	cell_t value = 0;
	List<ConVarQuery>::iterator iter;

	for (iter = m_ConVarQueries.begin(); iter != m_ConVarQueries.end(); iter++)
	{
		ConVarQuery &query = (*iter);
		if (query.cookie == cookie)
		{
			pCallback = query.pCallback;
			value = query.value;
			break;
		}
	}

	if (pCallback)
	{
		cell_t ret;

		pCallback->PushCell(cookie);
		pCallback->PushCell(client);
		pCallback->PushCell(result);
		pCallback->PushString(cvarName);

		if (result == eQueryCvarValueStatus_ValueIntact)
		{
			pCallback->PushString(cvarValue);
		}
		else
		{
			pCallback->PushString("\0");
		}

		pCallback->PushCell(value);
		pCallback->Execute(&ret);

		m_ConVarQueries.erase(iter);
	}
}
开发者ID:Markusyatina,项目名称:sourcemod,代码行数:45,代码来源:ConVarManager.cpp

示例12: DoAction

cell_t CMenuHandler::DoAction(IBaseMenu *menu, MenuAction action, cell_t param1, cell_t param2, cell_t def_res)
{
#if defined MENU_DEBUG
    g_Logger.LogMessage("[SM_MENU] CMenuHandler::DoAction() (menu %p/%08x) (action %d) (param1 %d) (param2 %d)",
                        menu,
                        menu->GetHandle(),
                        action,
                        param1,
                        param2);
#endif
    cell_t res = def_res;
    m_pBasic->PushCell(menu->GetHandle());
    m_pBasic->PushCell((cell_t)action);
    m_pBasic->PushCell(param1);
    m_pBasic->PushCell(param2);
    m_pBasic->Execute(&res);
    return res;
}
开发者ID:War3Evo,项目名称:sourcemod,代码行数:18,代码来源:smn_menus.cpp

示例13: OnGameFrameHit

// Frame hit
void OnGameFrameHit(bool simulating)
{
	// Could lock?
	if (m_locked)
	{
		return;
	}
	

	// Lock
	m_locked = true;

	// Item in vec?
	if (!vecPawnReturn.empty())
	{
		// Get Last item
		PawnFuncThreadReturn *pReturn = vecPawnReturn.back();
		vecPawnReturn.pop_back();
		

		// Call Forward
		IPluginFunction *pFunc = pReturn->pFunc;

		if (pFunc != NULL && pFunc->IsRunnable())
		{
			pFunc->PushCell(pReturn->result);
			pFunc->PushCell(pReturn->error);
			pFunc->Execute(NULL);
		}
		
		// Delete item
		delete pReturn;
	}
	

	// Unlock
	m_locked = false;
}
开发者ID:Blackvein,项目名称:MessageBot,代码行数:39,代码来源:extension.cpp

示例14: OnPlaybackTempEntity

void TempEntHooks::OnPlaybackTempEntity(IRecipientFilter &filter, float delay, const void *pSender, const SendTable *pST, int classID)
{
	TEHookInfo *pInfo;
	const char *name = g_TEManager.GetNameFromThisPtr(const_cast<void *>(pSender));

	if (m_TEHooks->Retrieve(name, reinterpret_cast<void **>(&pInfo)))
	{
		SourceHook::List<IPluginFunction *>::iterator iter;
		IPluginFunction *pFunc;
		size_t size;
		cell_t res = static_cast<ResultType>(Pl_Continue);

		TempEntityInfo *oldinfo = g_CurrentTE;
		g_CurrentTE = pInfo->te;
		size = _FillInPlayers(g_TEPlayers, &filter);

		for (iter=pInfo->lst.begin(); iter!=pInfo->lst.end(); iter++)
		{
			pFunc = (*iter);
			pFunc->PushString(name);
			pFunc->PushArray(g_TEPlayers, size);
			pFunc->PushCell(size);
			pFunc->PushFloat(delay);
			pFunc->Execute(&res);

			if (res != Pl_Continue)
			{
				g_CurrentTE = oldinfo;
				RETURN_META(MRES_SUPERCEDE);
			}
		}

		g_CurrentTE = oldinfo;
		RETURN_META(MRES_IGNORED);
	}
}
开发者ID:404UserNotFound,项目名称:sourcemod,代码行数:36,代码来源:tenatives.cpp

示例15: SQL_TConnect

static cell_t SQL_TConnect(IPluginContext *pContext, const cell_t *params)
{
	IPluginFunction *pf = pContext->GetFunctionById(params[1]);
	if (!pf)
	{
		return pContext->ThrowNativeError("Function id %x is invalid", params[1]);
	}

	char *conf;
	pContext->LocalToString(params[2], &conf);

	IDBDriver *driver = NULL;
	const DatabaseInfo *pInfo = g_DBMan.FindDatabaseConf(conf);
	char error[255];
	if (pInfo != NULL)
	{
		if (pInfo->driver[0] == '\0')
		{
			driver = g_DBMan.GetDefaultDriver();
		} else {
			driver = g_DBMan.FindOrLoadDriver(pInfo->driver);
		}
		if (!driver)
		{
			UTIL_Format(error, 
				sizeof(error), 
				"Could not find driver \"%s\"", 
				pInfo->driver[0] == '\0' ? g_DBMan.GetDefaultDriverName() : pInfo->driver);
		} else if (!driver->IsThreadSafe()) {
			UTIL_Format(error,
				sizeof(error),
				"Driver \"%s\" is not thread safe!",
				driver->GetIdentifier());
		}
	} else {
		UTIL_Format(error, sizeof(error), "Could not find database conf \"%s\"", conf);
	}

	if (!pInfo || !driver)
	{
		pf->PushCell(BAD_HANDLE);
		pf->PushCell(BAD_HANDLE);
		pf->PushString(error);
		pf->PushCell(0);
		pf->Execute(NULL);
		return 0;
	}

	/* HACK! Add us to the dependency list */
	CExtension *pExt = g_Extensions.GetExtensionFromIdent(driver->GetIdentity());
	if (pExt)
	{
		g_Extensions.BindChildPlugin(pExt, g_PluginSys.GetPluginByCtx(pContext->GetContext()));
	}

	/* Finally, add to the thread if we can */
	TConnectOp *op = new TConnectOp(pf, driver, conf, params[3]);
	CPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
	if (pPlugin->GetProperty("DisallowDBThreads", NULL)
		|| !g_DBMan.AddToThreadQueue(op, PrioQueue_High))
	{
		/* Do everything right now */
		op->RunThreadPart();
		op->RunThinkPart();
		op->Destroy();
	}

	return 1;
}
开发者ID:pmrowla,项目名称:sourcemod-1.5,代码行数:69,代码来源:smn_database.cpp


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