View Single Post
  #22  
Old 03-04-2011, 07:15 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
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.filename0);
  }
}

//#CLIENTSIDE

function onActionClientSide() {
  if (
params[0] == "load") {
    
TestWindowML.setlines(params[1]);
  }
}

function 
onCreated() {
  new 
GuiWindowCtrl("TestWindow") {
    
100;
    
100;
    
width 300;
    
height 300;
    new 
GuiScrollCtrl("TestWindowScroll") {
      
4;
      
20;
      
width 296;
      
height 280;
      new 
GuiMLTextEditCtrl("TestWindowML") {
        
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 "";
  }

Attached Files
File Type: txt test.txt (36 Bytes, 112 views)
__________________
Quote:
Reply With Quote