[FIX]Character deletion

Junior Spellweaver
Joined
Mar 16, 2007
Messages
177
Reaction score
0
Here's a little fix for you, my dear. =]
It deletes character with its items.



Code:
USE [Gunz]
GO
/****** Объект:  StoredProcedure [dbo].[spDeleteChar]    Дата сценария: 03/28/2007 09:38:08 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[spDeleteChar] 
	@nAID INT,
	@nCharIndex INT,
	@szCharName nvarchar(32)
AS
BEGIN
	SET NOCOUNT ON;

	DECLARE @Ret INT
	SELECT @Ret =
	COUNT(*)
	FROM Character
	WHERE Name = @szCharName AND CharIndex = @nCharIndex AND AID = @nAID

	IF @Ret != 0
    BEGIN
        DECLARE @CID INT
        SELECT @CID = CID
        FROM Character
        WHERE Name = @szCharName AND CharIndex = @nCharIndex AND AID = @nAID

	    DELETE
	    FROM Character
	    WHERE Name = @szCharName AND CharIndex = @nCharIndex AND AID = @nAID

        -- Get rid of char items. =]
        DELETE
        FROM Items
        WHERE CID = @CID
    END
	
	SELECT @Ret Ret
END
 
Thanks.. noticed this yesterday when I deleted and remade.. thanks for fix.
 
I'm not sure how you would bypass.. but I can't login if I set the IF to 1.. here's my fix for you: (if you set IF @ugid=1 (normal account) or whatever.. you try to login and get Invalid password..)
Code:
USE [GunzDB]
GO
/****** Object:  StoredProcedure [dbo].[spGetLoginInfo]    Script Date: 03/28/2007 15:02:51 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[spGetLoginInfo] 
    @szAccountName varchar(50) 
AS
BEGIN
    SET NOCOUNT ON;

    DECLARE @ugid INT
    SELECT @ugid=UGradeID
    FROM Accounts
    WHERE UserID = @szAccountName

    -- 253 is banned account id
    IF @ugid != 253
    SELECT AID, Password
    FROM Accounts
    WHERE UserID = @szAccountName
END
 
One more thing, you might wanna fix, you know when you create a 4th character, it overwrites the 2nd character, an dIf you delete the 4th character, it deletes the 2nd, I think it's CharIndex's ( it's going over the value of 4 characters ) you might wanna look into that, thats the only glitch I think I have now for mssql wise that is

EDIT: whats your msn?
 
I will work on it.. and will edit this post if I'm the last poster.. there's still other bugs I've noticed.. like when you buy an item, then equip the item, then logout and log back in.. you have to equip it again.. and THEN it saves.. I can't figure that out or don't know where to look.. don't know what isn't getting updated when you buy the item..



edit/update.. i cannot reproduce your 4 character problem.. i create 4 character.. and delete the 4th.. it deletes the 4th..

edit/update2.. i have had the problem now.. when i had 4 character.. and i think i deleted the 2nd and 3rd.. then it was kind of messed up.. something is definitely wrong with the way it is choosing to delete character..
 
Last edited:
Back