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


C++ PluginManager::LoadPlugins方法代码示例

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


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

示例1: Load

bool ServerCore::Load(void)
{
	Log::SetState( LOG_INFO|LOG_ERROR|LOG_WARNING|LOG_DEBUG );
	Log::AddLogger(&logfile);
	Log::AddLogger(&logserver);
	concore.SetOutputFunction(Log::Info);
	concore.SetExecPath(L"cfg/");
	conscreen.SetCaption(L"FOUR-MP");
	//Core console functions
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"alias", ConCmdAlias, L"Alias a command.", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"cvarlist", ConCmdCvarlist, L"Show the list of convars/concommands.", 0));
	hm.AddNewHandle(0, HandleTypeConVar, concore.AddConVar(L"developer", 0, L"Show developer messages.", 0, true, 0, true, 2));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"echo", ConCmdEcho, L"Echo text to console.", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"exec", ConCmdExec, L"Execute script file.", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"find", ConCmdFind, L"Find concommands with the specified string in their name/help text.", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"help", ConCmdHelp, L"Find help about a convar/concommand.", 0));
	// FMP console functions
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"exit", ConCmdQuit, L"Exit the engine.", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"fs_list", ConCmdFsList, L"Prints details about loaded gamemode/filterscripts.", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"fs_load", ConCmdFsLoad, L"fs_load <filename> : loads a filterscript", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"fs_load_all", ConCmdFsLoadAll, L"Loads all filterscripts", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"fs_pause", ConCmdFsPause, L"fs_pause <index> : pauses a loaded filterscript", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"fs_pause_all", ConCmdFsPauseAll, L"Pauses all loaded filterscripts", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"fs_reload", ConCmdFsReload, L"fs_reload <index> : reloads a filterscript", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"fs_reload_all", ConCmdFsReloadAll, L"Reloads all filterscripts", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"fs_unload", ConCmdFsUnload, L"fs_unload <index> : unloads a filterscript", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"fs_unload_all", ConCmdFsUnloadAll, L"Unloads all filterscripts", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"fs_unpause", ConCmdFsUnpause, L"fs_unpause <index> : unpauses a loaded filterscript", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"fs_unpause_all", ConCmdFsUnpauseAll, L"Unpauses all disabled filterscripts", 0));
	ConVar *gamemodecvar = concore.AddConVar(L"host_gamemode", L"", L"Current gamemode name.", 0);
	gamemodecvar->HookChange(ConVarHookHostGamemode);
	hm.AddNewHandle(0, HandleTypeConVar, gamemodecvar);
	ConVar *hostnamecvar = concore.AddConVar(L"hostname", L"", L"Hostname for server.", 0);
	hostnamecvar->HookChange(ConVarHookHostname);
	hm.AddNewHandle(0, HandleTypeConVar, hostnamecvar);
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"plugin_list", ConCmdPluginList, L"Prints details about loaded plugins.", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"plugin_load", ConCmdPluginLoad, L"plugin_load <filename> : loads a plugin", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"plugin_load_all", ConCmdPluginLoadAll, L"Loads all plugins", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"plugin_pause", ConCmdPluginPause, L"plugin_pause <index> : pauses a loaded plugin", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"plugin_pause_all", ConCmdPluginPauseAll, L"Pauses all loaded plugins", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"plugin_reload", ConCmdPluginReload, L"fs_reload <index> : reloads a plugin", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"plugin_reload_all", ConCmdPluginReloadAll, L"Reloads all plugins", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"plugin_unload", ConCmdPluginUnload, L"fs_unload <index> : unloads a plugin", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"plugin_unload_all", ConCmdPluginUnloadAll, L"Unloads all plugins", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"plugin_unpause", ConCmdPluginUnpause, L"fs_unpause <index> : unpauses a loaded plugin", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"plugin_unpause_all", ConCmdPluginUnpauseAll, L"Unpauses all disabled plugins", 0));
	hm.AddNewHandle(0, HandleTypeConCmd, concore.AddConCmd(L"quit", ConCmdQuit, L"Exit the engine.", 0));
	ConVar *rconpasswordcvar = concore.AddConVar(L"rcon_password", L"", L"Remote console password.", 0);
	rconpasswordcvar->HookChange(ConVarHookRconPassword);
	hm.AddNewHandle(0, HandleTypeConVar, rconpasswordcvar);
	componentselectcvar = concore.AddConVar(L"sv_componentselect", 0, L"Enables component select", 0, true, 0, true, 1);
	componentselectcvar->HookChange(ConVarHookSvComponentselect);
	hm.AddNewHandle(0, HandleTypeConVar, componentselectcvar);
	ConVar *lancvar = concore.AddConVar(L"sv_lan", 1, L"Server is a lan server (no heartbeat, no authentication, no non-class C addresses).", 0, true, 0, true, 1);
	lancvar->HookChange(ConVarHookSvLan);
	hm.AddNewHandle(0, HandleTypeConVar, lancvar);
	ConVar *passwordcvar = concore.AddConVar(L"sv_password", L"", L"Server password for entry into multiplayer games", 0);
	passwordcvar->HookChange(ConVarHookSvPassword);
	hm.AddNewHandle(0, HandleTypeConVar, passwordcvar);
	ConVar *portcvar = concore.AddConVar(L"sv_port", 7777, L"Server port.", 0, true, 0, true, 65535);
	portcvar->HookChange(ConVarHookSvPort);
	hm.AddNewHandle(0, HandleTypeConVar, portcvar);
	Log::Void(L"FOUR-MP. Copyright 2009-2010 Four-mp team.");
	concore.InterpretLine(L"exec server.cfg");
	sleepcount = 1000 / SERVER_TICKRATE;
	gametime.ticksperminute = SERVER_TICKRATE * 2;
	nm.Load(playm.GetMaxPlayers(), port);
	maxplayers = playm.GetMaxPlayers();
	plugm.LoadPlugins();
	vmm.LoadFilterScripts();
	if (!vmm.LoadGameMode(gamemode))
	{
		Log::Error(L"Can't load gamemode.");
		return false;
	}
	gamemodename = vmm.GetGameModeName();
	if (!lan)
	{
		msm.Init();
	}
	this->UpdateServerInfo();
	this->UpdateCaption();
	isrunning = true;
	Log::Debug(L"Started");
	return true;
}
开发者ID:ThePirateOld,项目名称:four-mp,代码行数:86,代码来源:ServerCore.cpp


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