Galera estava olhando o fórum e vi um tutorial aqui de como adicionar gold por cada hora que o player ficar online. Rodei a Trigger USE [MuOnline] GO DROP TRIGGER MembStat_RecordOnlineHours GO CREATE TRIGGER MembStat_RecordOnlineHours ON MEMB_STAT FOR UPDATE AS declare @memb___id varchar(10) declare @connectstat tinyint SELECT @memb___id=memb___id,@connectstat=connectstat FROM INSERTED IF (@connectstat = 0) BEGIN UPDATE [dbo].[MEMB_STAT] SET OnlineHours = OnlineHours + datediff(hour, ConnectTM, getdate()) WHERE memb___id = @memb___id END GO quando rodo a USE [MuOnline] GO DROP PROCEDURE [dbo].[WZ_DISCONNECT_MEMB] GO CREATE PROCEDURE [dbo].[WZ_DISCONNECT_MEMB] @memb___id varchar(10) AS Begin set nocount on Declare @find_id varchar(10) Declare @ConnectStat tinyint Declare @OnlineHours real Set @ConnectStat = 0 Set @find_id = 'NOT' select @find_id = S.memb___id from MEMB_STAT S INNER JOIN MEMB_INFO I ON memb___id = memb___id where I.memb___id = @memb___id if( @find_id <> 'NOT' ) begin Update MEMB_STAT SET ConnectStat = @ConnectStat, DisConnectTM = getdate(), OnlineHours = OnlineHours + datediff(hour, ConnectTM, getdate()) where memb___id = @memb___id SELECT @OnlineHours = OnlineHours FROM MEMB_STAT WHERE memb___id = @memb___id Update MEMB_INFO SET gold = gold+(@OnlineHours * 2) WHERE memb___id = @memb___id and @OnlineHours >= '1' Update MEMB_STAT SET OnlineHours = 0 WHERE memb___id = @memb___id end end GO da error, alguém sabe como resolver ? ---------- Post added at 02:10 AM ---------- Previous post was at 02:06 AM ---------- erro Server: Msg 446, Level 16, State 9, Procedure WZ_DISCONNECT_MEMB, Line 11 Cannot resolve collation conflict for equal to operation.
cara você já parou para pensar que está utilizando 2 métodos para conta a hora do player online? talvez o problema seja este... ou você utiliza 1 ou utiliza o outro mano
Fox Mu Team: Hidden Content
ja penso em, que 1 conta as horas online e o outro da o premio ? ou sei la posso ta errado.
não pensei porque a resposta está aqui: Update MEMB_STAT SET ConnectStat = @ConnectStat, DisConnectTM = getdate(), OnlineHours = OnlineHours + datediff(hour, ConnectTM, getdate()) where memb___id = @memb___id isso é na procedure... faz o seguinte remove isso da procedure e tenta rodar... vai que funciona só para complementar: SET OnlineHours = OnlineHours + datediff(hour, ConnectTM, getdate()) WHERE memb___id = @memb___id < isso é na trigger então porque fazer essa função duas vezes?
assim funcionará ? USE [MuOnline] GO DROP PROCEDURE [dbo].[WZ_DISCONNECT_MEMB] GO CREATE PROCEDURE [dbo].[WZ_DISCONNECT_MEMB] @memb___id varchar(10) AS Begin set nocount on Declare @find_id varchar(10) Declare @ConnectStat tinyint Declare @OnlineHours real Set @ConnectStat = 0 Set @find_id = 'NOT' select @find_id = S.memb___id from MEMB_STAT S INNER JOIN MEMB_INFO I ON memb___id = memb___id where I.memb___id = @memb___id if( @find_id <> 'NOT' ) begin SELECT @OnlineHours = OnlineHours FROM MEMB_STAT WHERE memb___id = @memb___id Update MEMB_INFO SET gold = gold+(@OnlineHours * 2) WHERE memb___id = @memb___id and @OnlineHours >= '1' Update MEMB_STAT SET OnlineHours = 0 WHERE memb___id = @memb___id end end GO
bom creio eu que sim recomendo você fazer um backup de sua DB pois não sei quem fez essa procedure mais ao ver aqui vejo que ela está boa porém recomendo que faça vários testes antes de soltar para players etc...
eu fiz aqui e não deu certo ainda continua dando error
faz o seguinte então roda assim: USE [MuOnline] GO DROP PROCEDURE [dbo].[WZ_DISCONNECT_MEMB] GO depois USE [MuOnline] GO CREATE PROCEDURE [dbo].[WZ_DISCONNECT_MEMB] @memb___id varchar(10) AS Begin set nocount on Declare @find_id varchar(10) Declare @ConnectStat tinyint Declare @OnlineHours real Set @ConnectStat = 0 Set @find_id = 'NOT' select @find_id = S.memb___id from MEMB_STAT S INNER JOIN MEMB_INFO I ON memb___id = memb___id where I.memb___id = @memb___id if( @find_id <> 'NOT' ) begin SELECT @OnlineHours = OnlineHours FROM MEMB_STAT WHERE memb___id = @memb___id Update MEMB_INFO SET gold = gold+(@OnlineHours * 2) WHERE memb___id = @memb___id and @OnlineHours >= '1' Update MEMB_STAT SET OnlineHours = 0 WHERE memb___id = @memb___id end end GO e veja se na MEMB_STAT veja se a table OnlineHours está criada int 0
TA DANDO ERROR Server: Msg 209, Level 16, State 1, Procedure WZ_DISCONNECT_MEMB, Line 11 Ambiguous column name 'memb___id'. Server: Msg 209, Level 16, State 1, Procedure WZ_DISCONNECT_MEMB, Line 11 Ambiguous column name 'memb___id'.
USE [MuOnline] GO DROP PROCEDURE [dbo].[WZ_DISCONNECT_MEMB] GO CREATE PROCEDURE [dbo].[WZ_DISCONNECT_MEMB] @memb___id varchar(10) AS Begin set nocount on Declare @find_id varchar(10) Declare @ConnectStat tinyint Declare @OnlineHours real Set @ConnectStat = 0 begin SELECT @OnlineHours = OnlineHours FROM MEMB_STAT WHERE memb___id = @memb___id Update MEMB_INFO SET gold = gold+(@OnlineHours * 2) WHERE memb___id = @memb___id and @OnlineHours >= '1' Update MEMB_STAT SET OnlineHours = 0 WHERE memb___id = @memb___id end end GO Tenta ae acabei de usar aqui no meu SQL e foi de boa! Caso n resolve converse comigo por MP antes que isso vire 1 bate papo
Há 2 usuários navegando neste tópico. (0 registrados e 2 visitantes)
Regras do Fórum