关于卡号的问题!用SQL可以完美解决!
数据库修改方法如下:
1、修改WZ_CONNECT_MEMB储存过程,用下面代码替换:
CREATE PROCEDURE WZ_CONNECT_MEMB
@uid varchar(10),
@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
--写入登录记录
IF EXISTS ( SELECT UserID FROM UserLogin WITH (READUNCOMMITTED) WHERE UserID = @uid )
Begin
UPDATE UserLogin
SET LoginIP=@uip,Server=@server,LoginTM = (getdate()),OnlineSec=0,GiveMoney=0,logoutTM=null
WHERE UserID = @uid
End
ELSE
Begin
INSERT INTO UserLogin (UserID,LoginIP,Server,LoginTM,OnlineSec,GiveMoney)
values (@uid,@uip,@server,getdate(),0,0)
End
--自动封服务器不准进入的人物
declare @SmallestZS int
declare @LargestZS int
declare @Type int
select @Type=Type from SetServerList where ServerName=@server
if (@Type>0) begin
select @SmallestZS=Smallest_ZS from SetServerList where ServerName=@server
select @LargestZS=Largest_ZS from SetServerList where ServerName=@server
if not (@SmallestZS is null) begin
update character set ctlcode=(ctlcode | 0x81) where [name] not in
(
SELECT NAME FROM WEB_ZS WHERE (ACC = @uid) AND (ZSCS >= @LargestZS) AND (ZSCS <= @SmallestZS)
) AND (AccountID = @uid)
end
end
UPDATE [Character] SET MapNumber = 0, MapPosX = 130, MapPosY = 130 WHERE (MapNumber = 30) AND (AccountID = @uid) OR (MapNumber = 31) AND (AccountID = @uid)
SET NOCOUNT OFF
End
GO
------------------------------------------------------------------------
2、新建立Character的触发器:
CREATE TRIGGER 小退自救
ON Character
AFTER UPDATE
AS
BEGIN
SET NOCOUNT ON;
UPDATE Character
SET MapNumber = 0 --要去的地图号
, MapPosX = 130 --要去的X坐标
, MapPosY = 130 --要去的Y坐标
FROM Inserted
WHERE Inserted.Name = Character.Name
and Inserted.MapNumber = 30 --会卡住的地图号
or
Inserted.Name = Character.Name
and Inserted.MapNumber = 31 --会卡住的地图号
END
有些朋友问怎么修改储存过程和建立触发器,我就简单的说下:
1、修改储存过程:企业管理器---打开mu数据库--储存过程--找到WZ_DISCONNECT_MEMB---鼠标右键--属性,然后复制WZ_DISCONNECT_MEMB的代码替换原来的,点确定就可以了。
2、建立触发器:企业管理器---打开mu数据库--表--找到Character--鼠标右键---所有任务--管理触发器--然后复制Character的新触发器内容吧默认显示的那几行替换掉,确定就ok了。
本文出自 7j45 > 奇迹一条龙