Entao As Script Que Eu Falo e Dessa Aqui Ola
-----------------------------------------------------------------
USE [PS_GameData]
GO
/****** Object: Trigger [dbo].[GM_Enchant] Script Date: 02/26/2015 00:06:30 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[GM_Enchant]
ON [dbo].[CharQuests]
AFTER INSERT
AS
BEGIN
SET NOCOUNT ON;
DECLARE @QuestID INT = (SELECT QuestID FROM inserted)
IF @QuestID = 1720 -- QuestID
BEGIN
DECLARE @CharID INT = (SELECT CharID FROM inserted)
DECLARE @UserUID INT = (SELECT UserUID FROM Chars WHERE CharID = @CharID)
DECLARE @ItemType TINYINT,
@EnchantItemId INT
DECLARE @EnchantItem TABLE (EnchantID INT)
DECLARE @GearTypes TABLE (GearTypes TINYINT)
SET @ItemType = (SELECT Type FROM UserStoredItems WHERE UserUID = @UserUID AND Slot = 0)
SET @EnchantItemId = (SELECT ItemID FROM UserStoredItems WHERE UserUID = @UserUID AND Slot = 1)
-- the perfect lapisia itemid, change it for you needs
INSERT INTO @EnchantItem VALUES (100209)
-- add all the gear types you want to use here
INSERT INTO @GearTypes VALUES (16),(17),(18),(19),(20),(21),(31),(32),(33),(34),(35),(36),(72),(73),(74),(76),(77),(87),(88),(89),(91),(92),(86),(82),(83),(71),(67),(68)
IF ((@ItemType IN (SELECT GearTypes FROM @GearTypes)) AND (@EnchantItemID IN (SELECT EnchantID FROM @EnchantItem)))
BEGIN
DECLARE @Enchant TINYINT = (SELECT CAST(SUBSTRING(Craftname, 19, 2) AS TINYINT) FROM UserStoredItems WHERE UserUID = @UserUID AND Slot = 0)
--- max enchant its [11]
IF @Enchant > = 61
GOTO FAIL
ELSE IF @Enchant > = 10 AND @Enchant < 50
GOTO FAIL
SET @Enchant += 1 -- this will increase the enchant by 1
DECLARE @EnchantString CHAR(2) = @Enchant
IF LEN(@EnchantString) = 1
SET @EnchantString = '0' + @EnchantString
UPDATE UserStoredItems
SET Craftname = SUBSTRING(Craftname, 1, 18) + @EnchantString
WHERE UserUID = @UserUID AND Slot = 0
END
ELSE GOTO FAIL
UPDATE UserStoredItems
SET Count -= 1
WHERE UserUID = @UserUID AND Slot = 1
DELETE FROM UserStoredItems
WHERE UserUID = @UserUID AND Slot = 1 AND Count = 0
FAIL:
DELETEQUEST:
DELETE FROM CharQuests
WHERE CharID = @CharID AND QuestID = @QuestID
END
END
GO
---------------------------------------------------------------
So Que Eu Nao Sei Onde Colar e Executar Quando Eu Executo ela da um erro e nao acontece nada.
esse ERRO aqui https://noblesgames.forumeiros.com/t516-prefixo-3-script#2004