Thread: Doesn't seem to save or read to playerfile.

Results 1 to 3 of 3
  1. #1 Doesn't seem to save or read to playerfile. 
    Donator

    Join Date
    Aug 2014
    Posts
    13
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Code:
    if (playerCommand.startsWith("give")) {
    try {	
    String[] args = playerCommand.split(" ");
    
    for(int i = 0; i < Config.MAX_PLAYERS; i++) {
    if(Server.playerHandler.players[i] != null) {
    if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(args[1])) {
    int amountpoints = Integer.parseInt(args[2]);
    int oldpoints = c.donPoints;
    int newpoints = amountpoints + oldpoints;
    c.donPoints = newpoints;
    							((Client) Server.playerHandler.players[i]).getPA()
    									.requestUpdates();
    } 
    }
    }
    } catch(Exception e) {
    c.sendMessage("Player must be offline.");
    }
    }
    This, is my ::give command for donator points.
    It works, but it's temporary doesn't write to the playerfile.

    Can anyone help me?
    also, how do i read from it for my variable of donorpoints?
    Reply With Quote  
     

  2. #2  
    Android/Java/Meteor/Node
    Orbyt's Avatar
    Join Date
    Oct 2013
    Posts
    335
    Thanks given
    25
    Thanks received
    21
    Rep Power
    11
    Quote Originally Posted by Expire View Post
    Code:
    if (playerCommand.startsWith("give")) {
    try {	
    String[] args = playerCommand.split(" ");
    
    for(int i = 0; i < Config.MAX_PLAYERS; i++) {
    if(Server.playerHandler.players[i] != null) {
    if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(args[1])) {
    int amountpoints = Integer.parseInt(args[2]);
    int oldpoints = c.donPoints;
    int newpoints = amountpoints + oldpoints;
    c.donPoints = newpoints;
    							((Client) Server.playerHandler.players[i]).getPA()
    									.requestUpdates();
    } 
    }
    }
    } catch(Exception e) {
    c.sendMessage("Player must be offline.");
    }
    }
    This, is my ::give command for donator points.
    It works, but it's temporary doesn't write to the playerfile.

    Can anyone help me?
    also, how do i read from it for my variable of donorpoints?
    First, this:
    Code:
    int oldpoints = c.donPoints;
    int newpoints = amountpoints + oldpoints;
    c.donPoints = newpoints;
    Could be shortened to:
    Code:
    c.donPoints += amountpoints;
    For writing to player files, use a BufferedWriter. Be sure there is a donator points variable already set up.

    Reply With Quote  
     

  3. #3  
    Donator

    Join Date
    Aug 2014
    Posts
    13
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Thanks, i've used this:

    http://www.rune-server.org/runescape...points-pi.html

    but when i try to use the variable: donPoints, it resets on log out.

    Any help, also how do i make the command write to the playerfile thanks!
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. To be or not to be... stable
    By Glabay in forum RS 503+ Client & Server
    Replies: 72
    Last Post: 03-12-2009, 09:04 PM
  2. Replies: 14
    Last Post: 02-06-2009, 05:40 PM
  3. To be or not to be?
    By Cast_ in forum Humor
    Replies: 1
    Last Post: 11-04-2008, 07:09 PM
  4. to be or not to be// first in a while
    By Joe in forum Showcase
    Replies: 5
    Last Post: 03-21-2008, 02:36 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •