- Joined
- Aug 16, 2007
- Messages
- 1,378
- Reaction score
- 581
DB:{call sp_LogAction_Insert(1427,1,0,4,2330,0,0,0)}
DB:40001, NativeError:1205, [Microsoft][SQL Native Client][SQL Server]Transaction (Process ID 53) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
an SQL function failed to process making rollback thats what agent and field server displays
WHAT IS THIS?
how to get rid of it... its the first time it happens to me and it won't stop
ps : why each time I post a problem I end up finding the solution myself and all the hints I get are the wrong ones Quote "Its a virus"
its not somebody nor a virus, its the REBORN QUERY that isn't properly made (or any other triggers) you need build triggers in a way to read as low as possible rows when being executed :
update [chainfo] set [chainfo].ChaReborn = [chainfo].ChaReborn +1,
[chainfo].ChaLevel = 100,
[chainfo].ChaStRemain = ([chainfo].ChaPower + [chainfo].ChaDex + [chainfo].ChaSpirit + [chainfo].ChaStrong + [chainfo].ChaStrength+ [chainfo].ChaStRemain) -1935 ,
[chainfo].ChaPower = 0,
[chainfo].ChaSpirit = 0,
[chainfo].ChaDex = 0,
[chainfo].ChaStrength = 0,
[chainfo].ChaStrong = 1000,
[chainfo].Chaintel = [chainfo].ChaReborn +1
from inserted
where inserted.ChaLevel = 300
and inserted.ChaReborn < 180
you see that "INSERTED"? that makes the trigger only read the char that logged off right now instead of each char of the whole database
with that little detail you fix that problem
ps : why each time I post a problem I end up finding the solution myself and all the hints I get are the wrong ones Quote "Its a virus"
what do you mean, how can i fix that? sorry i dont know about queries i just copy them and put it in my database
/****** Object: Trigger dbo.Auto_Reborn Script Date: 3/3/2008 11:19:33 PM ******/
CREATE TRIGGER [dbo].[Auto_Reborn] ON dbo.ChaInfo
after update
as
BEGIN
Update [ChaInfo] set [ChaInfo].ChaLevel = 1, -- Level that you get after reborn
[ChaInfo].ChaReborn = [ChaInfo].ChaReborn + 1, -- Reborn counter
[ChaInfo].ChaExp = 0, -- Set Exp back to 0
[ChaInfo].ChaStRemain = ([ChaInfo].ChaStRemain + [ChaInfo].ChaPower + [ChaInfo].ChaStrong + [ChaInfo].ChaStrength + [ChaInfo].ChaSpirit + [ChaInfo].ChaDex ), -- how many stat points you get per reborn
[ChaInfo].ChaPower = 0, -- Set the number of Pow you added to 0
[ChaInfo].ChaStrong = 0, -- Set the number of Vit you added to 0
[ChaInfo].ChaStrength = 0, -- Set the number of Stm you added to 0
[ChaInfo].ChaSpirit = 0, -- Set the number of Int you added to 0
[ChaInfo].ChaDex = 0, -- Set the number of Dex you added to 0
[ChaInfo].ChaMoney = [ChaInfo].ChaMoney - 2000000, -- Optional : Reborn cost 2m
[ChaInfo].ChaSkillPoint = ([ChaInfo].ChaSkillPoint + (10*[ChaInfo].ChaReborn)), -- Set the Skillpoints per reborn
[ChaInfo].ChaQuest = NULL -- Optional : Delete quest list (need restart all quests) after reborn
From Inserted
Where Inserted.ChaLevel = 300 -- Level to reborn
and [ChaInfo].ChaReborn < 10 -- Max Reborn number
and [ChaInfo].ChaName = inserted.ChaName
and [ChaInfo].UserNum = inserted.UserNum
and [ChaInfo].ChaMoney >= 2000000 -- Optional : Require 2m gold for reborn
End
[ChaInfo].ChaStRemain = (200*[ChaInfo].ChaReborn), -- how many stat points you get per reborn
/****** Object: Trigger dbo.Auto_Reborn Script Date: 3/3/2008 11:19:33 PM ******/
CREATE TRIGGER [dbo].[Auto_Reborn] ON dbo.ChaInfo
after update
as
BEGIN
Update [ChaInfo] set [ChaInfo].ChaLevel = 1, -- Level that you get after reborn
[ChaInfo].ChaReborn = [ChaInfo].ChaReborn + 1, -- Reborn counter
[ChaInfo].ChaExp = 0, -- Set Exp back to 0
[ChaInfo].ChaStRemain = ([ChaInfo].ChaStRemain + [ChaInfo].ChaPower + [ChaInfo].ChaStrong + [ChaInfo].ChaStrength + [ChaInfo].ChaSpirit + [ChaInfo].ChaDex [COLOR="Red"]+200[/COLOR] ), -- how many stat points you get per reborn
[ChaInfo].ChaPower = 0, -- Set the number of Pow you added to 0
[ChaInfo].ChaStrong = 0, -- Set the number of Vit you added to 0
[ChaInfo].ChaStrength = 0, -- Set the number of Stm you added to 0
[ChaInfo].ChaSpirit = 0, -- Set the number of Int you added to 0
[ChaInfo].ChaDex = 0, -- Set the number of Dex you added to 0
[ChaInfo].ChaMoney = [ChaInfo].ChaMoney - 2000000, -- Optional : Reborn cost 2m
[ChaInfo].ChaSkillPoint = ([ChaInfo].ChaSkillPoint + (10*[ChaInfo].ChaReborn)), -- Set the Skillpoints per reborn
[ChaInfo].ChaQuest = NULL -- Optional : Delete quest list (need restart all quests) after reborn
From Inserted
Where Inserted.ChaLevel = 300 -- Level to reborn
and [ChaInfo].ChaReborn < 10 -- Max Reborn number
and [ChaInfo].ChaName = inserted.ChaName
and [ChaInfo].UserNum = inserted.UserNum
and [ChaInfo].ChaMoney >= 2000000 -- Optional : Require 2m gold for reborn
End
lol ?
that mean he will get 200 time the reborn for pointCode:[ChaInfo].ChaStRemain = (200*[ChaInfo].ChaReborn), -- how many stat points you get per reborn
if he reborn first time he will get 200 point
reborn 2x = 400
reborn 3x = 600
reborn 4x = 800
reborn 5x = 1000
that mean the one who get 1000 point it's his 5th x reborn and the otehr one is the 2x reborn that it your code is really not good
use mine
Code:/****** Object: Trigger dbo.Auto_Reborn Script Date: 3/3/2008 11:19:33 PM ******/ CREATE TRIGGER [dbo].[Auto_Reborn] ON dbo.ChaInfo after update as BEGIN Update [ChaInfo] set [ChaInfo].ChaLevel = 1, -- Level that you get after reborn [ChaInfo].ChaReborn = [ChaInfo].ChaReborn + 1, -- Reborn counter [ChaInfo].ChaExp = 0, -- Set Exp back to 0 [ChaInfo].ChaStRemain = ([ChaInfo].ChaStRemain + [ChaInfo].ChaPower + [ChaInfo].ChaStrong + [ChaInfo].ChaStrength + [ChaInfo].ChaSpirit + [ChaInfo].ChaDex [COLOR=Red]+200[/COLOR] ), -- how many stat points you get per reborn [ChaInfo].ChaPower = 0, -- Set the number of Pow you added to 0 [ChaInfo].ChaStrong = 0, -- Set the number of Vit you added to 0 [ChaInfo].ChaStrength = 0, -- Set the number of Stm you added to 0 [ChaInfo].ChaSpirit = 0, -- Set the number of Int you added to 0 [ChaInfo].ChaDex = 0, -- Set the number of Dex you added to 0 [ChaInfo].ChaMoney = [ChaInfo].ChaMoney - 2000000, -- Optional : Reborn cost 2m [ChaInfo].ChaSkillPoint = ([ChaInfo].ChaSkillPoint + (10*[ChaInfo].ChaReborn)), -- Set the Skillpoints per reborn [ChaInfo].ChaQuest = NULL -- Optional : Delete quest list (need restart all quests) after reborn From Inserted Where Inserted.ChaLevel = 300 -- Level to reborn and [ChaInfo].ChaReborn < 10 -- Max Reborn number and [ChaInfo].ChaName = inserted.ChaName and [ChaInfo].UserNum = inserted.UserNum and [ChaInfo].ChaMoney >= 2000000 -- Optional : Require 2m gold for reborn End
when i change NULL into 1 theres a error.[ChaInfo].ChaQuest = NULL -- Optional : Delete quest list (need restart all quests) after reborn
bro how to enable this part when i change NULL into 1 theres a error.
NULL mean no change all your quest will stay
If you put 0 = all quest gone and you need play all quest
CREATE TRIGGER [dbo].[Auto_Reborn] ON [dbo].[ChaInfo]
after update
as
BEGIN
Update [ChaInfo] set [ChaInfo].ChaLevel = 1, -- Level that you get after reborn
[ChaInfo].ChaReborn = [ChaInfo].ChaReborn + 1, -- Reborn counter
[ChaInfo].ChaExp = 0, -- Set Exp back to 0
[ChaInfo].ChaStRemain = ([ChaInfo].ChaStRemain + [ChaInfo].ChaPower + [ChaInfo].ChaStrong + [ChaInfo].ChaStrength + [ChaInfo].ChaSpirit + [ChaInfo].ChaDex + 0), -- how many stat points you get per reborn
[ChaInfo].ChaPower = 0, -- Set the number of Pow you added to 0
[ChaInfo].ChaStrong = 0, -- Set the number of Vit you added to 0
[ChaInfo].ChaStrength = 0, -- Set the number of Stm you added to 0
[ChaInfo].ChaSpirit = 0, -- Set the number of Int you added to 0
[ChaInfo].ChaDex = 0, -- Set the number of Dex you added to 0
[ChaInfo].ChaMoney = [ChaInfo].ChaMoney - 120000000, -- Optional : Reborn cost 2m
[ChaInfo].ChaSkillPoint = ([ChaInfo].ChaSkillPoint + (10*[ChaInfo].ChaReborn)), -- Set the Skillpoints per reborn
[ChaInfo].ChaQuest = 0, -- Optional : Delete quest list (need restart all quests) after reborn
From Inserted
Where Inserted.ChaLevel = 300 -- Level to reborn
and [ChaInfo].ChaReborn < 100 -- Max Reborn number
and [ChaInfo].ChaName = inserted.ChaName
and [ChaInfo].UserNum = inserted.UserNum
and [ChaInfo].ChaMoney >= 120000000 -- Optional : Require 2m gold for reborn
End
Here a good code for you just run it in ur SQL Query
Code:/****** Object: Trigger dbo.Auto_Reborn Script Date: 3/3/2008 11:19:33 PM ******/ CREATE TRIGGER [dbo].[Auto_Reborn] ON dbo.ChaInfo after update as BEGIN Update [ChaInfo] set [ChaInfo].ChaLevel = 1, -- Level that you get after reborn [ChaInfo].ChaReborn = [ChaInfo].ChaReborn + 1, -- Reborn counter [ChaInfo].ChaExp = 0, -- Set Exp back to 0 [ChaInfo].ChaStRemain = ([ChaInfo].ChaStRemain + [ChaInfo].ChaPower + [ChaInfo].ChaStrong + [ChaInfo].ChaStrength + [ChaInfo].ChaSpirit + [ChaInfo].ChaDex ), -- how many stat points you get per reborn [ChaInfo].ChaPower = 0, -- Set the number of Pow you added to 0 [ChaInfo].ChaStrong = 0, -- Set the number of Vit you added to 0 [ChaInfo].ChaStrength = 0, -- Set the number of Stm you added to 0 [ChaInfo].ChaSpirit = 0, -- Set the number of Int you added to 0 [ChaInfo].ChaDex = 0, -- Set the number of Dex you added to 0 [ChaInfo].ChaMoney = [ChaInfo].ChaMoney - 2000000, -- Optional : Reborn cost 2m [ChaInfo].ChaSkillPoint = ([ChaInfo].ChaSkillPoint + (10*[ChaInfo].ChaReborn)), -- Set the Skillpoints per reborn [ChaInfo].ChaQuest = NULL -- Optional : Delete quest list (need restart all quests) after reborn From Inserted Where Inserted.ChaLevel = 300 -- Level to reborn and [ChaInfo].ChaReborn < 10 -- Max Reborn number and [ChaInfo].ChaName = inserted.ChaName and [ChaInfo].UserNum = inserted.UserNum and [ChaInfo].ChaMoney >= 2000000 -- Optional : Require 2m gold for reborn End