[Guide] Fix Online Count MEMB_STAT

ReaL

New Member
Joined
Apr 13, 2008
Messages
1,244
Reaction score
656
Ok, this is the thing, that some of ya were w8ing from years :)
It will fix the Online Count in MuWeb! The things we are going to 'touch' are the 2 procedures (WZ_CONNECT_MEMB & WZ_DISCONNECT_MEMB) and the Table (MEMB_STAT)

Some dudes say that it also fixes the Disconection Bug when warping from GS maps to GS_CS maps (im not sure about that, cuz i know it's not only from the procedures, but in the GSs as well)! But u can always test it ;)

Here we go:

1. Delete WZ_CONNECT_MEMB & WZ_DISCONNECT_MEMB from Stored Procedures.
2. Delete MEMB_STAT Table

3. Creating WZ_CONNECT_MEMB with SQL Query Analyzer (Run this in MuOnline DB)

Code:
CREATE PROCEDURE WZ_CONNECT_MEMB

@uid varchar(20),
@server varchar(20),
@uip varchar(20)
AS

Begin

BEGIN TRANSACTION

SET NOCOUNT ON

IF EXISTS ( SELECT memb___id FROM MEMB_STAT WITH (READUNCOMMITTED)
WHERE memb___id = @uid )
Begin
UPDATE MEMB_STAT
SET ip = @uip , connectstat = 1 , servername = @server , ConnectTM = (getdate())
WHERE memb___id = @uid
End
ELSE
Begin
INSERT INTO MEMB_STAT ( memb___id,ip,connectstat,servername) valueS (
@uid,
@uip,
1,
@server
)
End


IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION

SET NOCOUNT OFF
End
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS OFF
GO

4. Delete Previous Lines, Creating WZ_DISCONNECT_MEMB with SQL Query Analyzer (Run this in MuOnline DB)

Code:
CREATE PROCEDURE WZ_DISCONNECT_MEMB

@uid varchar(20)
AS
Begin

BEGIN TRANSACTION

SET NOCOUNT ON

IF EXISTS ( SELECT memb___id FROM MEMB_STAT WITH (READUNCOMMITTED)
WHERE memb___id = @uid )
Begin
UPDATE MEMB_STAT
SET DisConnectTM = (getdate()), connectstat = 0 WHERE memb___id = @uid
End
ELSE
Begin
INSERT INTO MEMB_STAT ( memb___id,DisConnectTM,connectstat) valueS (
@uid,
(getdate()),
0
)
End


IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION

SET NOCOUNT OFF
End
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

5. Finaly Creating MEMB_STAT, Delete Previous Lines and Run this in MuOnline DB.

Code:
CREATE TABLE [dbo].[MEMB_STAT] (
[memb___id] [nvarchar] (10) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[ConnectStat] [tinyint] NULL ,
[ServerName] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
[IP] [nvarchar] (15) COLLATE Chinese_PRC_CI_AS NULL ,
[ConnectTM] [smalldatetime] NULL ,
[DisConnectTM] [smalldatetime] NULL
) ON [PRIMARY]
GO

I also recommend u BUing the DataBase before doing this, but it was tested several times and it works perfekt ;)

Credits:
-United
-ReaL
 
примен засега работи ... има ли някой дисконект модул за сайта ....
 
Тоя guide не го препоръчвам на някой, който ползва в сървърва си отчитане на online hours...
 
THANKS MAN. Whit this guid i fix me server 1000000000/100000000
 
DROP TABLE MEMB_STAT
DROP PROCEDURE WZ_CONNECT_MEMB
DROP PROCEDURE WZ_DISCONNECT_MEMB

i try but no work :(
i was lucky i do the backup before.