I know it's a give XP command but I tried to remove XP from a user and it worked. However it never got save to the database, mysql, so when he rejoined he had all the original XP. We tried this three times without success. However if I gave him more XP it got saved without any problem.
Maybe adding write_xp_to_file(id,"") at the end of the function would solve it?
Btw what is the second argument to write_xp_to_file for? givenline[128], it's never used.
Might be a problem in wc3_givexp
Moderator: Forum Moderator
- ferret
- Lead Warcraft 3 XP Developer
- Posts: 422
- Joined: Wed Jul 06, 2005 8:20 am
- Location: Atlanta, GA
- Contact:
Its left over from the old flat-flat method of saving.
I'll put a write_xp_to_file into wc3_givexp ... However.. This shouldn't be necessary. Disconnecting and/or finishing a round should cause a write_xp_to_file (Unless you turned off end round saving)
I know disconnecting will save correctly because I use ENDROUND_SAVE 0 to cut CPU usage on round restart.
I'll also review the SQL statements. I wonder if the issue is there, because I know this works with VAULT.
I'll put a write_xp_to_file into wc3_givexp ... However.. This shouldn't be necessary. Disconnecting and/or finishing a round should cause a write_xp_to_file (Unless you turned off end round saving)
I know disconnecting will save correctly because I use ENDROUND_SAVE 0 to cut CPU usage on round restart.
I'll also review the SQL statements. I wonder if the issue is there, because I know this works with VAULT.
-< www.gamehavoc.com >-
Lazarus Long: And I know you didn't because the Server Files are version 2.2.6 and the file you posted is version 2.2.5, so do as I told you above and don't ever lie to me again or help is gone!
Lazarus Long: And I know you didn't because the Server Files are version 2.2.6 and the file you posted is version 2.2.5, so do as I told you above and don't ever lie to me again or help is gone!
- juKay
- WC3Mods Donor
- Posts: 14
- Joined: Thu Aug 11, 2005 2:36 am
- Location: Härnösand / Sweden
- Contact:
Are you talking about ROUNDEND_SAVEALL or did I miss something? I've left that to the default and if I'm correct the default is enabled.
Looked at the code now and you are correct, it's a SQL statement error.
In write_xp_to_file() you have this. So if the players XP is lower than before it won't get saved.
Looked at the code now and you are correct, it's a SQL statement error.
In write_xp_to_file() you have this. So if the players XP is lower than before it won't get saved.
Code: Select all
format(mquery, 1023, "UPDATE `%s` SET playername='%s',xp=%d,skill1=%d,skill2=%d,skill3=%d,skill4=%d WHERE \
playerid='%s' AND race=%d AND xp<%d", mysqltablename, playername, playerxp[id], p_skills[id][1], \
p_skills[id][2], p_skills[id][3], p_skills[id][4], playerid, p_skills[id][0], playerxp[id])
- ferret
- Lead Warcraft 3 XP Developer
- Posts: 422
- Joined: Wed Jul 06, 2005 8:20 am
- Location: Atlanta, GA
- Contact:
Can you give me the correct statement? SQL isn't my strong suit and I didn't write those queries.
-< www.gamehavoc.com >-
Lazarus Long: And I know you didn't because the Server Files are version 2.2.6 and the file you posted is version 2.2.5, so do as I told you above and don't ever lie to me again or help is gone!
Lazarus Long: And I know you didn't because the Server Files are version 2.2.6 and the file you posted is version 2.2.5, so do as I told you above and don't ever lie to me again or help is gone!
- juKay
- WC3Mods Donor
- Posts: 14
- Joined: Thu Aug 11, 2005 2:36 am
- Location: Härnösand / Sweden
- Contact:
The problem is here:
format(mquery, 1023, "UPDATE `%s` SET playername='%s',xp=%d,skill1=%d,skill2=%d,skill3=%d,skill4=%d WHERE \
playerid='%s' AND race=%d AND xp<%d", mysqltablename, playername, playerxp[id], p_skills[id][1], \
p_skills[id][2], p_skills[id][3], p_skills[id][4], playerid, p_skills[id][0], playerxp[id])
Can't quite figure out why it's checking so that your old xp is smaller than the new value. Must be some saftey net if the xp system would bug or something like it.
Simply just remove the "AND xp<%d" and problem should be solved.
format(mquery, 1023, "UPDATE `%s` SET playername='%s',xp=%d,skill1=%d,skill2=%d,skill3=%d,skill4=%d WHERE \
playerid='%s' AND race=%d AND xp<%d", mysqltablename, playername, playerxp[id], p_skills[id][1], \
p_skills[id][2], p_skills[id][3], p_skills[id][4], playerid, p_skills[id][0], playerxp[id])
Can't quite figure out why it's checking so that your old xp is smaller than the new value. Must be some saftey net if the xp system would bug or something like it.
Simply just remove the "AND xp<%d" and problem should be solved.
- Lazarus Long
- Lead PITA SOB
- Posts: 618
- Joined: Tue Jul 05, 2005 9:24 pm
Hello, ferret:
Yep, perfectly safe.juKay wrote:Simply just remove the "AND xp<%d" and problem should be solved.
Lazarus
- Before asking anything: Search!
- Want help with Warcraft 3 FT? Ask it the right way!
- What to download to get Warcraft 3 FT running? Check the list of files!
- Need more help? Check the simple Mini-HOWTO series!
- Lazarus Long
- Lead PITA SOB
- Posts: 618
- Joined: Tue Jul 05, 2005 9:24 pm
done - it's part of 2.6.1
Lazarus
- Before asking anything: Search!
- Want help with Warcraft 3 FT? Ask it the right way!
- What to download to get Warcraft 3 FT running? Check the list of files!
- Need more help? Check the simple Mini-HOWTO series!