Negative Money Fix

Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    Account Upgraded | Title Enabled! [N]asser is offline
    MemberRank
    Nov 2004 Join Date
    1,040Posts

    Negative Money Fix

    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 by [N]asser; 07-06-05 at 07:11 AM.


  2. #2
    Account Upgraded | Title Enabled! Nemesiz is offline
    MemberRank
    Mar 2004 Join Date
    LithuaniaLocation
    204Posts
    Nothink new but will help someone

  3. #3
    Account Upgraded | Title Enabled! [N]asser is offline
    MemberRank
    Nov 2004 Join Date
    1,040Posts
    Yea, that's why I posted it here.

    [N]asser` ~ Out

  4. #4
    Apprentice messmaker is offline
    MemberRank
    Apr 2005 Join Date
    21Posts
    Good work But We have to came out of the game and wait 1minute it don't have other way to do that?

  5. #5
    Account Upgraded | Title Enabled! Nemesiz is offline
    MemberRank
    Mar 2004 Join Date
    LithuaniaLocation
    204Posts
    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.

  6. #6
    Account Upgraded | Title Enabled! [N]asser is offline
    MemberRank
    Nov 2004 Join Date
    1,040Posts
    Yep.

    [N]asser` ~ Out

  7. #7
    Valued Member StrEagle is offline
    MemberRank
    Sep 2004 Join Date
    BulgariaLocation
    145Posts
    you could insert it into the logoff stored procedure, so the moment he logoffs his money will be corrected

  8. #8
    Account Upgraded | Title Enabled! WhiteFox is offline
    MemberRank
    Mar 2004 Join Date
    SingaporeLocation
    201Posts
    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.

  9. #9
    Account Upgraded | Title Enabled! [N]asser is offline
    MemberRank
    Nov 2004 Join Date
    1,040Posts
    Well, because the sql script I have up there is easier for others to figure out...

    [N]asser` ~ Out

  10. #10
    Account Upgraded | Title Enabled! WhiteFox is offline
    MemberRank
    Mar 2004 Join Date
    SingaporeLocation
    201Posts
    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.

  11. #11
    Therefore I am. zolaks is offline
    MemberRank
    Sep 2004 Join Date
    afkLocation
    482Posts
    Quote Originally Posted by WhiteFox
    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.

  12. #12
    Account Upgraded | Title Enabled! [N]asser is offline
    MemberRank
    Nov 2004 Join Date
    1,040Posts
    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

  13. #13
    Account Upgraded | Title Enabled! Dorin1 is offline
    MemberRank
    Apr 2005 Join Date
    LondonLocation
    215Posts
    Quote Originally Posted by WhiteFox
    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

  14. #14
    Enthusiast sg-poo is offline
    MemberRank
    May 2005 Join Date
    25Posts
    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?

  15. #15
    Member FT1FT1 is offline
    MemberRank
    Jan 2005 Join Date
    VenezuelaLocation
    78Posts
    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



Page 1 of 2 12 LastLast

Advertisement