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!

Negative Money Fix

Divine Celestial
Member
Joined
Nov 11, 2004
Messages
810
Reaction score
0
This is just the script...look on other sql job guides to learn how to schedule them.

Code:
UPDATE Character
SET Money=('2000000000')
WHERE Money<0

[N]asser` ~ Out

Credit to: [N]asser and solteykr
 
Last edited:
Divine Celestial
Member
Joined
Nov 11, 2004
Messages
810
Reaction score
0
Yea, that's why I posted it here.

[N]asser` ~ Out
 
Banned
Banned
Joined
Apr 16, 2005
Messages
9
Reaction score
0
Good work But We have to came out of the game and wait 1minute it don't have other way to do that?
 
Joined
Mar 24, 2004
Messages
30
Reaction score
0
Then player is online gameserver keep player information in his memory, then player logoff gameserver send information to database, then player login gameserver get information from database so if you make change then player is online he logoff and gameserver will overwrite your information.
 
Initiate Mage
Joined
Sep 7, 2004
Messages
64
Reaction score
0
you could insert it into the logoff stored procedure, so the moment he logoffs his money will be corrected
 
Joined
Mar 21, 2004
Messages
5
Reaction score
0
Why not use trigger instead?
Code:
CREATE TRIGGER [Restrict_Money] ON [dbo].[Character]
after update
as
Update [Character] set [Character].money=2000000000
From Inserted
Where Inserted.money<0 and [Character].accountid=inserted.accountid
and [Character].name=inserted.name

Change the money recovered to any amount you like.
 
Divine Celestial
Member
Joined
Nov 11, 2004
Messages
810
Reaction score
0
Well, because the sql script I have up there is easier for others to figure out...

[N]asser` ~ Out
 
Joined
Mar 21, 2004
Messages
5
Reaction score
0
Well actually, triggers are easier to implement. Just use your SQL query to install it and it's done. There is no need set the job or the likes. And triggers works faster than jobs.

But it's just a personal preferences. Your method is good too.
 
Junior Spellweaver
Joined
Sep 19, 2004
Messages
145
Reaction score
0
WhiteFox said:
Well actually, triggers are easier to implement. Just use your SQL query to install it and it's done. There is no need set the job or the likes. And triggers works faster than jobs.

But it's just a personal preferences. Your method is good too.

totally agree.
 
Divine Celestial
Member
Joined
Nov 11, 2004
Messages
810
Reaction score
0
I suppose that's true too. By the way, try to bring your server's IRC channel back on irc.muserver.org, whitefox.

[N]asser` ~ Out
 
Initiate Mage
Joined
Apr 6, 2005
Messages
89
Reaction score
8
WhiteFox said:
Why not use trigger instead?
Code:
CREATE TRIGGER [Restrict_Money] ON [dbo].[Character]
after update
as
Update [Character] set [Character].money=2000000000
From Inserted
Where Inserted.money<0 and [Character].accountid=inserted.accountid
and [Character].name=inserted.name

Change the money recovered to any amount you like.

WOOOW
Tnx Man :thumbup:
 
Initiate Mage
Joined
May 5, 2005
Messages
5
Reaction score
0
so is there any limit to the amount of zen the DB can stored? for example if it reach 10000000000 ... will it affect the DB?
 
Initiate Mage
Joined
Jan 7, 2005
Messages
18
Reaction score
0
Dont use the trigger
Why?.. simple
Gameserver will not read that until you change character or log off.
The system workflow is:
1.- Read the inventory of each character to show them on character selection screen
2.- Read one more time all the stats at the moment of selection
3.- Only write (no read at all) data into character table on each exp change, level up, point added, inventory change, etc.
4.- Store one more time at log out or character change

as u can see.. it iwll not read your trigger changes while the character is online.

Here is my solution for u to try:

there is a procedure WZ_DISCONNECT_MEMB
this one will run on each Account Log Out to set all the fields and logs on the offline position so we can use that one inserting this at the end:
UPDATE [Character] SET Money=2000000000 WHERE (Money<0) AND (AccountId=@uid)

I dont recommend "on update" triggers on character table because those tables receibe so many updates during play so those triggers can add overheat and overheat will make your system not estable.

Hope it helps
 
Initiate Mage
Joined
Apr 14, 2005
Messages
16
Reaction score
0
FT1FT1 said:
Dont use the trigger
Why?.. simple
Gameserver will not read that until you change character or log off.
The system workflow is:
1.- Read the inventory of each character to show them on character selection screen
2.- Read one more time all the stats at the moment of selection
3.- Only write (no read at all) data into character table on each exp change, level up, point added, inventory change, etc.
4.- Store one more time at log out or character change

as u can see.. it iwll not read your trigger changes while the character is online.

Here is my solution for u to try:

there is a procedure WZ_DISCONNECT_MEMB
this one will run on each Account Log Out to set all the fields and logs on the offline position so we can use that one inserting this at the end:


I dont recommend "on update" triggers on character table because those tables receibe so many updates during play so those triggers can add overheat and overheat will make your system not estable.

Hope it helps

It's a Job?
 
Joined
Mar 21, 2004
Messages
5
Reaction score
0
FT1FT1 said:
as u can see.. it iwll not read your trigger changes while the character is online.

What does?

I've been using the trigger for months and until now I don't really get any complaints of any sort. Jobs too, just that jobs will take a few minutes longer.

In fact, no complaints at all.

No offence intended.
 
Divine Celestial
Member
Joined
Nov 11, 2004
Messages
810
Reaction score
0
Yes, the job works just fine, but triggers are better.

[N]asser` ~ Out
 
Back
Top