Thread: [PI] Giving Everyone items [PI]

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1 [PI] Giving Everyone items [PI] 
    Registered Member
    Join Date
    Jan 2010
    Posts
    29
    Thanks given
    0
    Thanks received
    1
    Rep Power
    1
    My server needs some fixing with the economy with i am doing right now.

    1 Problem Once I've fixed it I am making an eConomy Reset.

    Once I've reset it. I want to give every players that are online and offline 5 items to thank them for still choosing our server. How do I do it?
    Reply With Quote  
     

  2. #2  
    Donator

    Robgob69's Avatar
    Join Date
    Oct 2010
    Age
    30
    Posts
    749
    Thanks given
    71
    Thanks received
    139
    Discord
    View profile
    Rep Power
    117
    create a new starter system.
    Code:
    if (!economyGift) {
        c.getItems().addItem(id, amount)
        economyGift = true;
    }
    have the boolean save/read from the character file.
    potatoes.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Jan 2010
    Posts
    29
    Thanks given
    0
    Thanks received
    1
    Rep Power
    1
    i got 2 errors

    Code:
    src\server\model\players\PlayerAssistant.java:2391: cannot find symbol
    symbol  : variable economyGift
    location: class server.model.players.PlayerAssistant
                                            if (!economyGift) {
                                                 ^
    src\server\model\players\PlayerAssistant.java:2399: cannot find symbol
    symbol  : variable economyGift
    location: class server.model.players.PlayerAssistant
                                            economyGift = true;
                                            ^
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    2 errors
    Press any key to continue . . .
    Reply With Quote  
     

  4. #4  
    Registered Member
    gomomo11's Avatar
    Join Date
    May 2010
    Posts
    2,383
    Thanks given
    268
    Thanks received
    196
    Rep Power
    177
    Add this somewhere

    public boolean economyGift;

    no external links without affiliate
    Reply With Quote  
     

  5. #5  
    Donator

    Robgob69's Avatar
    Join Date
    Oct 2010
    Age
    30
    Posts
    749
    Thanks given
    71
    Thanks received
    139
    Discord
    View profile
    Rep Power
    117
    Quote Originally Posted by CrazyBasterd View Post
    i got 2 errors

    Code:
    src\server\model\players\PlayerAssistant.java:2391: cannot find symbol
    symbol  : variable economyGift
    location: class server.model.players.PlayerAssistant
                                            if (!economyGift) {
                                                 ^
    src\server\model\players\PlayerAssistant.java:2399: cannot find symbol
    symbol  : variable economyGift
    location: class server.model.players.PlayerAssistant
                                            economyGift = true;
                                            ^
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    2 errors
    Press any key to continue . . .
    that was an example.... lol
    potatoes.
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Jan 2010
    Posts
    29
    Thanks given
    0
    Thanks received
    1
    Rep Power
    1
    Quote Originally Posted by gomomo11 View Post
    Add this somewhere

    Oh man, another error. What do I do?

    Code:
    src\server\model\players\PlayerAssistant.java:2180: illegal start of expression
                    public boolean economyGift;
                    ^
    1 error
    Press any key to continue . . .
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Jan 2011
    Posts
    719
    Thanks given
    156
    Thanks received
    91
    Rep Power
    32
    Here's my personal advice. Don't do an eco reset unless it's needed. Like millions of duped items etc. You will most likely lose most of your players because it will piss them off. Just make some economy updates to remove those types of things. Doing an eco reset is just taking the easy way out of the problem
    Reply With Quote  
     

  8. #8  
    Registered Member
    Join Date
    Jan 2010
    Posts
    29
    Thanks given
    0
    Thanks received
    1
    Rep Power
    1
    i really really really really x1000 + REALLY!!!! Need it. Lots of players have nulled items, someone got cheat client and gave lots of people. i REALLY REALLY NEED IT!!
    Reply With Quote  
     

  9. #9  
    #1 footwear

    Shoes's Avatar
    Join Date
    Aug 2009
    Age
    24
    Posts
    2,613
    Thanks given
    185
    Thanks received
    255
    Rep Power
    579
    RobGob pretty much gave you a full way...


    Spoiler for different picture now:
    Reply With Quote  
     

  10. #10  
    Registered Member
    Join Date
    Jan 2010
    Posts
    29
    Thanks given
    0
    Thanks received
    1
    Rep Power
    1
    It works now, but eco reset resets only a few items, and I don't know how to make it reset every single item:

    Code:
    import java.io.*;
    
    		/**
                      *@author Genc
                      * 
                      */
    public class ecoManager
    {
            public static void main(String args[])
            {
                      
                      /**
                      * Don't put notes, though. It will cause problems.
                      */
    
    		
                    int[] rares = {1050, 1051, 1057, 1053, 1054, 1055, 1056, 1057, 1058, 1042, 1048, 1038, 1046, 1044, 1040};
                    File charFolder;
                    BufferedWriter bw;
                    BufferedReader br;
                    BufferedWriter tmpwr;
                    BufferedReader tmpr;
                    boolean overwrite = false;
                    String read;
                    String dir = "Data/characters/";
                    double done = 0;
                    int percent = 0;
                    int percentRounded = 0;
    
                    charFolder = new File(dir);
    
                    if(!charFolder.exists())
                    {
                            System.out.println("The directory "+dir+" was not found.");
                            return;
                    }
                    else
                    if(charFolder.list().length == 0)
                    {
                            System.out.println("The specified directory is empty.");
                            return;
                    }
                    String file[] = charFolder.list();
                    for(String s : file)
                    {
                            try
                            {
                                    boolean isAdmin = false;
                                    File charFile = new File(dir+s);
                                    File tmpFile = new File(dir+s+".tmp");
                                    tmpFile.createNewFile();
                                    br = new BufferedReader(new FileReader(charFile));
                                    tmpwr = new BufferedWriter(new FileWriter(tmpFile, true));
    
                                    while((read = br.readLine()) != null)
                                    {
                                            if(read.contains("character-rights"))
                                            {
                                                    if(read.charAt(read.length() - 1) > '1')
                                                    {
                                                            System.out.println("Bank saved for admin "+s.substring(0, s.indexOf(".")));
                                                            isAdmin = true;
                                                    }
                                            }
    										                                        if(read.contains("memberStatus"))
                                            {
                                                    if(read.charAt(read.length() - 1) > '1')
                                                    {
                                                            System.out.println("Bank saved for donators "+s.substring(0, s.indexOf(".")));
                                                            isAdmin = true;
                                                    }
                                            }
    
                                            if(read.equals("[ITEMS]") || read.equals("[EQUIPMENT]"))
                                            {
                                                    if(!isAdmin)
                                                    {
                                                            overwrite = true;
                                                    }
                                            }
    
                                            if(read.equals("[FRIENDS]") || read.equals("[LOOK]"))
                                                    overwrite = false;
    
                                            if(!overwrite)
                                            {
                                                    tmpwr.write(read);
                                                    tmpwr.newLine();
                                            }
                                            else if(!isAdmin)
                                            {
                                                    boolean found = false;
                                                    for(int i : rares)
                                                    {
                                                            if(read.contains("\t" + i + "\t") || read.contains("\t" + (i + 1) + "\t"))
                                                            {
                                                                    found = true;
                                                            }
                                                    }
                                                    if(!found)
                                                    {
                                                            tmpwr.write(read);
                                                            tmpwr.newLine();
                                                    }
                                            }
                                    }
                                    tmpwr.flush();
                                    tmpwr.close();
                                    br.close();
    
                                    charFile.delete();
    
                                    bw = new BufferedWriter(new FileWriter(charFile, true));
                                    tmpr = new BufferedReader(new FileReader(tmpFile));
    
                                    while((read = tmpr.readLine()) != null)
                                    {
                                            bw.write(read);
                                            bw.newLine();
                                    }
    
                                    bw.flush();
                                    bw.close();
                                    tmpr.close();
                                    tmpFile.delete();
    
                                    done++;
    
                                    if((percent = (int)(done / file.length * 100)) % 5 < 5 && percent - percent % 5 != percentRounded)
                                            System.out.println((percentRounded = (int)(percent - percent % 5))+"%");
                            }
                            catch(IOException Ioe)
                            {
                                    Ioe.printStackTrace();
                            }
                    }
                    System.out.println("Finished!");
            }
    }
    Reply With Quote  
     

Page 1 of 2 12 LastLast

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. giving rsgp for help with items
    By skilling in forum Help
    Replies: 0
    Last Post: 02-13-2011, 07:22 AM
  2. Replies: 1
    Last Post: 02-01-2011, 09:37 PM
  3. [562] Giving random items?
    By Tony12 in forum Help
    Replies: 1
    Last Post: 01-26-2011, 06:39 PM
  4. [PI] Giving Minigame Items Back Upon Death
    By Dexter Morgan in forum Snippets
    Replies: 20
    Last Post: 08-30-2010, 09:23 PM
  5. z508 Npc's Giving items help
    By rang3r ftwo0 in forum Help
    Replies: 4
    Last Post: 02-04-2010, 01:29 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
  •