PDA

View Full Version : Savelines =o


fowlplay4
07-06-2006, 10:05 PM
Okay, so I am trying to save lines but this isnt really working. Help Appreciated.
Edit: Fixed for anyone who may have this problem in the future!

function onActionServerSide() {
if (params[0]=="savelines") {
file = params[1]; //levels/test/text.txt
contents = params[2]; //{"test1=3","lol wtf","howdy partner"};
contents.saveLines(file,0);
player.chat = "Saved Contents to" SPC file;
// Your chat on player would say, Saved Contents to levels/test/text.txt
}
}

//#CLIENTSIDE
function onCreated() {
temp.path = "levels/test/text.txt";
temp.lines = {"test1=3","lol wtf","howdy partner"};
triggeraction(player.x,player.y,"serverside",name,"savelines",temp.path,temp.lines);
}

Yen
07-06-2006, 10:27 PM
array.savelines(path, true/false)

Array is the array it saves as text.
Path is the path to the file.
true/false is either append or overwrite, not sure.. I'd assume append.

I'm pretty sure you have to put arrays into new variables when you pass them.
You might wanna try something like...
lines = params[2];

fowlplay4
07-06-2006, 10:43 PM
^^ There we go got it working!