I have a problem when I want to create a script that updates the points of a character in SQL when he dies. I want him to lose 12 points when he dies, but if he dies with 2 points for example, the emulator shows an error in the following way:
[SQL]: DB error - BIGINT UNSIGNED value is out of range in '(`myserver_ro`.`pvp_ranking`.`points` - 12)'
[Debug]: at script.c:17014 - insert into `pvp_ranking` value ( 150040, 'Junior', 12 , 0 ) on duplicate key update `points` = `points` - 12
[Debug]: Source (NPC): PvPoints (invisible/not on a map)
It would seem as if I could not do the subtraction of 2 - 12 and therefore give the number 0 as the final total since I believe it should be a "negative number".
Question
Strand
Hello community,
I have a problem when I want to create a script that updates the points of a character in SQL when he dies. I want him to lose 12 points when he dies, but if he dies with 2 points for example, the emulator shows an error in the following way:
[SQL]: DB error - BIGINT UNSIGNED value is out of range in '(`myserver_ro`.`pvp_ranking`.`points` - 12)' [Debug]: at script.c:17014 - insert into `pvp_ranking` value ( 150040, 'Junior', 12 , 0 ) on duplicate key update `points` = `points` - 12 [Debug]: Source (NPC): PvPoints (invisible/not on a map)
It would seem as if I could not do the subtraction of 2 - 12 and therefore give the number 0 as the final total since I believe it should be a "negative number".
Anyone can help?
Script:
query_sql "insert into `pvp_ranking` value ( "+ getcharid(0) +", '"+ escape_sql( strcharinfo(0) ) +"', "+ .@points +" , 0 ) on duplicate key update `points` = `points` - "+ .@points +"";
Thank you in advance.
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.