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!

[Guide]Automatic deletion of inactive characters NOTE: Characters not Account

Status
Not open for further replies.
Junior Spellweaver
Joined
Jan 1, 2008
Messages
170
Reaction score
0
add this table under RanGame1

Column Name: LastLoginDate
Data Type: datetime
Allow Nulls: Yes

Ultimate Ran - [Guide]Automatic deletion of inactive characters NOTE: Characters not Account - RaGEZONE Forums


Next is to create this trigger, make a new query and paste this script:

USE [RanGame1]
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE TRIGGER [dbo].[Delete_Char] ON [dbo].[ChaInfo]
after update
as
BEGIN

Update [ChaInfo] set [ChaInfo].LastLoginDate = GETDATE()
From inserted
Where Inserted.ChaOnline = 1
and Inserted.ChaNum = [ChaInfo].ChaNum

Delete from [ChaInfo]
Where DATEDIFF(day,[ChaInfo].LastLoginDate,GETDATE()) >= 30 -----You can change this to number of days you want

END
if you have an existing trigger in rangame1 under chainfo.. then insert only this script before END

Update [ChaInfo] set [ChaInfo].LastLoginDate = GETDATE()
From inserted
Where Inserted.ChaOnline = 1
and Inserted.ChaNum = [ChaInfo].ChaNum

Delete from [ChaInfo]
Where DATEDIFF(day,[ChaInfo].LastLoginDate,GETDATE()) >= 30 -----You can change this to number of days you want

i've just added some of this existing script found in ragezone.. tnx
 
Last edited:
Junior Spellweaver
Joined
Aug 7, 2007
Messages
113
Reaction score
3
Re: [Share]Automatic deletion of inactive characters NOTE: Characters not Account

i should try this one. ^_^ BTW. thanks for the share bro.. ^_^
 
Custom Title Activated
Loyal Member
Joined
Aug 16, 2007
Messages
1,378
Reaction score
581
Re: [Share]Automatic deletion of inactive characters NOTE: Characters not Account

You made a big mistake, that would only delete anybody after EVERY player of your server didn't play for 30 days because it sets the lastlogindate on EVERY CHAR to getdate as soon as 1 player is online

change this :
Update [ChaInfo] set [ChaInfo].LastLoginDate = GETDATE()
From inserted
Where Inserted.ChaOnline = 1

into this :

Update [ChaInfo] set [ChaInfo].LastLoginDate = GETDATE()
From inserted
Where Inserted.ChaOnline = 1
and Inserted.chanum = [chainfo].chanum
 
Junior Spellweaver
Joined
Jan 1, 2008
Messages
170
Reaction score
0
Re: [Share]Automatic deletion of inactive characters NOTE: Characters not Account

You made a big mistake, that would only delete anybody after EVERY player of your server didn't play for 30 days because it sets the lastlogindate on EVERY CHAR to getdate as soon as 1 player is online

change this :
Update [ChaInfo] set [ChaInfo].LastLoginDate = GETDATE()
From inserted
Where Inserted.ChaOnline = 1

into this :

Update [ChaInfo] set [ChaInfo].LastLoginDate = GETDATE()
From inserted
Where Inserted.ChaOnline = 1
and Inserted.chanum = [chainfo].chanum

tnx for the correction sir.. sorry for that.. guide updated.. tnx again
 
Banned
Banned
Joined
Apr 2, 2007
Messages
863
Reaction score
14
Re: [Share]Automatic deletion of inactive characters NOTE: Characters not Account

Waiting for confirmation before it gets to sticky thread.
 
Newbie Spellweaver
Joined
May 27, 2006
Messages
71
Reaction score
0
Re: [Share]Automatic deletion of inactive characters NOTE: Characters not Account

well thanks ultimate and jolin it worked perfectly with my server but i set the day for 1 day and change my server time but really it's working.. keep it up
 
Junior Spellweaver
Joined
Jan 1, 2008
Messages
170
Reaction score
0
Re: [Share]Automatic deletion of inactive characters NOTE: Characters not Account

well thanks ultimate and jolin it worked perfectly with my server but i set the day for 1 day and change my server time but really it's working.. keep it up

yes that's the way to test it.. and observe it by putting ChaOnline=1 observe that LastLoginDate change.. tnx for the try..
 
Status
Not open for further replies.
Back
Top