Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Disconnect User Procedure

Junior Spellweaver
Joined
Jun 5, 2006
Messages
133
Reaction score
0
This is to be used with the recently released disconnect user program made by gregg.

Code:
alter Procedure DisconnectUsers
as
declare @struserid varchar(21), @old varchar(21),@count int, @count2 int
declare @row int

select @count = count(*) from knight_account.dbo.currentuser where strcharid in (select struserid from known_dupe)
while @count > 0
begin


DECLARE Backup_Cursor CURSOR FOR                                       
	SELECT distinct strcharid from knight_account.dbo.currentuser
where strcharid not in(select struserid from known_dupe)

	OPEN Backup_Cursor
	FETCH NEXT FROM Backup_Cursor INTO @strUserID

WHILE @@FETCH_STATUS = 0
BEGIN
	SELECT @row = count(*) 
	FROM USERDATA
	WHERE strUserID = @strUserID
select @count2 = count(*) from disconnect_user where userid = @struserid
	IF @row > 0
	BEGIN
	if @count2 < 1
begin
		insert into disconnect_user values (@struserid)
end
	END

	FETCH NEXT FROM Backup_Cursor INTO @strUserID
END

CLOSE Backup_Cursor
DEALLOCATE Backup_Cursor


end

You can use any table name you want instead of disconnect_user
you also may need to edit it to be customized for your server. The duper table name and whatnot. This is my contribution.
 
Junior Spellweaver
Joined
Jun 5, 2006
Messages
133
Reaction score
0
woops the procedure should be
Code:
alter Procedure DisconnectUsers
as
declare @struserid varchar(21), @old varchar(21),@count int, @count2 int
declare @row int

select @count = count(*) from knight_account.dbo.currentuser where strcharid in (select struserid from known_dupe)
while @count > 0
begin


DECLARE Backup_Cursor CURSOR FOR                                       
	SELECT distinct strcharid from knight_account.dbo.currentuser
where strcharid in (select struserid from known_dupe)

	OPEN Backup_Cursor
	FETCH NEXT FROM Backup_Cursor INTO @strUserID

WHILE @@FETCH_STATUS = 0
BEGIN
	SELECT @row = count(*) 
	FROM USERDATA
	WHERE strUserID = @strUserID
select @count2 = count(*) from disconnect_user where userid = @struserid
	IF @row > 0
	BEGIN
	if @count2 < 1
begin
		insert into disconnect_user values (@struserid)
end
	END

	FETCH NEXT FROM Backup_Cursor INTO @strUserID
END

CLOSE Backup_Cursor
DEALLOCATE Backup_Cursor


end
 
Newbie Spellweaver
Joined
Jul 30, 2008
Messages
98
Reaction score
0
this procedure will dc anyone thats in the disconnect_user table? so you have to manually put there names into that table or what?
 
Experienced Elementalist
Joined
Dec 7, 2006
Messages
250
Reaction score
2
Code:
	if @count2 < 1
begin
		insert into disconnect_user values (@struserid)
end
 
Junior Spellweaver
Joined
Jun 5, 2006
Messages
133
Reaction score
0
uh ok, thank you for the spam, But i explained what this procedure does.
 
Newbie Spellweaver
Joined
May 21, 2007
Messages
81
Reaction score
1
Re: [Share] Disconnect User Procedure

Should actually be CREATE PROCEDURE, instead of ALTER PROCEDURE, as they won't have the procedure to ALTER in the first place.
 
Back
Top