initial commit of plugin that loads and unloads plugins based on what map it is. tries to prevent slow map changes

This commit is contained in:
jenz 2024-07-28 22:36:22 +02:00
parent 35375b7067
commit 466b9e5849
2 changed files with 355 additions and 0 deletions

View File

@ -0,0 +1,291 @@
"global"
{
"sm plugins unload disabled/FSA"
"sm plugins unload disabled/sounds"
"sm plugins unload disabled/UNLOZE_KnifeMadness"
"sm plugins unload disabled/AntiKnifeSettings"
"sm plugins unload disabled/PushNades"
"sm plugins unload disabled/autobhop"
"sm plugins unload disabled/StackMode"
"sm plugins unload disabled/FunSuperAdmin"
"sm plugins unload disabled/PropSpawner"
"sm plugins unload disabled/VIPMode"
"sm plugins unload disabled/zh_respawn_stop"
"sm plugins unload disabled/vscript_Kitchen"
"sm plugins unload disabled/ze_boatescape6_remix_fix2"
"sm plugins unload disabled/vscript_Aesthetic"
"sm plugins unload disabled/vscript_JJBA"
"sm plugins unload disabled/vscripts_Geometric"
"sm plugins unload disabled/vscript_ze_dreamin_v2"
"sm plugins unload disabled/vscript_ze_dreamin_v3"
"sm plugins unload disabled/ze_squidzer"
"sm plugins unload disabled/SCP"
"sm plugins unload disabled/MakoVote"
"sm plugins unload disabled/molten_blessings"
"sm plugins unload disabled/jump_king_plus"
"sm plugins unload disabled/ze_icecap_escape_act2_b3s_fix"
"sm plugins load momsurffix2"
"sm plugins unload disabled/VScript_ze_stardust_battleground"
"sm plugins load SaveLevel"
"sm plugins load FixLagCompensation"
"sm plugins load zr_repeatkill"
"sm plugins unload disabled/ItemSpawn"
"sm plugins load LagCompensation"
"sm plugins unload disabled/ze_ffvii_mako_reactor_v5_3"
"sm plugins load Extend"
"sm plugins unload WeaponEquip"
"sm plugins load disabled/PlayerVisibility"
"sm plugins load PlayerVisibility"
"sm plugins load KnifeBan"
}
"cs_office"
{
"sm plugins load disabled/zh_respawn_stop"
}
"cs_assault"
{
"sm plugins load disabled/zh_respawn_stop"
}
"cs_militia"
{
"sm plugins load disabled/zh_respawn_stop"
}
"zm_melong_dow_learjet_b1"
{
"sm plugins load disabled/zh_respawn_stop"
}
"de_train"
{
"sm plugins load disabled/zh_respawn_stop"
}
"de_piranesi"
{
"sm plugins load disabled/zh_respawn_stop"
}
"de_dust"
{
"sm plugins load disabled/zh_respawn_stop"
}
"zm_no_mercy_v1"
{
"sm plugins load disabled/zh_respawn_stop"
}
"cs_havana"
{
"sm plugins load disabled/zh_respawn_stop"
}
"de_nuke"
{
"sm plugins load disabled/zh_respawn_stop"
}
"de_aztec"
{
"sm plugins load disabled/zh_respawn_stop"
}
"de_chateau"
{
"sm plugins load disabled/zh_respawn_stop"
}
"de_dust2"
{
"sm plugins load disabled/zh_respawn_stop"
}
"zm_cbble_b3"
{
"sm plugins load disabled/zh_respawn_stop"
}
"zm_4way_tunnel_v2"
{
"sm plugins load disabled/zh_respawn_stop"
}
"de_cbble"
{
"sm plugins load disabled/zh_respawn_stop"
}
"de_inferno"
{
"sm plugins load disabled/zh_respawn_stop"
}
"de_prodigy"
{
"sm plugins load disabled/zh_respawn_stop"
}
"zm_lila_panic"
{
"sm plugins load disabled/zh_respawn_stop"
}
"cs_compound"
{
"sm plugins load disabled/zh_respawn_stop"
}
"cs_italy"
{
"sm plugins load disabled/zh_respawn_stop"
}
"de_tides"
{
"sm plugins load disabled/zh_respawn_stop"
}
"de_port"
{
"sm plugins load disabled/zh_respawn_stop"
}
"ze_boatescape6_remix_fix2"
{
"sm plugins load disabled/ze_boatescape6_remix_fix2"
}
"ze_a_e_s_t_h_e_t_i_c_v1_1s"
{
"sm plugins load disabled/vscript_Aesthetic"
}
"ze_icecap_escape_act2_b3s_fix"
{
"sm plugins load disabled/ze_icecap_escape_act2_b3s_fix"
}
"ze_dreamin_v2_3s"
{
"sm plugins load disabled/vscript_ze_dreamin_v2"
}
"lanif_epacseniart_ez"
{
"sm plugins unload FixLagCompensation"
}
"ze_ffxii_westersand_v7_2"
{
"sm plugins unload zr_repeatkill"
}
"ze_jjba_v5fs"
{
"sm plugins load disabled/vscript_JJBA"
}
"ze_SCP_Escape_v02"
{
"sm plugins load disabled/SCP"
}
"ze_kitchen_v2s"
{
"sm plugins load disabled/vscript_Kitchen"
}
"ze_squidzer_final_v3_a"
{
"sm plugins load disabled/ze_squidzer"
}
"ze_notredame_v1_3"
{
"sm plugins load disabled/ItemSpawn"
}
"ze_moltentemple_p1t2"
{
"sm plugins load disabled/molten_blessings"
}
"ze_ffxii_westersand_v8zeta1"
{
"sm plugins unload zr_repeatkill"
}
"ze_trainescape_final"
{
"sm plugins unload FixLagCompensation"
}
"ze_silent_hill_2_illusion_kn1"
{
"sm plugins unload LagCompensation"
}
"ze_ffvii_mako_reactor_v5_3"
{
"sm plugins load disabled/MakoVote"
"sm plugins load disabled/ze_ffvii_mako_reactor_v5_3"
}
"ze_scp_v3"
{
"sm plugins unload LagCompensation"
}
"ze_dreamin_v3_1_css"
{
"sm plugins load disabled/vscript_ze_dreamin_v3"
}
"ze_totally_new_wester"
{
"sm plugins unload zr_repeatkill"
}
"ze_geometric_v1_4s"
{
"sm plugins load disabled/vscripts_Geometric"
}
"ze_atix_helicopter_i3d_c1"
{
"sm plugins unload momsurffix2"
}
"ze_inboxed_v1_5"
{
"sm plugins unload zr_repeatkill"
}
"ze_paranoid_rezurrection_v11_9"
{
"sm plugins unload Extend"
}
"ze_harry_potter_v2_1"
{
"sm plugins unload WeaponEquip"
}
"ze_dark_souls_ptd_v0_2"
{
"sm plugins load disabled/PlayerVisibility"
}
"ze_jump_king_b3"
{
"sm plugins load disabled/jump_king_plus"
}
"ze_taboo_carnation_v2"
{
"sm plugins unload WeaponEquip"
}
"ze_stardust_battleground_v1"
{
"sm plugins unload SaveLevel"
"sm plugins load disabled/VScript_ze_stardust_battleground"
}
"ze_stardust_battleground_m1"
{
"sm plugins unload SaveLevel"
"sm plugins load disabled/VScript_ze_stardust_battleground"
}
"ze_retribution_rc"
{
"sm plugins unload zr_repeatkill"
}
"ze_harry_potter_v1_3"
{
"sm plugins unload WeaponEquip"
}
"ze_moltentemple_a5"
{
"sm plugins load disabled/molten_blessings"
}
"ze_knife_fun_fix"
{
"sm plugins unload Extend"
"sm plugins load disabled/UNLOZE_KnifeMadness"
"sm plugins unload PlayerVisibility"
"sm plugins unload KnifeBan"
}
"zr_mountain_river_v2c"
{
"sm plugins unload Extend"
"sm plugins load disabled/UNLOZE_KnifeMadness"
"sm plugins unload PlayerVisibility"
"sm plugins unload KnifeBan"
}
"ze_knife_fun_unloze_winter"
{
"sm plugins unload Extend"
"sm plugins load disabled/UNLOZE_KnifeMadness"
"sm plugins unload PlayerVisibility"
"sm plugins unload KnifeBan"
}
"ze_knife_fun_winter_collab_v1"
{
"sm plugins unload Extend"
"sm plugins load disabled/UNLOZE_KnifeMadness"
"sm plugins unload PlayerVisibility"
"sm plugins unload KnifeBan"
}

