Blockland Forums > Modification Help
Loading a server-sided save onto a dedicated server
Greek2me:
I thought you said it started with the server? If possible, post the code please.
Xalos:
Server_ServerMods.zip/server.cs
--- Code: ---function servercmdloadServerMod(%client,%name)
{
if(%client.isSuperAdmin)
{
if(isFile("Add-Ons/Server_MyMods/mod"@%name@".cs"))
{
exec("Add-Ons/Server_MyMods/mod"@%name@".cs");
%client.chatMessage("<color:0000ff>Mod "@%name@" loaded.");
}
else
{
%client.chatMessage("<color:ff0000>Mod "@%name@" was not found!");
}
}
else
{
%client.chatMessage("<color:ff0000>You need to be at least a super admin to use this command!");
}
}
if(isFile("Add-Ons/Server_MyMods/modl.cs"))
{
exec("Add-Ons/Server_MyMods/modl.cs");
}
--- End code ---
Server_MyMods/modl.cs
--- Code: ---function run(%name)
{
exec("Add-Ons/Server_MyMods/mod"@%name@".cs");
}
run("1a");
run("1b");
run("xalbot");
run("chatfaq");
run("shutdown");
//run("spectate"); *Broken: You can still use weapons if you discard them before spectating or if someone gives you their weapons.
run("kill");
run("setCol");
run("5");
//$mapVers = "4.2b2";
//schedule(15000,0,serverDirectSaveFileLoad,"Saves/Slate/Lava Trench Wars "@$mapVers@".bls", 3, "", 0, 1); *Doesn't seem to want to work right, even though the file exists and there's plenty of time from the start of the server to when it's called.
--- End code ---
I tag commented lines to explain the problem for future reference.
Greek2me:
O yeah, $LoadingBricks_BrickGroup doesn't exist until a client joins the game. I wonder if you could create it manually?
Xalos:
Hmm, maybe I should add the following:
--- Code: ---$mapVers = "4.2b2";
package onJoin
{
function GameConnection::AutoAdminCheck(%client)
{
if($loaded != 1)
{
schedule(15000,0,serverDirectSaveFileLoad,"Saves/Slate/Lava Trench Wars "@$mapVers@".bls", 3, "", 0, 1);
$loaded = 1;
}
return Parent::AutoAdminCheck(%client);
}
};
activatePackage("onJoin");
--- End code ---
Greek2me:
That would work, but what I'd do is deactivate the package instead of having it check whether to load the file every time someone joins.