Negative Money Fix

Joined
Nov 11, 2004
Messages
809
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:
Good work But We have to came out of the game and wait 1minute it don't have other way to do that?
 
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.
 
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.
 
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.
 
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.
 
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:
 
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
 
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?
 
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.
 
Back