Thread: [508] Player Save Problem

Results 1 to 6 of 6
  1. #1 [508] Player Save Problem 
    Registered Member
    Join Date
    Feb 2012
    Posts
    11
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Hi,

    I'm trying to set-up a command where I can promote people to VIP, and for some reason it doesn't seem to be working as expected.

    Here's the code:

    Code:
                    if (cmd[0].equals("vip") && p.rights >= 3) {
                        String person = playerCommand.substring((playerCommand.indexOf(" ") + 1));
                        Player p2 = Engine.players[Engine.getIdFromName(person)];
                        if (p2 != null) {
                            p.frames.sendMessage(p, "The following user " + p2.username + "has been promoted to VIP.");
                            p2.frames.sendMessage(p2, "Thank you for purchasing Server VIP!");
                            p2.frames.sendMessage(p2, "Your exclusive VIP permissions have been activated. Enjoy.");
                            p2.vip = 1;
                            p2.updateReq = true;
                        }
                    }
    It doesn't seem to be saving in the profile correctly at all.
    This seems to be the same for the starter too, so I seem to be getting the starter everytime I login

    Any help?

    Thanks
    Reply With Quote  
     

  2. #2  
    Community Veteran


    Arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,950
    Thanks given
    210
    Thanks received
    349
    Rep Power
    1376
    Have you even added it to load and saving?


    "A fail act is something you do regular, but a dumb act is something you can learn from"
    Spoiler for Problem?:
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Feb 2012
    Posts
    11
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by arch337 View Post
    Have you even added it to load and saving?
    Yep.

    Code:
                    else if (line.startsWith("vip:"))
                        p.vip = Integer.parseInt(line.substring(7));
    and

    Code:
            stream.writeString("vip:" + p.vip);
    and I'm pretty sure it doing something since I can make myself VIP by using:

    Code:
                if (p.username.equals("sometest")) {
                    p.rights = 3;
                    p.vip = 1;
                }
    It's just that the command I'm using isn't functioning correctly.
    Reply With Quote  
     

  4. #4  
    Registered Member
    AndyJay's Avatar
    Join Date
    Jun 2008
    Posts
    1,285
    Thanks given
    38
    Thanks received
    48
    Rep Power
    84
    You're doing it wrong This number is incorrect..

    p.vip = Integer.parseInt(line.substring(7));

    Basically it is the amount of characters that you place inside else if (line.startsWith("vip:")), so it should be p.vip = Integer.parseInt(line.substring(4)); and not 7 I'm guessing your starter is the same so just check it.


    Reply With Quote  
     

  5. #5  
    Community Veteran


    Arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,950
    Thanks given
    210
    Thanks received
    349
    Rep Power
    1376
    Code:
                   
     else if (line.startsWith("vip:"))
                        p.vip = Integer.parseInt(line.substring(7));
    should be
    Code:
                    else if (line.startsWith("vip:"))
                        p.vip = Integer.parseInt(line.substring(4));
    That's probely why it won't save, cause you have 7 lines it should save it as but it only got 4 lines.


    "A fail act is something you do regular, but a dumb act is something you can learn from"
    Spoiler for Problem?:
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Feb 2012
    Posts
    11
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Oh, I see, thanks guys - I'll keep that in mind in the future
    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. Player looks will not save?
    By neva doubted in forum Help
    Replies: 3
    Last Post: 12-27-2011, 03:15 AM
  2. 508 player trade problem!
    By rockarocka in forum Help
    Replies: 0
    Last Post: 12-01-2011, 02:49 PM
  3. [PI] Player save - problem
    By Magic in forum Help
    Replies: 4
    Last Post: 09-29-2011, 04:18 AM
  4. [PI] Player-save
    By Hydroph in forum Help
    Replies: 8
    Last Post: 05-20-2011, 06:28 AM
  5. [508]Player Save Gone Chinese[508]
    By HyreScape in forum Help
    Replies: 9
    Last Post: 04-20-2009, 04:53 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •