Server: Msg 3701, Level 11, State 5, Line 1
Cannot drop the procedure 'dbo.WZ_DISCONNECT_MEMB', because it does not exist in the system catalog.
nao esta criando wz ^^
Versão Imprimível
Server: Msg 3701, Level 11, State 5, Line 1
Cannot drop the procedure 'dbo.WZ_DISCONNECT_MEMB', because it does not exist in the system catalog.
nao esta criando wz ^^
Citação:
Postado originalmente por crazy_digital [Only registered and activated users can see links. Click Here To Register...]
O erro foi causado por não existir a procedure WZ_DISCONNECT_MEMB na sua database, mais eu removi o drop e o código acima foi apenas uma edição da postada anteriormente, voltem uma página e verão como é pra fazer!Código: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
Declare @cspoints int
Set @ConnectStat = 0
Set @find_id = 'NOT'
select @find_id = S.memb___id from MEMB_STAT S INNER JOIN MEMB_INFO I ON S.memb___id = I.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
Update MEMB_INFO SET gold = gold+(@OnlineHours * 2) WHERE memb___id = @memb___id
Update MEMB_STAT SET OnlineHours = 0 WHERE memb___id = @memb___id
end
end
go
Mensagem de moderação: Estou vendo muitos posts desnecessários em pessoal, por favor não "floodem"
Att. Ayrton Ricardo.
desculpa galera, esses dias to meio zuado e ainda fui fazer o negocio as pressas xD
ai os scripts corretos, se der erro no drop, é só executar novamente, e ja ta contanto certo a cada hora....
trigger: requer criação da Job para contabilizar os golds
Procedure: Não precisa da Job, ele ja da os GoldsCódigo: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
Código: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 S.memb___id = I.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
Credito da JOB -Ayrton Ricardo
testada e funcionando ! obrigado pela força
Citação:
esta job esta dando 10 gold a cada 1 hr ! se quizer mudar fique avontade so procurar Gold = Gold + 10
e alterar para a quantidade desejada ! (lembrando memb_info ) tera que ter a tabela gold
Citação:
BEGIN TRANSACTION
DECLARE @JobID BINARY(16)
DECLARE @ReturnCode INT
SELECT @ReturnCode = 0
IF (SELECT COUNT(*) FROM msdb.dbo.syscategories WHERE name = N'[Uncategorized (Local)]') < 1
EXECUTE msdb.dbo.sp_add_category @name = N'[Uncategorized (Local)]'
-- Delete the job with the same name (if it exists)
SELECT @JobID = job_id
FROM msdb.dbo.sysjobs
WHERE (name = N'EventGoldsHoras')
IF (@JobID IS NOT NULL)
BEGIN
-- Check if the job is a multi-server job
IF (EXISTS (SELECT *
FROM msdb.dbo.sysjobservers
WHERE (job_id = @JobID) AND (server_id <> 0)))
BEGIN
-- There is, so abort the script
RAISERROR (N'Unable to import job ''EventGoldsHoras'' since there is already a multi-server job with this name.', 16, 1)
GOTO QuitWithRollback
END
ELSE
-- Delete the [local] job
EXECUTE msdb.dbo.sp_delete_job @job_name = N'EventGoldsHoras'
SELECT @JobID = NULL
END
BEGIN
-- Add the job
EXECUTE @ReturnCode = msdb.dbo.sp_add_job @job_id = @JobID OUTPUT , @job_name = N'EventGoldsHoras', @owner_login_name = N'sa', @description = N'No description available.', @category_name = N'[Uncategorized (Local)]', @enabled = 1, @notify_level_email = 0, @notify_level_page = 0, @notify_level_netsend = 0, @notify_level_eventlog = 0, @delete_level= 0
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
-- Add the job steps
EXECUTE @ReturnCode = msdb.dbo.sp_add_jobstep @job_id = @JobID, @step_id = 1, @step_name = N'EventGoldsHoras3horas', @command = N'DECLARE @ConnectStat tinyint
DECLARE @memb___id varchar (10)
SELECT @memb___id=memb___id,@ConnectStat=ConnectStat FROM memb_stat WHERE ConnectStat=''1''
update memb_info set Gold = Gold + 10 where memb___id=@memb___id', @database_name = N'MuOnline', @server = N'', @database_user_name = N'', @subsystem = N'TSQL', @cmdexec_success_code = 0, @flags = 0, @retry_attempts = 0, @retry_interval = 0, @output_file_name = N'', @on_success_step_id = 0, @on_success_action = 1, @on_fail_step_id = 0, @on_fail_action = 2
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
EXECUTE @ReturnCode = msdb.dbo.sp_update_job @job_id = @JobID, @start_step_id = 1
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
-- Add the job schedules
EXECUTE @ReturnCode = msdb.dbo.sp_add_jobschedule @job_id = @JobID, @name = N'EventGoldsHoras3horas', @enabled = 1, @freq_type = 4, @active_start_date = 20100930, @active_start_time = 0, @freq_interval = 1, @freq_subday_type = 8, @freq_subday_interval = 1, @freq_relative_interval = 0, @freq_recurrence_factor = 0, @active_end_date = 99991231, @active_end_time = 235959
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
-- Add the Target Servers
EXECUTE @ReturnCode = msdb.dbo.sp_add_jobserver @job_id = @JobID, @server_name = N'(local)'
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
END
COMMIT TRANSACTION
GOTO EndSave
QuitWithRollback:
IF (@@TRANCOUNT > 0) ROLLBACK TRANSACTION
EndSave:
pessoal essa query postada pelo Ayrton Ricardo funciona em qualquer muserver e qualquer webshop ?
so estalar e modificar pras tabelas desejadas
Citação:
Postado originalmente por TOMASBORUS [Only registered and activated users can see links. Click Here To Register...]
tomas a primeira que o ayrton posto nao esta funcionando ... a minha ta atualizada ele me passou e pediu para ser postada aqui no forum !
se quizer que funcione so alterar para suas colunas aonde fica memb_info voce pode ta alterando para aonde localiza sua moeda !
Só pra avisar, a job do ayrton n vai calcular as horas dos players conforme eles ficam online.
Ela irá executar a cada 1 hora independente que o player fique 1 minuto ou 1 hora, se ele esiver on no momento da execução, ele tbm ganhará...