added addon scripts for servers

This commit is contained in:
Bitl 2019-12-05 07:07:12 -07:00
parent 28e6c1b8ab
commit 67582df4e7
6 changed files with 16 additions and 8 deletions

View File

@ -18,7 +18,7 @@ namespace NovetusCMD
public Arguments(string[] Args) public Arguments(string[] Args)
{ {
Parameters = new StringDictionary(); Parameters = new StringDictionary();
Regex Spliter = new Regex(@"^-{1,2}|^/|=|:", Regex Spliter = new Regex(@"^-{1,2}|^/|=",
RegexOptions.IgnoreCase | RegexOptions.Compiled); RegexOptions.IgnoreCase | RegexOptions.Compiled);
Regex Remover = new Regex(@"^['""]?(.*?)['""]?$", Regex Remover = new Regex(@"^['""]?(.*?)['""]?$",

View File

@ -258,6 +258,12 @@ namespace NovetusCMD
GlobalVars.PlayerLimit = Convert.ToInt32(CommandLine["maxplayers"]); GlobalVars.PlayerLimit = Convert.ToInt32(CommandLine["maxplayers"]);
} }
} }
if (CommandLine["script"] != null)
{
GlobalVars.AddonScriptPath = CommandLine["script"].Replace(@"\", @"\\");
ConsolePrint("NovetusCMD detected a custom script. Loading " + GlobalVars.AddonScriptPath, 4);
}
} }
if (!OverrideINI) if (!OverrideINI)
@ -314,7 +320,7 @@ namespace NovetusCMD
{ {
if (!GlobalVars.FixScriptMapMode) if (!GlobalVars.FixScriptMapMode)
{ {
args = quote + mapfile + "\" -script \"dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptGenerator.ScriptType.Server, GlobalVars.SelectedClient) + quote + (no3d ? " -no3d" : ""); args = quote + mapfile + "\" -script \"dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptGenerator.ScriptType.Server, GlobalVars.SelectedClient) + "; " + (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? "dofile('" + GlobalVars.AddonScriptPath + "');" : "") + quote + (no3d ? " -no3d" : "");
} }
else else
{ {

View File

@ -55,7 +55,7 @@ public class ClientScript
return "dofile('" + luafile + "'); _G.CSConnect(" + GlobalVars.UserID + ",'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'" + GlobalVars.PlayerName + "'," + GlobalVars.loadtext + "," + md5s + ",'" + GlobalVars.PlayerTripcode + "')"; return "dofile('" + luafile + "'); _G.CSConnect(" + GlobalVars.UserID + ",'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'" + GlobalVars.PlayerName + "'," + GlobalVars.loadtext + "," + md5s + ",'" + GlobalVars.PlayerTripcode + "')";
} }
} else if (type == ScriptGenerator.ScriptType.Server) { } else if (type == ScriptGenerator.ScriptType.Server) {
return "dofile('" + luafile + "'); _G.CSServer(" + GlobalVars.RobloxPort + "," + GlobalVars.PlayerLimit + "," + md5s + ")"; return "dofile('" + luafile + "'); _G.CSServer(" + GlobalVars.RobloxPort + "," + GlobalVars.PlayerLimit + "," + md5s + "); " + (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? "dofile('" + GlobalVars.AddonScriptPath + "');" : "");
} else if (type == ScriptGenerator.ScriptType.Solo) { } else if (type == ScriptGenerator.ScriptType.Solo) {
if (GlobalVars.UsesPlayerName == true && GlobalVars.UsesID == true) { if (GlobalVars.UsesPlayerName == true && GlobalVars.UsesID == true) {
return "dofile('" + luafile + "'); _G.CSSolo(" + GlobalVars.UserID + ",'" + GlobalVars.PlayerName + "'," + GlobalVars.sololoadtext + ")"; return "dofile('" + luafile + "'); _G.CSSolo(" + GlobalVars.UserID + ",'" + GlobalVars.PlayerName + "'," + GlobalVars.sololoadtext + ")";

View File

@ -16,7 +16,7 @@ public static class Env
#if DEBUG #if DEBUG
public static readonly bool Debugging = true; public static readonly bool Debugging = true;
#else #else
public static readonly bool Debugging = false; public static readonly bool Debugging = false;
#endif #endif
} }
@ -165,6 +165,7 @@ public static class GlobalVars
public static bool FixScriptMapMode = false; public static bool FixScriptMapMode = false;
public static bool AlreadyHasSecurity = false; public static bool AlreadyHasSecurity = false;
public static string CustomArgs = ""; public static string CustomArgs = "";
public static string AddonScriptPath = "";
//charcustom //charcustom
public static string Custom_Hat1ID_Offline = "NoHat.rbxm"; public static string Custom_Hat1ID_Offline = "NoHat.rbxm";
public static string Custom_Hat2ID_Offline = "NoHat.rbxm"; public static string Custom_Hat2ID_Offline = "NoHat.rbxm";

View File

@ -134,8 +134,9 @@ public class ScriptGenerator
"--Load Script", "--Load Script",
//scriptcontents, //scriptcontents,
"dofile('rbxasset://scripts/" + GlobalVars.ScriptName + ".lua')", "dofile('rbxasset://scripts/" + GlobalVars.ScriptName + ".lua')",
GetScriptFuncForType(type, client) GetScriptFuncForType(type, client),
); !string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? "dofile('" + GlobalVars.AddonScriptPath + "')" : ""
);
List<string> list = new List<string>(Regex.Split(code, Environment.NewLine)); List<string> list = new List<string>(Regex.Split(code, Environment.NewLine));
string[] convertedList = list.ToArray(); string[] convertedList = list.ToArray();

View File

@ -950,8 +950,8 @@ namespace NovetusLauncher
{ {
if (!GlobalVars.FixScriptMapMode) if (!GlobalVars.FixScriptMapMode)
{ {
args = quote + mapfile + "\" -script \"dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptGenerator.ScriptType.Server, GlobalVars.SelectedClient) + quote + (no3d ? " -no3d" : ""); args = quote + mapfile + "\" -script \"dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptGenerator.ScriptType.Server, GlobalVars.SelectedClient) + "; " + (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? "dofile('" + GlobalVars.AddonScriptPath + "');" : "") + quote + (no3d ? " -no3d" : "");
} }
else else
{ {
ScriptGenerator.GenerateScriptForClient(ScriptGenerator.ScriptType.Server, GlobalVars.SelectedClient); ScriptGenerator.GenerateScriptForClient(ScriptGenerator.ScriptType.Server, GlobalVars.SelectedClient);