Author Topic: Loading a server-sided save onto a dedicated server  (Read 2975 times)

Before someone tells me to use
Code: [Select]
schedule(1000,0,serverDirectSaveFileLoad,"Saves/Slate/Lava Trench Wars "@$mapVers@".bls", 3, "", 0, 1);I should like to point out that's what I am already doing. This gives the following error in the dedicated.bat console:
Code: [Select]
ERROR: ServerLoadSaveFile_Tick() - $LoadingBricks_BrickGroup does not exist!
BackTrace: ->ServerLoadSaveFile_Tick
As best I can infer from this, ServerLoadSaveFile_Tick() isn't working in the way it's supposed to.

If anyone knows how to make this work, then I would be quite thankful.

you're trying to use $LoadingBricks_BrickGroup but it doesn't exist

you're trying to use $LoadingBricks_BrickGroup but it doesn't exist
obviously
This happens to me as well. I would also like to know what I'm doing wrong.

post the script

it would probably help

post the script

it would probably help
That pretty much is the script

It loads bricks, well, theoretically
Code: [Select]
schedule(1000,0,serverDirectSaveFileLoad,"Saves/Slate/Lava Trench Wars "@$mapVers@".bls", 3, "", 0, 1);
schedule(1000,0,echo,"Loading bricks (Hopefully)");

why are you using a global variable

not that there's a problem with that

but why

I had this problem because my script loaded the bricks right when the mission started (which should work). However, you must give it more time in the schedule (10-20 seconds I think)

Ahh, so that's the problem! I was doing the same thing too   .   .   .

Thanks a lot! :D


Edit: Nope, that did not fix the problem.
« Last Edit: October 04, 2010, 10:34:51 PM by Xalos »

Make sure that you call the parent BEFORE the load. If that does not work, increase the delay until it works.

This isn't a package or a function that's overwriting anything. It's just a schedule running a function.

I thought you said it started with the server? If possible, post the code please.

Server_ServerMods.zip/server.cs
Code: [Select]
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");
}

Server_MyMods/modl.cs
Code: [Select]
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.

I tag commented lines to explain the problem for future reference.

O yeah, $LoadingBricks_BrickGroup doesn't exist until a client joins the game. I wonder if you could create it manually?

Hmm, maybe I should add the following:
Code: [Select]
$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");

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.