[SQL] Character overwrite fix / Dupe fix

Results 1 to 8 of 8
  1. #1
    Proficient Member Sedrika is offline
    MemberRank
    Sep 2009 Join Date
    162Posts

    [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
    PHP Code:
    IF @iGu 'I1' 
    and add above
    PHP Code:
    DECLARE 
    this one
    PHP Code:
     IF EXISTS(SELECT [isblockFROM [CHARACTER_TBLWHERE [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.
    Last edited by Sedrika; 29-09-13 at 10:33 PM.


  2. #2
    Owner raventh1984 is offline
    MemberRank
    May 2011 Join Date
    NetherlandsLocation
    1,499Posts

    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?

  3. #3
    Not working on UnitedFlyf Mootie is offline
    MemberRank
    Apr 2009 Join Date
    1,589Posts

    Re: [SQL] Character overwrite fix / Dupe fix

    This fix will not work.

    PHP Code:
    IF (SELECT [isblockFROM [CHARACTER_TBLWHERE [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 [isblockFROM [CHARACTER_TBLWHERE [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 [isblockFROM [CHARACTER_TBLWHERE [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.
    Last edited by Mootie; 29-09-13 at 08:50 PM.

  4. #4
    Proficient Member Sedrika is offline
    MemberRank
    Sep 2009 Join Date
    162Posts

    Re: [SQL] Character overwrite fix / Dupe fix

    Changed it thanks.

  5. #5
    Not working on UnitedFlyf Mootie is offline
    MemberRank
    Apr 2009 Join Date
    1,589Posts

    Re: [SQL] Character overwrite fix / Dupe fix

    Quote Originally Posted by Sedrika View Post
    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.

  6. #6
    Proficient Member Sedrika is offline
    MemberRank
    Sep 2009 Join Date
    162Posts

    AW: [SQL] Character overwrite fix / Dupe fix

    Quote Originally Posted by Mootie View Post
    Still fucked.
    Now fixed :)

    Send via GT-I9505 with Tapatalk 2

  7. #7
    Not working on UnitedFlyf Mootie is offline
    MemberRank
    Apr 2009 Join Date
    1,589Posts

    Re: AW: [SQL] Character overwrite fix / Dupe fix

    Quote Originally Posted by Sedrika View Post
    IF EXISTS(SELECT [isblock] FROM [CHARACTER_TBL] WHERE [playerslot] = @iplayerslot [serverindex] = @iserverindex AND [isblock] = 'F')
    You really need to proofread...

  8. #8
    Proficient Member Sedrika is offline
    MemberRank
    Sep 2009 Join Date
    162Posts

    AW: [SQL] Character overwrite fix / Dupe fix

    Quote Originally Posted by Mootie View Post
    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



Advertisement