[Fix]How to fix the Exploit Change Name from Database

10/06/2013 06:10 Sicarium#1
EDIT:
10/06/2013 10:10 jacky919#2
Really bad solution to fix a problem like that to be honest. This will just slow down the process of updating names when it is done e.g. by using some namechange scroll.
10/06/2013 16:12 Sicarium#3
It isn't stupid and it isn't slow, test it before speak^^^.
Why the people must use always and everytime namechange scroll when my script fix it alone :)?.
Test it please ;).

Jacky919 if you want to be more sure, you can use this, but i repeat, it dont get slow


Code:
CREATE PROCEDURE [dbo].[PRTName]
AS
BEGIN
DECLARE @name1 VARCHAR(50)
DECLARE @name2 VARCHAR(50)
DECLARE @szNAME VARCHAR(50)
DECLARE @szNAME2 VARCHAR(50)
DECLARE @dwCharID INT
DECLARE @dwUserID INT
DECLARE @fakename VARCHAR(50)

SET @fakename = 'put_here_the_fake_name'


SELECT @name1 = szNAME FROM TCHARTABLE WHERE dwCharID = 1
SELECT @name2 = szNAME FROM TCHARTABLE_BACK WHERE dwCharID = 1

if(@name1 != @name2)
BEGIN
DECLARE bGroup_Cursor CURSOR FOR SELECT dwUserID,dwCharID,szNAME FROM TCHARTABLE
OPEN bGroup_Cursor
FETCH NEXT FROM bGroup_Cursor INTO @dwUserID,@dwCharID,@szNAME
WHILE @@FETCH_STATUS = 0
   BEGIN	
		  SELECT @szNAME2 = szNAME FROM TCHARTABLE_BACK WHERE dwCharID = @dwCharID  
			IF(@szNAME = @fakename)
	BEGIN
UPDATE TCHARTABLE SET szNAME = @szNAME2 WHERE dwCharID = @dwCharID 
	END
			FETCH NEXT FROM bGroup_Cursor INTO @dwUserID,@dwCharID,@szNAME
END
CLOSE bGroup_Cursor
DEALLOCATE bGroup_Cursor
END
END
10/06/2013 16:23 iKonsT#4
Yes but at that exploit not just chars rename... the server is also crashing...
10/06/2013 16:30 Sicarium#5
you fix it with the services fixed, this is only for exploit change name.
10/06/2013 20:40 glossypvp#6
That's only a script which restore char names. It's a better way if you find out what's causing that rename bug.
Now, you have rename bug like 5 times a day, and this script is restoring char names one by one.
It's not a real solution to it, it's just hiding that problem. Anyways good work.
It's more reasonable if you use a script something like this when someone load his character list I think, so the player won't notice that his char was bugged.