How to add a custom reward/voting system. (NON TIMED)

Page 1 of 4 1234 LastLast
Results 1 to 15 of 49
  1. #1
    I'm sexy and I know it :) Deagan ツ is offline
    MemberRank
    Oct 2008 Join Date
    clubs ;\Location
    1,317Posts

    How to add a custom reward/voting system. (NON TIMED)

    Hi Ragezone,
    I was browsing the forums the other day,
    and I saw that alot of people don't know how to make a custom reward system/voting system.
    With a reward system I mean having a column in MySQL which is editable with, in most cases, npc's.
    That's why I decided to make a tutorial on how to make a custom system, didn't know in which section to post so I did it in both, hope you'll forgive me.


    Blue = required.
    Red = extra info.
    Orange = optional / own customization.


    We're going to make a custom votingpoints system~
    Let's get started.




    MySQL Column 'votingpoints'


    DO THIS WHEN THE SERVER = DOWN!
    ~Go into the MySQL query browser and right click on accounts > edit table, a window should pop up.
    Scroll down the list and add a column by clicking in the emty space under the last column.
    These are the things you should enter :
    Code:
    Column Name, Datatype, Not NULL, Auto Increment, Flags, Default Value.
    votingpoints , INT(11) , (Enabled) , (Disabled) , (Both Disabled) , 0   << REALLY IMPORTANT!
    Click apply changes and run the query.
    Your column in MySQL has been created. :)





    MapleCharacter.java

    Open up netbeans and make your way to MapleCharacter.java , located in net\sf\odinms\client for ThePack/Xotic and client for BubblesDev.
    Open it.
    Now do the following :

    Add :

    Code:
    private int votingpoints;
    Or w/e your system is called~

    Under :

    Code:
    private int ci = 0;
    Or w/e is the last private int in your MapleCharacter.java

    WATCH OUT, do NOT paste this in the public static getDefault!

    Find (ctrl + f) :

    Code:
    loadCharFromDB
    Scroll down till you see :

    Code:
            rs = ps.executeQuery();
            while (rs.next()) {
                ret.getClient().setAccountName(rs.getString("name"));
                ret.paypalnx = rs.getInt("paypalNX");
                ret.maplepoints = rs.getInt("mPoints");
                ret.cardnx = rs.getInt("cardNX");
            }
    In this (^^^) part add :

    Code:
    ret.votingpoints = rs.getInt("votingpoints");
    Under :

    Code:
    ret.cardnx = rs.getInt("cardNX");
    Find (ctrl + f) :

    Code:
    ps = con.prepareStatement("UPDATE accounts SET `paypalNX` = ?, `mPoints` = ?, `cardNX` = ? WHERE id = ?");
    Replace :

    Code:
                ps = con.prepareStatement("UPDATE accounts SET `paypalNX` = ?, `mPoints` = ?, `cardNX` = ? WHERE id = ?");
                ps.setInt(1, paypalnx);
                ps.setInt(2, maplepoints);
                ps.setInt(3, cardnx);
                ps.setInt(4, client.getAccID());
    With :

    Code:
                ps = con.prepareStatement("UPDATE accounts SET `paypalNX` = ?, `mPoints` = ?, `cardNX` = ?, `votingpoints` = ? WHERE id = ?");
                ps.setInt(1, paypalnx);
                ps.setInt(2, maplepoints);
                ps.setInt(3, cardnx);
                ps.setInt(4, votingpoints);
                ps.setInt(5, client.getAccID());
    Add :

    Code:
        public void setvotingpoints(int newpoints) {
            this.votingpoints = newpoint;
        }
    
        public void gain1votingpoint() {
            this.votingpoints++;
        }
    
        public void gainvotingpoints(int gainedpoints) {
            this.votingpoints += gainedpoints;
        }
    
        public int getvotingpoints() {
            return votingpoints;
        }
    Make sure that IF you use a different system name to also update all voids in NPCConversationmanager.java later on!

    Under :

    Code:
        public void setMarried(int m) {
            this.married = m;
        }


    NPCConversationManager.java

    Pay really close attention to the next parts!

    Add :

    Code:
        public int getvotingpoints() {
            return getPlayer().getvotingpoints();
        }
    
        public void setvotingpoints(int newpoints) {
            getPlayer().setvotingpoints(newpoints);
        }
    
        public void gainvotingpoint1() {
            getPlayer().gain1votingpoint();
        }
    
        public void gainvotingpoints(int gainedpoints) {
            getPlayer().gainvotingpoints(gainedpoints);
            chr.saveToDB(true); // No more stupid rollbacks ;) ~Deagan
            if (gainedpoints > 0) {
                getPlayer().message("Hi " + getPlayer().getName() + ",");
                getPlayer().message("You have achieved : " + gainedpoints + " VotingPoint(s),");
                getPlayer().message("Which brings you to a total of : " + getPlayer().getvotingpoints() + " VotingPoints~");
            }
            else {
                getPlayer().message("Hi " + getPlayer().getName() + ",");
                getPlayer().message("You have lost : " + gainedpoints + " VotingPoints,");
                getPlayer().message("Which brings you to a total of : " + getPlayer().getvotingpoints() + " VotingPoints~");
            }
        }
    Under :

    Code:
        public void gainMeso(int gain) {
            getPlayer().gainMeso(gain, true, false, true);
        }
    About all purple parts, as you can see, it says : getPlayer(). in front of it,
    which means it redirects to MapleCharacter.java
    To make these purple parts work change them to what you changed in NPCConversationManager.java

    Example :
    In MapleCharacter you changed :

    Code:
        public void setvotingpoints(int newpoints) {
            this.votingpoints = newpoint;
        }
    Into :

    Code:
        public void setcookiepoints(int newpoints) {
            this.cookiepoints = newpoint;
        }
    To make it work in NPCConversationManager.java the (purple part) :

    Code:
        public void setvotingpoints(int newpoints) {
            getPlayer().setvotingpoints(newpoints);
        }
    Should be changed to :

    Code:
        public void setcookiepoints(int newpoints) {
            getPlayer().setcookiepoints(newpoints);
        }
    ALWAYS LOOK BACK ON WHAT YOU HAVE CODED.


    Frequently asked questions (Which I think people would certainly ask) :

    Code:
    -How do you add a playercommand to check your amount of votingpoints?
    Go into playercommand.java and add :
    
                 } else if (splitted[0].equals("@checkvotingpoints")) {
                 player.message("Hello " + c.getPlayer().getName() + ", you currently have : " + c.getPlayer().getvotingpoints() + " votingpoints~");
    Code:
    -How does this 'system' work, I added it but nothing changed in game =O
    
    I am not making the npc's for you, but I can tell you how, make a npc which uses one of the npcconversationmanager voids, examples :
    cm.getvotingpoints(); // Shows you how much votingpoints you have.
    cm.setvotingpoints(1000); // Sets your votingpoints to 1000, directly into MySQL
    cm.gainvotingpoints(100); // Adds or removes 100 votingpoints on top of what's already in MySQL
    cm.gainvotingpoint1(); // Adds 1 votingpoint on top of what's already in MySQL
    Code:
    -I am having errors when compiling?
    
    Scan all MapleCharacter.java and NPCConversationManager.java additions and see if the, taken into consideration in the purple parts, voids arn't different from eachother.
    If you're using a different source you might have to add new imports.
    Code:
    -I am still getting errors, can you teamview me and help me set it up?
    
    No I will NOT teamviewing you, post your problem in the comments and I or someone else will help you out, if possible.
    Code:
     -Did you make this? HarleyQuin said you only use scripts of him :S
    
    Yes I made this, HarleyQuin is a fucked up fag which let me host his fail server for 3 months then deleted all files I coded, then says I am the money-stealing scumbag which steals his scripts. 
    Code:
     -Autoregister/siteregister doesn't work :O ZOMG!
    
    Make sure you have set the default value of the MySQL column to 0.
    Code:
     -Why are you releasing this, it's basically spoonfeeding all leechers on this forum.
    
    Might be, but I feel like every single server owner has the right to have some customization in his/her server.
    Code:
     -May I suck you off for making this?
    
    Go ahead.


    Credits to me.
    Thanks for reading :)
    Hope this helps alot of you.






  2. #2
    Enthusiast XxZeroToxinxX is offline
    MemberRank
    May 2009 Join Date
    Fort Macleod, ALocation
    39Posts

    Re: How to add a custom reward/voting system. (NON TIMED)

    OMFg ty Deagan

  3. #3
    I'm sexy and I know it :) Deagan ツ is offline
    MemberRank
    Oct 2008 Join Date
    clubs ;\Location
    1,317Posts

    Re: How to add a custom reward/voting system. (NON TIMED)

    Is that you riley :O
    Np, enjoyed my 4 ~ 7 am coding time making this :o

  4. #4
    I'm sexy and I know it :) Deagan ツ is offline
    MemberRank
    Oct 2008 Join Date
    clubs ;\Location
    1,317Posts

    Re: How to add a custom reward/voting system. (NON TIMED)

    bump :o?

  5. #5
    Account Upgraded | Title Enabled! dragonbIood is offline
    MemberRank
    Jul 2008 Join Date
    CaliforniaLocation
    545Posts

    Re: How to add a custom reward/voting system. (NON TIMED)

    Wasnt this in the release section? Btw its bad convention not to capitalize method names after the first word... Not a flame, just saying.
    Posted via Mobile Device

  6. #6
    I'm sexy and I know it :) Deagan ツ is offline
    MemberRank
    Oct 2008 Join Date
    clubs ;\Location
    1,317Posts

    Re: How to add a custom reward/voting system. (NON TIMED)

    Quote Originally Posted by dragonbIood View Post
    Wasnt this in the release section? Btw its bad convention not to capitalize method names after the first word... Not a flame, just saying.
    Posted via Mobile Device
    Why does everyone say that :( at least, I would rather not care about capitals when I scripted a npc than watch every word over :\

  7. #7
    Valued Member Alex1333a789 is offline
    MemberRank
    Jul 2008 Join Date
    4 By 4 Box, Noob Street West, OntarioLocation
    125Posts

    Re: How to add a custom reward/voting system. (NON TIMED)

    Very nice deagan, I shall try this later.

  8. #8
    Apprentice KiNdAnGeL is offline
    MemberRank
    Aug 2009 Join Date
    Home.Location
    11Posts

    Re: How to add a custom reward/voting system. (NON TIMED)

    OMG, i have tested it and it work.

    Thank dude.

    Thanks
    KiNdAnGeL

  9. #9
    I'm sexy and I know it :) Deagan ツ is offline
    MemberRank
    Oct 2008 Join Date
    clubs ;\Location
    1,317Posts

    Re: How to add a custom reward/voting system. (NON TIMED)

    Quote Originally Posted by Alex1333a789 View Post
    Very nice deagan, I shall try this later.
    No problem, I felt like supporting the community at ragezone since, it's basicall yonly flaming and useless topics recently, example : that c# source.

    Quote Originally Posted by KiNdAnGeL
    OMG, i have tested it and it work.

    Thank dude.

    Thanks
    KiNdAnGeL
    No problem.

  10. #10
    Enthusiast xpainkillerx is offline
    MemberRank
    Aug 2008 Join Date
    31Posts

    Re: How to add a custom reward/voting system. (NON TIMED)

    when i relog i no longer have points. Anyone know how to fix?

    ---------- Post added at 03:00 AM ---------- Previous post was at 02:49 AM ----------

    Quote Originally Posted by xpainkillerx View Post
    when i relog i no longer have points. Anyone know how to fix?
    nvm i figured it out! Thanks for the tut!

  11. #11
    Novice abhirox123 is offline
    MemberRank
    Jan 2010 Join Date
    1Posts

    Re: How to add a custom reward/voting system. (NON TIMED)

    heyy um i think this a great release and i would just like 2 say thx a lot!! im just curious cuz i made my pserver 2day and i have no experience whatsoever with anything 2 do with maplestory private servers... after i compiled all these codes and everything, what npc do i use in my server for the vote point system??

    thanks in advance =D

  12. #12
    Proficient Member sum1udontkno is offline
    MemberRank
    Jun 2009 Join Date
    152Posts

    Re: How to add a custom reward/voting system. (NON TIMED)

    thanks a lot for this release :D

  13. #13
    8===D Hubba is offline
    MemberRank
    Jan 2009 Join Date
    CanadaLocation
    1,009Posts

    Re: How to add a custom reward/voting system. (NON TIMED)

    Pretty cool thanks man!

  14. #14
    Account Upgraded | Title Enabled! ~Fallen is offline
    MemberRank
    Dec 2008 Join Date
    Behind you look BehindLocation
    407Posts

    Re: How to add a custom reward/voting system. (NON TIMED)

    Whats wrong with this?

    PHP Code:
    if (cm.getPlayer().getvotepoints() >= 1) {
                
    cm.gainMeso(500000);
                
    cm.gainvotepoints(-1);
                
    cm.sendOk("Well done!, Here is your #rMoney#k");
                
    cm.dispose();
            } else {
                
    cm.sendOk(" Sorry. You do not have enough Vote Points. ");
                
    cm.dispose();
            } 
    It work. gives you 500.000 mesos but after it gives you the money it doesn't pop anything and say well done here is your shit. Also lets say i got 1 point in my account so i use that for 1 time and the 2nd time it says sorry cuz i dont have anymore points right. but i go check in the DB and the points are still there? and then i relog the char and i can get 500.000 again from the npc. like wtf?

  15. #15
    Enthusiast huubm is offline
    MemberRank
    Jul 2008 Join Date
    26Posts

    Re: How to add a custom reward/voting system. (NON TIMED)

    It cant find symbol Newpoint here...
    anyone knows how to fix ?

    ---------- Post added at 01:33 PM ---------- Previous post was at 01:32 PM ----------

    Well.. It cant find symbol "newpoints" here

    Anyone know how to fix ?

    ---------- Post added at 01:35 PM ---------- Previous post was at 01:33 PM ----------

    Well.. It cant find symbol "newpoints" here

    Anyone know how to fix ?



Page 1 of 4 1234 LastLast

Advertisement