This works just fine, the file will look messed up (all on one line) in regular Windows Notepad (Terriblepad) instead use Wordpad or Notepad++
PHP Code:
function onActionServerSide() {
temp.filename = "cartridge/test.txt";
if (params[0] == "load") {
temp.lines.loadlines(temp.filename);
player.triggerclient(this.name, "load", temp.lines);
}
else if (params[0] == "save") {
params[1].savelines(temp.filename, 0);
}
}
//#CLIENTSIDE
function onActionClientSide() {
if (params[0] == "load") {
TestWindowML.setlines(params[1]);
}
}
function onCreated() {
new GuiWindowCtrl("TestWindow") {
x = 100;
y = 100;
width = 300;
height = 300;
new GuiScrollCtrl("TestWindowScroll") {
x = 4;
y = 20;
width = 296;
height = 280;
new GuiMLTextEditCtrl("TestWindowML") {
x = y = 2;
width = 280;
height = 280;
}
}
}
triggerserver("gui", name, "load");
}
function ChatBar.onAction() {
if (ChatBar.text == "/save") {
temp.lines = TestWindowML.getlines();
triggerserver("gui", this.name, "save", temp.lines);
ChatBar.text = "";
}
}