Author Topic: Save command doesn't work. Please help.  (Read 1169 times)

I am making a save command where you type /Save SaveNameHere.  I have the following code, but it doesn't work.
(This is a client-sided mod)

Code: [Select]
package Saver
{
function clientcmdSave(%client, %name)
{
saveBricks("saves/saveCommand/" @ %name @ ".bls", 1, 1);
messageClient(%client,'',"Saved" SPC $server::Brickcount SPC "brick(s) to" SPC %name @ ".bls.");
}
};
function gameconection::onClientSpawn(%client)
{
activatePackage(Saver);
parent::onClientSpawn(%client);
}

Please help.

Content copyright © 2010 MJ Studios LLC., and is protected from copying.

I am making a save command where you type /Save SaveNameHere.  I have the following code, but it doesn't work.
(This is a client-sided mod)

Code: [Select]
package Saver
{
function clientcmdSave(%client, %name)
{
saveBricks("saves/saveCommand/" @ %name @ ".bls", 1, 1);
messageClient(%client,'',"Saved" SPC $server::Brickcount SPC "brick(s) to" SPC %name @ ".bls.");
}
};
function gameconection::onClientSpawn(%client)
{
activatePackage(Saver);
parent::onClientSpawn(%client);
}

Please help.

Content copyright © 2010 MJ Studios LLC., and is protected from copying.
WHY? WHY IN THE WORLD NO ONE IS GOING TO STEAL THIS STUFF GOD
Anyway
Code: [Select]
function clientcmdSave(%client, %name)
{
saveBricks("saves/saveCommand/" @ %name @ ".bls", 1, 1);
messageClient(%client,'',"Saved" SPC $server::Brickcount SPC "brick(s) to" SPC %name @ ".bls.");
}
You can't do a client sided command to a slash unless you have Truce's thing that allows that.

Why did you parent clientcmdsave? And why didn't you parent gameconection::onClientSpawn?
Code: [Select]
function clientcmdSave(%client, %name)
{
saveBricks("saves/saveCommand/" @ %name @ ".bls", 1, 1);
messageClient(%client,'',"Saved" SPC $server::Brickcount SPC "brick(s) to" SPC %name @ ".bls.");
}

package Saver
{
function gameconection::onClientSpawn(%client)
{
activatePackage(Saver);
parent::onClientSpawn(%client);
}
};

Several problems
clientCmds can't be called through a slash command unless you have another script
Don't package the client command
If this is client sided, why is there a modified serverSide method? Just replace that entire part with activatePackage. Or at least you would if you needed a package. Which you don't.
messageClient is a serverside function. Use NewChatSO.addLine

Content copyright © 2010 MJ Studios LLC., and is protected from copying.
No one is going to steal something that doesn't work.

Cna anyone fix this and give me the right code?

Another problem I noticed : clientCmds don't have a %client argument in the declaration, only when the server calls it.

Code: [Select]
function clientcmdSave(%name)
{
saveBricks("saves/saveCommand/" @ %name @ ".bls", 1, 1);
NewChatHud_AddLine("Saved to" @ %name @ ".bls");
}
You still won't be able call it with a /command though
I'm not sure if you can get the brickcount clientside.

Unless Truce's addon requires the command to be a clientCmd, you can just name it save instead of clientcmdsave
« Last Edit: August 10, 2010, 12:49:02 PM by Headcrab Zombie »


Content copyright © 2010 MJ Studios LLC., and is protected from copying.
Why is it that there isn't any documentation for a copyright under this name, and why in the hell would you try and copyright 13 lines of code.
« Last Edit: August 10, 2010, 01:10:42 PM by Desolation »

I KNOW the problem, just, can anyone FIX this, in a way that it'll work.

You don't even have rights to this code anyway. Anything you make for this game is badspot's.


you people aren't helping.
Stolen from getHex
Code: [Select]
package stupid
{
function NMH_Type::Send(%this)
{
if(%this.getValue() $= "/stupid")
{
NewChatSO.addLine("\c6hi.");
canvas.popDialog(NewMessageHud);
return;
}
Parent::Send(%this);
}
};

you people aren't helping.
Stolen from getHex
Code: [Select]
package stupid
{
function NMH_Type::Send(%this)
{
if(%this.getValue() $= "/stupid")
{
NewChatSO.addLine("\c6hi.");
canvas.popDialog(NewMessageHud);
return;
}
Parent::Send(%this);
}
};

How does THAT help!??!

saveBricks is a server-sided command, as mentioned by kronos.

saveBricks is a server-sided command, as mentioned by kronos.
No, but serverCmdSave, gameconection::onClientSpawn, and messageClient are.
Edit: Wait, gameconection::onClientSpawn isn't even a function.

I thought saveBricks is the server-sided function included with RTB.

Doesn't matter anyway, you're still mixing server-sided code with client-sided code.