Problems with HkRename
-
3. Could/should this change go into the next version of FLHook plugin? It needs lots of testing…
Don’t know if this make any sence.
I learned, if you rename a char, that the server needs a reboot.
If players are doing this, and they know it, than the server boots a lot
This is normally an Admin commant. Don’t think it’s a good idea for players. -
We’re using it as playercommand (/rename newname) for a while now and it works very well!
-
Interesting… it does work with this change:
// This code is a bit different from the previous versions of FLHook in that
// rather than adding a new node to the end we rename the existing one.?
I knew partly about crashes when using the rename command, but didnt investigate up till now. I will have a closer look for the next plugin version.
-
ok, I checked your code… if its working, then it would be great indeed, but from looking at it, it should not work.
First, simply changing the node in the search tree may lead to the flserver never finding an account to a charname, therefore saying the charname is free even though it exists.
Also, I think there may be a buffer overrun if the new charname is longer than the old name (see char pointer), apart from the length parameter that needs to be changed as well.Anyways, its pretty hard to figure out how the flserver is storing the chars in the internal database exactly, since there is no simple “storecharindatabase” function…
So maybe the best way would be to emulate a player login and then call the createnewcharacter function… and go from there…
-
Not sure how schmackbolzen did it, all I can tell u is that /rename costs 250mil and will kick u from the server.
Works very well and i know that players are using it a lot.I will point Schmackbolzen to this threat as soon as he comes online
-
Its actually about the rename function itself, not a player-command implementation.
There are still problems under certain circumstances with it, as Cannon told us, and I experienced those problems as well at some point. We at HC however have replaced the whole flserver chardatabase with our own, thats why we no longer have problems with renames at all.
-
ok, I checked your code… if its working, then it would be great indeed, but from looking at it, it should not work.
First, simply changing the node in the search tree may lead to the flserver never finding an account to a charname, therefore saying the charname is free even though it exists.
Also, I think there may be a buffer overrun if the new charname is longer than the old name (see char pointer), apart from the length parameter that needs to be changed as well.Anyways, its pretty hard to figure out how the flserver is storing the chars in the internal database exactly, since there is no simple “storecharindatabase” function…
So maybe the best way would be to emulate a player login and then call the createnewcharacter function… and go from there…
Buffer overrun & length definitely a problem - did think about that - but thought wrong (have re-read the original code and paid attention to it)
I see your point about the search tree - just changing the name file will break the search  - my test server didn’t have many characters and they were in just the right order so I got away with it !
You could use my change as a case study for computer science students…find the mistakes.
Thanks for looking at it…back to the drawing board. I’ll keep tinkering.
-
ok, I know what went wrong, mc_horst made a fix for it but obviously it didnt make it into an actual FLHook release version.
The problem is that Players.DeleteChar decrements the account char counter. So, if you rename a lot on the same account, this counter will eventually be zero and negative which results in unpredictable behaviour.
So, include this to increment the counter:
// increment character counter memcpy(&iNumberOfChars, (char*)acc + 0x2C, 4); iNumberOfChars++; memcpy((char*)acc + 0x2C, &iNumberOfChars, 4);
Im still looking into emulating the whole process however, because IMO there may still be issues…