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!

nx,mp,gt fix

Elite Diviner
Joined
Jul 13, 2008
Messages
419
Reaction score
217
EDIT: don't use this - http://forum.ragezone.com/showthread.php?t=432084 - it's bugged and will prevent you from creating characters!
EDIT: my version was buggy, so here's khoacalacan's version of the fix, credits to him of course!

I haven't tested yet, but if it works, credit me, thanks. Basically what it does is that it gets your current nxcash, maplepoints, and gift tokens from that account.

Find and replace
Code:
		ret.nxcash = 0;
		ret.maplepoints = 0;
		ret.gifttokens = 0;

with
Code:
                try {
                Connection con = DatabaseConnection.getConnection();
                PreparedStatement ps;
		ps = con.prepareStatement("SELECT * FROM accounts WHERE id = ?");
		ps.setInt(1, ret.accountid);
                ResultSet rs = ps.executeQuery();
		rs = ps.executeQuery();
		while (rs.next()) {
			ret.getClient().setAccountName(rs.getString("name"));
			ret.nxcash = rs.getInt("nxCash");
			ret.maplepoints = rs.getInt("mPoints");
			ret.gifttokens = rs.getInt("gTokens");
		}
		rs.close();
		ps.close();
                } catch (SQLException e) {
			log.error("ERROR", e);
		}
 
Last edited:
Master Summoner
Joined
Apr 29, 2008
Messages
534
Reaction score
3
Re: [release] nx,mp,gt fix

Hah. Very very nice release. Thanks XD I'm gonna try it.
 
Master Summoner
Joined
May 31, 2008
Messages
524
Reaction score
1
Re: [release] nx,mp,gt fix

Hmm... If this is tested, and this happens, I better use this ASAP!
 
Newbie Spellweaver
Joined
May 24, 2008
Messages
85
Reaction score
5
Re: [release] nx,mp,gt fix

Code:
		ret.nxcash = 0;
		ret.maplepoints = 0;
		ret.gifttokens = 0;

You just need to remove that.
 
Elite Diviner
Joined
Jul 13, 2008
Messages
419
Reaction score
217
Re: [release] nx,mp,gt fix

Code:
		ret.nxcash = 0;
		ret.maplepoints = 0;
		ret.gifttokens = 0;

You just need to remove that.

didn't work when i only removed that
 
Newbie Spellweaver
Joined
May 24, 2008
Messages
85
Reaction score
5
Re: [release] nx,mp,gt fix

Code:
			ps = con.prepareStatement("UPDATE accounts SET `nxCash` = ?, `mPoints` = ?, `gTokens` = ? WHERE id = ?");
			ps.setInt(1, nxcash);
			ps.setInt(2, maplepoints);
			ps.setInt(3, gifttokens);
			ps.setInt(4, client.getAccID());
			ps.executeUpdate();
			ps.close();

Can be glitch by buying nx than giving it to a player than relog.
 
Elite Diviner
Joined
Jul 13, 2008
Messages
419
Reaction score
217
Re: [release] nx,mp,gt fix

Code:
			ps = con.prepareStatement("UPDATE accounts SET `nxCash` = ?, `mPoints` = ?, `gTokens` = ? WHERE id = ?");
			ps.setInt(1, nxcash);
			ps.setInt(2, maplepoints);
			ps.setInt(3, gifttokens);
			ps.setInt(4, client.getAccID());
			ps.executeUpdate();
			ps.close();

Can be glitch by buying nx than giving it to a player than relog.

yea, i noted that :O
i have to find a way to select nx before and set it there but i'm not that good in java... i will try and update the thread
Code:
		ret.nxcash = 0;
		ret.maplepoints = 0;
		ret.gifttokens = 0;
 
Master Summoner
Joined
May 31, 2008
Messages
524
Reaction score
1
Re: [release] nx,mp,gt fix

So, you don't remove this?

Code:
			ps = con.prepareStatement("UPDATE accounts SET `nxCash` = ?, `mPoints` = ?, `gTokens` = ? WHERE id = ?");
			ps.setInt(1, nxcash);
			ps.setInt(2, maplepoints);
			ps.setInt(3, gifttokens);
			ps.setInt(4, client.getAccID());
			ps.executeUpdate();
			ps.close();
 
Elite Diviner
Joined
Jul 13, 2008
Messages
419
Reaction score
217
Re: [release] nx,mp,gt fix

So, you don't remove this?

Code:
			ps = con.prepareStatement("UPDATE accounts SET `nxCash` = ?, `mPoints` = ?, `gTokens` = ? WHERE id = ?");
			ps.setInt(1, nxcash);
			ps.setInt(2, maplepoints);
			ps.setInt(3, gifttokens);
			ps.setInt(4, client.getAccID());
			ps.executeUpdate();
			ps.close();

if you don't remove this it won't work but if you remove this you will get other bugs, let me try fix... i will update thread when i'm done!
 
Initiate Mage
Joined
Jun 7, 2008
Messages
4
Reaction score
0
Re: [release] nx,mp,gt fix

thx dude,my friends keep complaining to me about that,and i have been searching for a solution for a long time.Hope to see more helpful tuts! :D
 
Experienced Elementalist
Joined
Jun 22, 2008
Messages
264
Reaction score
0
Re: [release] nx,mp,gt fix

okay, lets go back to IDEEKAY's guide : P

~dXm
 
Newbie Spellweaver
Joined
Jan 4, 2007
Messages
69
Reaction score
0
Re: [release] nx,mp,gt fix

I haven't tested yet, but if it works, credit me, thanks. Basically what it does is that it gets your current nxcash, maplepoints, and gift tokens from that account.

Find and replace
Code:
		ret.nxcash = 0;
		ret.maplepoints = 0;
		ret.gifttokens = 0;

with
Code:
                try {
                Connection con = DatabaseConnection.getConnection();
                PreparedStatement ps;
		ps = con.prepareStatement("SELECT * FROM accounts WHERE id = ?");
		ps.setInt(1, ret.accountid);
                ResultSet rs = ps.executeQuery();
		rs = ps.executeQuery();
		while (rs.next()) {
			ret.getClient().setAccountName(rs.getString("name"));
			ret.nxcash = rs.getInt("nxCash");
			ret.maplepoints = rs.getInt("mPoints");
			ret.gifttokens = rs.getInt("gTokens");
		}
		rs.close();
		ps.close();
                } catch (SQLException e) {
			log.error("ERROR", e);
		}

Do NOT remove this as said from others, it's what updates your nx cash when you use them
Code:
			ps = con.prepareStatement("UPDATE accounts SET `nxCash` = ?, `mPoints` = ?, `gTokens` = ? WHERE id = ?");
			ps.setInt(1, nxcash);
			ps.setInt(2, maplepoints);
			ps.setInt(3, gifttokens);
			ps.setInt(4, client.getAccID());
			ps.executeUpdate();
			ps.close();
 
Elite Diviner
Joined
Jul 13, 2008
Messages
419
Reaction score
217
Re: [release] nx,mp,gt fix

no problem
i hope this fixed your creating character bug =)

(sorry didn't give a look into this thread for a long time o_O)
 
Back
Top