RealReznov 15 Posted March 15, 2016 Share Posted March 15, 2016 Hi When i create a new character, the player table gold is a big minus number, for example -4629785096512077824 Any idea why? Link to comment Share on other sites More sharing options...
JarajTo 40 Posted March 15, 2016 Share Posted March 15, 2016 Give the sql structure for table 1 Link to comment Share on other sites More sharing options...
RealReznov 15 Posted March 15, 2016 Author Share Posted March 15, 2016 .sql file? Okey, but i think the problem somewhere in source. http://pastebin.com/nPewvUhW In clientmanagerplayer.cpp see this: queryLen = snprintf(queryStr, sizeof(queryStr), "INSERT INTO player%s " "(id, account_id, name, level, st, ht, dx, iq, " "job, voice, dir, x, y, z, " "hp, mp, random_hp, random_sp, stat_point, stamina, part_base, part_main, part_hair, part_acce, gold, playtime, " "skill_level, quickslot) " "VALUES(0, %u, '%s', %d, %d, %d, %d, %d, " "%d, %d, %d, %d, %d, %d, %d, " "%d, %d, %d, %d, %d, %d, %d, %d, 0, %lld, 0, ", %lld <-- This is the gold. If i write this to 0, it's working, but that's a very very poor fix, i have to find the problem's real cause. Edit: It's not caused by the gold int-->long long. It's worked me for a long time, maybe a new system wrong it. Example Offlineshop. Link to comment Share on other sites More sharing options...
DangIt 1 Posted March 15, 2016 Share Posted March 15, 2016 You need to check if all the placeholders (not sure how to call them, but i'm talking about the %d etc) match the variable type you're feeding it. Example: unsigned long long tmp = 50; snprintf("INERT INTO test (gold, time) VALUES (%d, NOW())") This will give you the error you're getting because it overflows. The correct format specifier would be %ulld. Make sure all the format specifiers and variables match each other and you shouldn't get the error anymore. Link to comment Share on other sites More sharing options...
morion 59 Posted March 15, 2016 Share Posted March 15, 2016 is not mandatory set the gold value on player create query, simply delete gold field and value from query and set default value of Gold to 0 on table Link to comment Share on other sites More sharing options...
morion 59 Posted March 15, 2016 Share Posted March 15, 2016 double reply Link to comment Share on other sites More sharing options...
RealReznov 15 Posted March 15, 2016 Author Share Posted March 15, 2016 morion, yes, but it's a very very poor fix, i wrote it. DangIt, i think all match, but i tried with %d and works. But it shouldn't! tables.h: typedef struct SPlayerTable { [...] long long gold; It should work with %lld not %d... Why? Link to comment Share on other sites More sharing options...
morion 59 Posted March 15, 2016 Share Posted March 15, 2016 is not a poor fix, is a fix, the only reason to take gold value on create char query is if you enable gold on char create Link to comment Share on other sites More sharing options...
RealReznov 15 Posted March 15, 2016 Author Share Posted March 15, 2016 But it caused by something unknown. What if that caused other bug too? And what if i only realised it after the server opened? Here are the clientmanagerplayer.cpp if need: http://pastebin.com/VPQLNm5c Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now