Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

donor Changing donor status in game!

Custom Title Activated
Member
Joined
Apr 29, 2008
Messages
1,297
Reaction score
509
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
 
Initiate Mage
Joined
Apr 5, 2008
Messages
5
Reaction score
0
Re: [Release]!donor Changing donor status in game!

Hawt <3
 
Initiate Mage
Joined
Sep 12, 2005
Messages
63
Reaction score
3
Re: [Release]!donor Changing donor status in game!

this is kool can it be reservered or restricted to admin only and not all GMs ?
 
Banned
Banned
Joined
Aug 21, 2008
Messages
83
Reaction score
0
Re: [Release]!donor Changing donor status in game!

its easier threw the mysql but w/e bro i wont complain
 
Custom Title Activated
Member
Joined
Apr 29, 2008
Messages
1,297
Reaction score
509
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 =)
 
Mythic Archon
Member
Joined
Jul 23, 2008
Messages
796
Reaction score
56
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.
 
Custom Title Activated
Member
Joined
Apr 29, 2008
Messages
1,297
Reaction score
509
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
 
Mythic Archon
Member
Joined
Jul 23, 2008
Messages
796
Reaction score
56
Re: [Release]!donor Changing donor status in game!

You mean it cahnged in the database? Hmmm... maybe you have to !saveall after using it
 
Custom Title Activated
Member
Joined
Apr 29, 2008
Messages
1,297
Reaction score
509
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
 
Mythic Archon
Member
Joined
Jul 23, 2008
Messages
796
Reaction score
56
Re: [Release]!donor Changing donor status in game!

it's donator (in lowercase)
so yeah it matches your script. I checked that
 
Custom Title Activated
Member
Joined
Apr 29, 2008
Messages
1,297
Reaction score
509
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
 
Mythic Archon
Member
Joined
Jul 23, 2008
Messages
796
Reaction score
56
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?
 
Custom Title Activated
Member
Joined
Apr 29, 2008
Messages
1,297
Reaction score
509
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.
 
Mythic Archon
Member
Joined
Jul 23, 2008
Messages
796
Reaction score
56
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 = ?
 
Experienced Elementalist
Joined
Jul 18, 2008
Messages
232
Reaction score
0
Re: [Release]!donor Changing donor status in game!

Great release lol!
 
Experienced Elementalist
Joined
Jul 18, 2008
Messages
232
Reaction score
0
Re: [Release]!donor Changing donor status in game!

It will update the column "donator" right? Not donor?
 
Junior Spellweaver
Joined
Feb 3, 2008
Messages
183
Reaction score
2
Re: [Release]!donor Changing donor status in game!

Nice release dude , But theres any way to make Somebody Donor or Donator exactly when he donates via paypal? Like Nexon and NXCash XP
 
Experienced Elementalist
Joined
Jul 18, 2008
Messages
232
Reaction score
0
Re: [Release]!donor Changing donor status in game!

You can make it so when they press the donation button they can change their donator stuats to 1
 
&#12484;
Member
Joined
Apr 12, 2008
Messages
729
Reaction score
28
Re: [Release]!donor Changing donor status in game!

You can make it so when they press the donation button they can change their donator stuats to 1

-presses donation button, then presses back button without donating- <-- see the problem?
 
Custom Title Activated
Member
Joined
Apr 29, 2008
Messages
1,297
Reaction score
509
Re: [Release]!donor Changing donor status in game!

If you do that when they press
Your server would fail =)
 
Back
Top