[SQL] Character overwrite fix / Dupe fix
Since the database doesn't check while creating a player if the slot is already taken here's a fix.
Open CHARACTER_STR and search for
and add above
this one
PHP Code:
IF EXISTS(SELECT [isblock] FROM [CHARACTER_TBL] WHERE [playerslot] = @iplayerslot AND [serverindex] = @iserverindex AND [isblock] = 'F')
BEGIN
SELECT fError = '0', fText = 'Can not overwrite player!'
RETURN
END
Now maybe the question for what this is good.
---
The CHARACTER_STR procedure does not check while creating a character if the slot is already taken or not.
If you overwrite the Slot from a player it'll be able to dupe items or whatever.
It's checked whether if there is already an existing player or not. If so users won't be able to overwrite this slot.
It's not checked whether the text is case sensitive or not because the CHARACTER_TBL has Latin1_General_CI_AS as collate and it's case insensitive.
Re: [SQL] Character overwrite fix / Dupe fix
Hmm nice this will solve some things.
However i am an bit curious on how it works?
I understand that how its before the fix. That it only checks if the name is in use. But how will you overwrite the slot?
Cause when you log in with the same details to overwrite it it will DC the other window correct?
Re: [SQL] Character overwrite fix / Dupe fix
This fix will not work.
PHP Code:
IF (SELECT [isblock] FROM [CHARACTER_TBL] WHERE [playerslot] = @iplayerslot AND [account] = @iaccount AND [serverindex] = @iserverindex) = 'F'
BEGIN
SELECT fError = '0', fText = 'Can not overwrite player!'
RETURN
END
What would happen if
PHP Code:
SELECT [isblock] FROM [CHARACTER_TBL] WHERE [playerslot] = @iplayerslot AND [account] = @iaccount AND [serverindex] = @iserverindex
returned multiple entries?(multiple characters deleted on that slot)
It would return the first entry('D'), bypassing your check.
Try:
PHP Code:
IF EXISTS(SELECT [isblock] FROM [CHARACTER_TBL] WHERE [account] = @iaccount AND [playerslot] = @iplayerslot AND [serverindex] = @iserverindex AND [isblock] = 'F')
BEGIN
SELECT fError = '0', fText = 'Can not overwrite player!'
RETURN
END
[Strike]I also ommitted "[account] = @iaccount", because it's inefficient(strcmp on non-indexed field is resource intensive) and redundant.[/Strike]
- Edited: checking account field is necessary, my bad.
Re: [SQL] Character overwrite fix / Dupe fix
Re: [SQL] Character overwrite fix / Dupe fix
Quote:
Originally Posted by
Sedrika
IF EXISTS(SELECT [isblock] FROM [CHARACTER_TBL] WHERE [playerslot] = @iplayerslot AND [account] = @iaccount AND [serverindex] = @iserverindex = 'F')
BEGIN
SELECT fError = '0', fText = 'Can not overwrite player!'
RETURN
END
Still fucked.
AW: [SQL] Character overwrite fix / Dupe fix
Quote:
Originally Posted by
Mootie
Still fucked.
Now fixed :)
Send via GT-I9505 with Tapatalk 2
Re: AW: [SQL] Character overwrite fix / Dupe fix
Quote:
Originally Posted by
Sedrika
IF EXISTS(SELECT [isblock] FROM [CHARACTER_TBL] WHERE [playerslot] = @iplayerslot [serverindex] = @iserverindex AND [isblock] = 'F')
You really need to proofread...
AW: [SQL] Character overwrite fix / Dupe fix
Quote:
Originally Posted by
Mootie
You really need to proofread...
Just copied your text. Gonna fix it when I'm back home.
Gesendet von meinem GT-I9505 mit Tapatalk 2