View File

@ -0,0 +1,64 @@
#pragma semicolon 1
#define PLUGIN_AUTHOR "jenz"
#define PLUGIN_VERSION "1.0"
#include <sourcemod>
public Plugin myinfo =
{
name = "plugin_loader_unloader",
author = PLUGIN_AUTHOR,
description = "prevents slow map switches by loading and unloading plugins after map switching",
version = PLUGIN_VERSION,
url = "www.unloze.com"
};
public void OnMapStart()
{
CreateTimer(15.0, init_plugins);
}
public Action init_plugins(Handle hTimer)
{
char sConfigFile[PLATFORM_MAX_PATH];
BuildPath(Path_SM, sConfigFile, sizeof(sConfigFile), "configs/plugins_loading_unloading.cfg");
if(!FileExists(sConfigFile))
{
LogMessage("Could not find config: \"%s\"", sConfigFile);
return Plugin_Handled;
}
char map[PLATFORM_MAX_PATH];
GetCurrentMap(map, PLATFORM_MAX_PATH);
//for some reason keyvalues did not play along so just reading file instead.
new Handle:fileHandle = OpenFile(sConfigFile, "r" );
char lineBuffer[256];
bool finished_globals = false;
bool found_nextmap = false;
while( !IsEndOfFile( fileHandle ) && ReadFileLine( fileHandle, lineBuffer, sizeof( lineBuffer ) ) )
{
TrimString( lineBuffer );
ReplaceString(lineBuffer, sizeof(lineBuffer), "\"", "");
if (StrContains(lineBuffer, "sm plugins") != -1 && !finished_globals)
{
ServerCommand(lineBuffer);
}
if (StrEqual(lineBuffer, "}") && !finished_globals)
{
finished_globals = true;
}
if (StrEqual(lineBuffer, map))
{
found_nextmap = true;
}
if (StrContains(lineBuffer, "sm plugins") != -1 && found_nextmap)
{
ServerCommand(lineBuffer);
}
if (StrEqual(lineBuffer, "}") && found_nextmap)
{
break; //we found our specific next map and finished all plugins loading/unloading.
}
}
CloseHandle( fileHandle );
return Plugin_Handled;
}