View Single Post
  #7  
Old 03-13-2010, 01:44 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Imperialistic View Post
I noticed an error that I didn't want to happen..

When I load all of the variables from the .txt file, it only loads the last var entered, any clue why?

=EDIT= Can a mod please move this thread out of the Code Gallery?
You're only using one name. If you want multiple slots you'd want something like this

PHP Code:
function onActionServerSide(cmdslotmsg) {
  if (
cmd == "save") {
    
temp.vars.loadVars("data/" player.account ".txt");
    
vars.(@ slot) = msg;
    
vars.saveVars("data/" player.account ".txt"false);
  } else if (
cmd == "load") {
    
temp.vars.loadVars("data/"player.account ".txt");
    
    if (
vars.(@ slot) != null) {
      
player.chat "You don't have a message with the name '" slot "'!";
    } else {
      
player.chat slot ": " vars.(@ slot);
    }
  }
}

//#CLIENTSIDE
function onPlayerChats() {
  if (
player.chat.starts("/load ")) {
    
temp.load player.chat.substring(6).trim();
    
triggerServer("gui"this.name"load"load);
  } else if (
player.chat.starts("/save ")) {
    
temp.tokens player.chat.tokenize();
    
temp.msg player.chat.substring(tokens[0].length() + tokens[1].length() + 2).trim();
    
    
triggerServer("gui"this.name"save"tokens[1], msg);
  }

Notice how it uses a different variable for each slot.
__________________
Reply With Quote