コード例 #1
0
ファイル: smn_core.cpp プロジェクト: TheMadSword/sourcemod
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();
}
コード例 #2
0
ファイル: CoreConfig.cpp プロジェクト: pmrowla/sourcemod-1.5
void SM_ExecuteAllConfigs()
{
	if (g_bGotServerStart)
	{
		return;
	}

	engine->ServerCommand("exec sourcemod/sourcemod.cfg\n");

	IPluginIterator *iter = g_PluginSys.GetPluginIterator();
	while (iter->MorePlugins())
	{
		CPlugin *plugin = (CPlugin *)(iter->GetPlugin());
		unsigned int num = plugin->GetConfigCount();
		bool can_create = true;
		for (unsigned int i=0; i<num; i++)
		{
			can_create = SM_ExecuteConfig(plugin, plugin->GetConfig(i), can_create);
		}
		iter->NextPlugin();
	}
	iter->Release();

	g_bGotServerStart = true;
	CheckAndFinalizeConfigs();
}
コード例 #3
0
ファイル: CoreConfig.cpp プロジェクト: pmrowla/sourcemod-1.5
void SM_ConfigsExecuted_Plugin(unsigned int serial)
{
	IPluginIterator *iter = g_PluginSys.GetPluginIterator();
	while (iter->MorePlugins())
	{
		CPlugin *plugin = (CPlugin *)(iter->GetPlugin());
		if (plugin->GetSerial() == serial)
		{
			SM_DoSingleExecFwds(plugin->GetBaseContext());
			break;
		}
		iter->NextPlugin();
	}
	iter->Release();
}
コード例 #4
0
void SetOwnsItem(cell_t client,cell_t itemid,bool newownsitem){
	if(itemid<(cell_t)0||itemid>=MAXITEMS){
		ERR("invalid item ownership set client %d itemid %d / maxitem %d ",client,itemid ,MAXITEMS);
	}
	else{
		//ERR("1r");
		playersownershipobj[client].item[itemid]=newownsitem;
		IPluginIterator *iterator = g->pluginmanager->GetPluginIterator();
		//ERR("iter");
		while(iterator->MorePlugins()){
			IPlugin* plugin=iterator->GetPlugin();
			IPluginFunction *func=plugin->GetRuntime()->GetFunctionByName(newownsitem?"OnItem2Purchase":"OnItem2Lost");
			if(func!=NULL){
				cell_t myparams[2];
				myparams[0]=client;
				myparams[1]=itemid;
				//ERR("call");
				func->CallFunction(myparams,2,&dummy);
			}
			iterator->NextPlugin();
		}
	}
}