Пример #1
0
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
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
static cell_t GetPluginIterator(IPluginContext *pContext, const cell_t *params)
{
	IPluginIterator *iter = scripts->GetPluginIterator();

	Handle_t hndl = handlesys->CreateHandle(g_PlIter, iter, pContext->GetIdentity(), g_pCoreIdent, NULL);

	if (hndl == BAD_HANDLE)
	{
		iter->Release();
	}

	return hndl;
}
Пример #4
0
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();
}
Пример #5
0
static cell_t MorePlugins(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);
	}

	return pIter->MorePlugins() ? 1 : 0;
}
Пример #6
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();
		}
	}
}
Пример #7
0
	void OnHandleDestroy(HandleType_t type, void *object)
	{
		IPluginIterator *iter = (IPluginIterator *)object;
		iter->Release();
	}