donor Changing donor status in game!

Page 1 of 2 12 LastLast
Results 1 to 15 of 29
  1. #1
    Gamma Xerixe is offline
    MemberRank
    Apr 2008 Join Date
    MalaysiaLocation
    3,605Posts

    donor Changing donor status in game!

    Here's a release that lets you make someone a donor using a command in game.
    Tested and working =)
    If you're going to use this.
    Give me credits please. Thank you

    Credits goes to :
    Me ( For making this )
    nejevoli ( For giving me the idea and testing )



    Add this to MapleCharacter.java
    Code:
            public void makeDonor() {
                	client.getSession().close();
    		try {
    			Connection con = DatabaseConnection.getConnection();
    			PreparedStatement ps = con.prepareStatement("UPDATE characters SET donator = ? WHERE accountid = ?");
    			ps.setInt(1, 1);
    			ps.setInt(2, accountid);
    			ps.executeUpdate();
    			ps.close();
    		} catch (SQLException ex) {
    			log.error("Error while changing status", ex);
    		}
    	}
            
            public void unDonor() {
                	client.getSession().close();
    		try {
    			Connection con = DatabaseConnection.getConnection();
    			PreparedStatement ps = con.prepareStatement("UPDATE characters SET donator = ? WHERE accountid = ?");
    			ps.setInt(1, 0);
    			ps.setInt(2, accountid);
    			ps.executeUpdate();
    			ps.close();
    		} catch (SQLException ex) {
    			log.error("Error while changing status", ex);
    		}
    	}
    Btw, check the donator column in your MySQL and change donator to yours. Example = donor. In both statements

    Add this to CommandProcessor.java
    Code:
                            } else if (splitted[0].equals("!donor")) {
    				MapleCharacter target = cserv.getPlayerStorage().getCharacterByName(splitted[1]);
    				target.makeDonor();
    				mc.dropMessage("Changed donor status for " + target) ;
                            } else if (splitted[0].equals("!undonor")) {
    				MapleCharacter target = cserv.getPlayerStorage().getCharacterByName(splitted[1]);
    				target.unDonor();
    				mc.dropMessage("Changed donor status for " + target) ;
    Use !undonor to make someone a normal player
    !donor to make someone a donor


  2. #2
    Enthusiast -Tenshi- is offline
    MemberRank
    Apr 2008 Join Date
    The NetherlandsLocation
    25Posts

    Re: [Release]!donor Changing donor status in game!

    Hawt <3

  3. #3
    Proficient Member pyrrhic is offline
    MemberRank
    Sep 2005 Join Date
    JapanLocation
    176Posts

    Re: [Release]!donor Changing donor status in game!

    this is kool can it be reservered or restricted to admin only and not all GMs ?

  4. #4
    Valued Member candyman1111 is offline
    MemberRank
    Aug 2008 Join Date
    142Posts

    Re: [Release]!donor Changing donor status in game!

    its easier threw the mysql but w/e bro i wont complain

  5. #5
    Gamma Xerixe is offline
    MemberRank
    Apr 2008 Join Date
    MalaysiaLocation
    3,605Posts

    Re: [Release]!donor Changing donor status in game!

    If your using the new command system yes you can
    Just figure out how. It's harder if your running on a dedicated host
    Which takes quite a long time to respond =)

  6. #6
    Alpha Member Moogra is offline
    MemberRank
    Jul 2008 Join Date
    1,804Posts

    Re: [Release]!donor Changing donor status in game!

    Code:
            public void makeDonor() {
                	client.getSession().close();
    		try {
    			Connection con = DatabaseConnection.getConnection();
    			PreparedStatement ps = con.prepareStatement("UPDATE characters SET donator = ? WHERE accountid = ?");
    			ps.setInt(1, 1);
    			ps.setInt(2, accountid);
    			ps.executeUpdate();
    			ps.close();
    		} catch (SQLException ex) {
    			log.error("Error while changing status", ex);
    		}
    	}
    I'm not getting how the MySQL works right now. It's not working for me.
    Shouldn't
    Code:
    ("UPDATE characters SET donator = ? WHERE accountid = ?");
    be
    Code:
    ("UPDATE characters SET donator = ? WHERE name = ?");
    When I do !donor, it drops the correct message but there are no results.

  7. #7
    Gamma Xerixe is offline
    MemberRank
    Apr 2008 Join Date
    MalaysiaLocation
    3,605Posts

    Re: [Release]!donor Changing donor status in game!

    You can try name but i dont think it would work
    My friend tested it for me and it worked fine

  8. #8
    Alpha Member Moogra is offline
    MemberRank
    Jul 2008 Join Date
    1,804Posts

    Re: [Release]!donor Changing donor status in game!

    You mean it cahnged in the database? Hmmm... maybe you have to !saveall after using it

  9. #9
    Gamma Xerixe is offline
    MemberRank
    Apr 2008 Join Date
    MalaysiaLocation
    3,605Posts

    Re: [Release]!donor Changing donor status in game!

    Nah, whats the column name in your database?
    I made it to dc people before it makes them donor

  10. #10
    Alpha Member Moogra is offline
    MemberRank
    Jul 2008 Join Date
    1,804Posts

    Re: [Release]!donor Changing donor status in game!

    it's donator (in lowercase)
    so yeah it matches your script. I checked that

  11. #11
    Gamma Xerixe is offline
    MemberRank
    Apr 2008 Join Date
    MalaysiaLocation
    3,605Posts

    Re: [Release]!donor Changing donor status in game!

    Wait what was your question again?
    You're saying how it works?
    If u use name
    You'll need something to get the person's name

  12. #12
    Alpha Member Moogra is offline
    MemberRank
    Jul 2008 Join Date
    1,804Posts

    Re: [Release]!donor Changing donor status in game!

    cserv.getPlayerStorage().getCharacterByName(splitted[1]);
    OH YEAH THIS TRANSLATE TO THE CHARACTER ID RIGHT?
    then wouldn't you need the id, not account id?

  13. #13
    Gamma Xerixe is offline
    MemberRank
    Apr 2008 Join Date
    MalaysiaLocation
    3,605Posts

    Re: [Release]!donor Changing donor status in game!

    ==..
    Code:
    MapleCharacter target = cserv.getPlayerStorage().getCharacterByName(splitted[1]);
    Is to get the target when you use the command
    So it can apply the effect ==..
    The accountid is in MapleCharacter.

  14. #14
    Alpha Member Moogra is offline
    MemberRank
    Jul 2008 Join Date
    1,804Posts

    Re: [Release]!donor Changing donor status in game!

    THat's what I was talking about...
    It gets the character. Isn't that what I said? Well it still doesn't work for me. It drops the message that it is changed but there is no effect.

    And for every other script, it's always UPDATE characters SET <thing> =? WHERE id = ?

  15. #15
    RaGEZONE = FLaMEZONE thisisakevin is offline
    MemberRank
    Jul 2008 Join Date
    284Posts

    Re: [Release]!donor Changing donor status in game!

    Great release lol!



Page 1 of 2 12 LastLast

Advertisement