Closed DanishSoup closed 1 year ago
This is a result of a coding mistake done in the original FF2 subplugin include. There is no way to fix this through the main plugin and all subplugins using this include need to be compiled to fix this issue.
void GetThisPluginName()
{
char pluginName[80];
GetPluginFilename(INVALID_HANDLE, pluginName, sizeof(pluginName));
int finalPluginName = -1;
for(;;)
{
int forwardSlash = StrContains(pluginName[finalPluginName+1], "/");
int backwardSlash = StrContains(pluginName[finalPluginName+1], "\\");
if((backwardSlash<forwardSlash && backwardSlash!=-1) || forwardSlash==-1)
{
if(backwardSlash == -1)
break;
+
+ if(finalPluginName == -1)
+ finalPluginName = 0;
+
+ finalPluginName += backwardSlash;
- finalPluginName = backwardSlash;
}
else if((forwardSlash<backwardSlash && forwardSlash!=-1) || backwardSlash==-1)
{
if(forwardSlash == -1)
break;
+
+ if(finalPluginName == -1)
+ finalPluginName = 0;
+
+ finalPluginName += forwardSlash;
- finalPluginName = forwardSlash;
}
}
strcopy(this_plugin_name, sizeof(this_plugin_name), pluginName[finalPluginName+1]);
}
This is a result of a coding mistake done in the original FF2 subplugin include. There is no way to fix this through the main plugin and all subplugins using this include need to be compiled to fix this issue.
void GetThisPluginName() { char pluginName[80]; GetPluginFilename(INVALID_HANDLE, pluginName, sizeof(pluginName)); int finalPluginName = -1; for(;;) { int forwardSlash = StrContains(pluginName[finalPluginName+1], "/"); int backwardSlash = StrContains(pluginName[finalPluginName+1], "\\"); if((backwardSlash<forwardSlash && backwardSlash!=-1) || forwardSlash==-1) { if(backwardSlash == -1) break; + + if(finalPluginName == -1) + finalPluginName = 0; + + finalPluginName += backwardSlash; - finalPluginName = backwardSlash; } else if((forwardSlash<backwardSlash && forwardSlash!=-1) || backwardSlash==-1) { if(forwardSlash == -1) break; + + if(finalPluginName == -1) + finalPluginName = 0; + + finalPluginName += forwardSlash; - finalPluginName = forwardSlash; } } strcopy(this_plugin_name, sizeof(this_plugin_name), pluginName[finalPluginName+1]); }
I seem to still be having problems when trying to load legacy plugins through another directory. I applied both of the freak_fortress_2_subplugins.inc edits provided and I would get this error in console
L 07/29/2023 - 11:28:01: [SM] Blaming: disabled/freaks/ff2_phatrages.smx L 07/29/2023 - 11:28:01: [SM] Call stack trace: L 07/29/2023 - 11:28:01: [SM] [1] Line 9, /home/danish/Downloads/freak_fortress_2/addons/sourcemod/scripting/include/freak_fortress_2_subplugin.inc::GetThisPluginName L 07/29/2023 - 11:28:01: [SM] [2] Line 40, /home/danish/Downloads/freak_fortress_2/addons/sourcemod/scripting/include/freak_fortress_2_subplugin.inc::OnPluginStart L 07/29/2023 - 11:28:01: [SM] [4] ServerExecute L 07/29/2023 - 11:28:01: [SM] [5] Line 3116, freak_fortress_2/bosses.sp::EnableSubplugins L 07/29/2023 - 11:28:01: [SM] [6] Line 1602, freak_fortress_2/bosses.sp::Bosses_CreateFromConfig L 07/29/2023 - 11:28:01: [SM] [7] Line 1576, freak_fortress_2/bosses.sp::Bosses_CreateFromSpecial L 07/29/2023 - 11:28:01: [SM] [8] Line 250, freak_fortress_2/gamemode.sp::Gamemode_RoundSetup L 07/29/2023 - 11:28:01: [SM] [9] Line 362, freak_fortress_2/dhooks.sp::DHook_RoundRespawn [SM] Plugin disabled/freaks/ff2_phatrages.smx failed to load: Error detected in plugin startup (see error logs). [SM] Loaded plugin disabled/freaks/ff2r_epic_abilities.smx successfully. [SM] Loaded plugin disabled/freaks/ff2r_menu_abilities.smx successfully. [SM] Loaded plugin disabled/freaks/ff2r_tfcond.smx successfully. [SM] Loaded plugin disabled/freaks/ff2r_default_abilities.smx successfully.
Before the boss round starts, it would hang up for a few seconds but the plugin would refuse to work
Description
In issue #47 a request had been made to make sub-plugins load/unload in "freaks" which would be changed to another directory like "disabled". But when trying to do set "ff2_plugin_subplugins" to a directory inside a directory ("disabled/freaks" or "freaks/disabled"), the server crashes with many of the sub-plugins failing to load and being blamed/
Reproduce
Steps to reproduce the behavior:
Media
Example of errors: L 07/21/2023 - 19:58:38: [SM] Blaming: disabled/freaks/bill_abilities.smx L 07/21/2023 - 19:58:38: [SM] Call stack trace: L 07/21/2023 - 19:58:38: [SM] [1] Line 11, C:\Users\RavensBro\Desktop\knights of god\source mod and meta mod\sourcemod-1.5.1-hg3914-windows-ff2\addons\sourcemod\scripting\include\freak_fortress_2_subplugin.inc::GetThisPluginName L 07/21/2023 - 19:58:38: [SM] [2] Line 33, C:\Users\RavensBro\Desktop\knights of god\source mod and meta mod\sourcemod-1.5.1-hg3914-windows-ff2\addons\sourcemod\scripting\include\freak_fortress_2_subplugin.inc::OnPluginStart L 07/21/2023 - 19:58:38: [SM] [4] ServerExecute L 07/21/2023 - 19:58:38: [SM] [5] Line 3116, freak_fortress_2/bosses.sp::EnableSubplugins L 07/21/2023 - 19:58:38: [SM] [6] Line 1602, freak_fortress_2/bosses.sp::Bosses_CreateFromConfig L 07/21/2023 - 19:58:38: [SM] [7] Line 1576, freak_fortress_2/bosses.sp::Bosses_CreateFromSpecial L 07/21/2023 - 19:58:38: [SM] [8] Line 250, freak_fortress_2/gamemode.sp::Gamemode_RoundSetup L 07/21/2023 - 19:58:38: [SM] [9] Line 362, freak_fortress_2/dhooks.sp::DHook_RoundRespawn [SM] Plugin disabled/freaks/bill_abilities.smx failed to load: Error detected in plugin startup (see error logs).
Environment
Other Information
The server uses some legacy sub-plugins and new rewrite sub-plugins