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!

[Guide][Release] 30k+ HP Bug [Problem and Clean solution without Stored Pro.]

Initiate Mage
Joined
Jun 29, 2011
Messages
70
Reaction score
94
First guide by me i hope its helpful :thumbup1:, and best respect for Ragezone Developers and members :)
Threat Plan:
- Explain the problem. :grr:
- Reason of the problem. :scared:
- Cause of the problem. :<:
- Solutions of the problem :laugh:


Whats the 30k+ Problem?
• If u logoff and your HP 32k+ (Exactly 32767+), you will get Rollback.


Reason of the problem?
• Database didn't save the last update about ur char (which include position/Exp/Level/CurrentHP...etc)


Cause of the problem?
• Every Column in the database tables got [Type] depends on the type of the data in this column (Date, normal text such as id/nickname, etc)


• One of those types is for numbers:
-tinyint: -128 to 127 normal. 0 to 255 UNSIGNED*. The maximum number of digits may be specified in parenthesis.
-smallint: -32768 to 32767 normal. 0 to 65535 UNSIGNED*. The maximum number of digits may be specified in parenthesis.
-mediumint: -8388608 to 8388607 normal. 0 to 16777215 UNSIGNED*. The maximum number of digits may be specified in parenthesis.
-int: -2147483648 to 2147483647 normal. 0 to 4294967295 UNSIGNED*. The maximum number of digits may be specified in parenthesis.
-bigint: -9223372036854775808 to 9223372036854775807 normal. 0 to 18446744073709551615 UNSIGNED*. The maximum number of digits may be specified in parenthesis.

-The Current HP type in the normal database (that everybody use) is smallint, which can hold value up to 32767 only, so when the game try to update your informations and input value higher than 32767 in the database, The database will reject the whole update (Not only the Current hp) and thats the cause of the rollback.

Solutions?!! :O
• There are 2 kind of solutions:
-Using stored pro., Which is making Script that receive the update information before submit it into the database, and check if the CurrentHP is bigger than 30k, If its bigger change it to 30k, so no errors happens.
Thanks for MadKnight for releasing it :) 32K HP Bug Fix using Stored Pro.

-Okay whats the 2nd solution?! i guess u already thinking about it, yup changing the type of the CurrentHP Column from smallint to higher one such as mediumint :)
But if u try to change it using (rightclick > Design) will ask u to drop the table and remake it :/
so how to do it without ramaking the table oO?!
by running small query in the SQL kal_db table:

Code:
ALTER TABLE TableName
ALTER COLUMN ColumnName DataType

Which in our case will be:

Code:
ALTER TABLE Player
ALTER COLUMN CurrentHP mediumint

then execute it :)

The data type will be changed to mediumint BUT it will be also able to NULL (which may cause another problem oO), So we gonna run little query to fix it:

Code:
ALTER TABLE [Player] ALTER COLUMN [CurrentHP] INTEGER NOT NULL





Best regards,
J3lackSwOrD/Jivex/CaronZ (Dafaq all this nicknames oO)
 
Last edited:
Joined
Jun 23, 2006
Messages
782
Reaction score
399
Wrong section...
And there's also a other way... The main server has a DBServer::Send function...
There you just have to change a "d" to a "w" and it will update it as smallint.
If you like to change the table, then make it int, cause the mainserver gives a integer to the db server..
 
Elite Diviner
Joined
Feb 8, 2012
Messages
439
Reaction score
867
i wish i see positive reply for u before i die Strik3r ^^
a7a nah never ^^

Nice Solution its a good Idea.
I have a solution via DBServerHook (Kealy also did some DB hooks), but its maybe a little bit overkill for such a small problem.

Gogogo, i want to see more from you in the future :p
 
Custom Title Activated
Member
Joined
Apr 5, 2008
Messages
1,325
Reaction score
133
tnx for release will help alot people cant wait to see whats your next project.


off:
a7a7a7a7a ena anta kser bound use private message for that kind of questions..
Hes not from egy.
 
Joined
Jun 6, 2010
Messages
33
Reaction score
18
Wrong section...
And there's also a other way... The main server has a DBServer::Send function...
There you just have to change a "d" to a "w" and it will update it as smallint.
If you like to change the table, then make it int, cause the mainserver gives a integer to the db server..

so if we use his fix then it wont work unless i edit the dbserver too ? or will his fix work without editing the dbserver ?

edit:
never mind what i asked. i use sql 2000 so all i had to do was go into my table and edit it and it didnt say anything about dropping the table at all and the mediumint isnt an option in sql 2000 so i changed it to int.

also AlterTable wasnt able to be used on sql 2000 anyway so this post was helpful for the idea to change the integer but it isnt for people who use sql 2000.

dont say why do you use sql 2000 sql 2005 is better because that is a load of bs i have tried sql 2005 and it sucks butt.

anyway thank you for the fix
 
Last edited:
Back
Top