[Help]Auto Unlock Ultimate Mode

08/24/2013 20:22 [Admin]Slice#1
Hey guys im trying to set auto unlock ultimate mode like when you select your faction and create a char ultimate mode is already unlocked and dont needa create a hard mode toon then relog for ultimate mode. just when you chose faction i want it to be unlocked. i searched and didnt find anything.. so yeah :p
08/24/2013 21:38 Philipp_#2
A trigger on the dbo.Users_Master table will do the job - Copy and paste the query below in a new query window and execute it.
Code:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Euphoria Dev Team
-- =============================================
CREATE TRIGGER UnlockUM
   ON  PS_UserData.dbo.Users_Master
   AFTER INSERT
AS 
BEGIN
	
	SET NOCOUNT ON;

	DECALRE @UserUID INT = (SELECT UserUID FROM inserted)

	INSERT INTO [PS_GameData].[dbo].[UserMaxGrow]
	([ServerID],[UserUID],[Country],[MaxGrow],[Del])
	VALUES(1,@UserUID,2,3,0)

END
GO
08/24/2013 21:44 [Admin]Slice#3
Quote:
Originally Posted by Philipp_ View Post
A trigger on the dbo.Users_Master table will do the job - Copy and paste the query below in a new query window and execute it.
Code:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Euphoria Dev Team
-- =============================================
CREATE TRIGGER UnlockUM
   ON  PS_UserData.dbo.Users_Master
   AFTER INSERT
AS 
BEGIN
	
	SET NOCOUNT ON;

    INSERT INTO [PS_GameData].[dbo].[UserMaxGrow]
	([ServerID],[UserUID],[Country],[MaxGrow],[Del])
	VALUES(1,(SELECT UserUID FROM inserted),2,3,0)

END
GO
Thanks ^_^ I'll try it

Error :
Msg 1046, Level 15, State 1, Procedure UnlockUM, Line 14
Subqueries are not allowed in this context. Only scalar expressions are allowed.
08/24/2013 22:55 nubness#4
There shouldn't be any error with Philipp's query, are you sure you copied it right ?

Here's another one you could try, in case you can't get the one Philipp posted to work:

08/24/2013 23:01 [Admin]Slice#5
Quote:
Originally Posted by nubness View Post
There shouldn't be any error with Philipp's query, are you sure you copied it right ?

Here's another one you could try, in case you can't get the one Philipp posted to work:

yeah im sure i did it right, its still not working. this is stupid.. >_<
08/24/2013 23:36 nubness#6
I'm afraid this isn't our problem. We always test what we release, and we never post something that doesn't work.
08/25/2013 00:42 [Admin]Slice#7
Quote:
Originally Posted by nubness View Post
I'm afraid this isn't our problem. We always test what we release, and we never post something that doesn't work.
i know, i didnt say it was. i just dont get why its not working. i really want UM when you chose faction :/

Fixed, Thanks To Nubness :)

Code:
-- ================================================
-- Template generated from Template Explorer using:
-- Create Trigger (New Menu).SQL
--
-- Use the Specify Values for Template Parameters 
-- command (Ctrl-Shift-M) to fill in the parameter 
-- values below.
--
-- See additional Create Trigger templates for more
-- examples of different Trigger statements.
--
-- This block of comments will not be included in
-- the definition of the function.
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE TRIGGER Unlock_UM
ON PS_UserData.dbo.Users_Master
AFTER INSERT
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
DECLARE @Sql NVARCHAR(1000)
 SET @Sql = N'INSERT INTO PS_GameData.dbo.UserMaxGrow VALUES(1,' + (SELECT UserUID FROM inserted) + ',2,3,0)'
 
 EXEC sp_executesql @Sql

    -- Insert statements for trigger here

END
GO
08/25/2013 15:54 AxelMac#8
Quote:
Originally Posted by [Admin]Slice View Post
i know, i didnt say it was. i just dont get why its not working. i really want UM when you chose faction :/

Fixed, Thanks To Nubness :)

need to have ultimate mod unlocked?
08/25/2013 16:58 nubness#9
Quote:
Originally Posted by AxelMac View Post
need to have ultimate mod unlocked?
Could you please read the whole thread before asking questions that have been answered ? I've seen you asking stupid questions on too many threads now.
08/25/2013 18:22 AxelMac#10
Quote:
Originally Posted by nubness View Post
Could you please read the whole thread before asking questions that have been answered ? I've seen you asking stupid questions on too many threads now.
I just asked if this does its job, saw that it was different from other post -.-''
08/25/2013 18:59 castor4878#11
well, I won't say "stupid" ones, when one really ignores a fact, it's not stupid to ask.
but, there (and indeed, in several posts) it is 100% meaningless.

Edit, to Alex:
"need to have ultimate mod unlocked?" is meaningless, since there is no subject.
"I just asked if this does its job" is meaningless, since only you know what "this" and "its" are.
08/25/2013 19:09 AxelMac#12
Quote:
Originally Posted by castor4878 View Post
well, I won't say "stupid" ones, when one really ignores a fact, it's not stupid to ask.
but, there (and indeed, in several posts) it is 100% meaningless.

Edit, to Alex:
"need to have ultimate mod unlocked?" is meaningless, since there is no subject.
"I just asked if this does its job" is meaningless, since only you know what "this" and "its" are.
because I'm Italian and I try to translate it to better, translate some words hurt
05/16/2014 20:04 shoree#13
Quote:
Originally Posted by Philipp_ View Post
A trigger on the dbo.Users_Master table will do the job - Copy and paste the query below in a new query window and execute it.
Code:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Euphoria Dev Team
-- =============================================
CREATE TRIGGER UnlockUM
   ON  PS_UserData.dbo.Users_Master
   AFTER INSERT
AS 
BEGIN
	
	SET NOCOUNT ON;

	DECALRE @UserUID INT = (SELECT UserUID FROM inserted)

	INSERT INTO [PS_GameData].[dbo].[UserMaxGrow]
	([ServerID],[UserUID],[Country],[MaxGrow],[Del])
	VALUES(1,@UserUID,2,3,0)

END
GO
the problem is so simple in that query look where it is DECALRE should be DECLARE its a human error only :D
05/19/2014 01:49 Autrux#14
#moved
11/30/2014 20:47 _Diavolino_#15
Hello,

Not working method or missing.

Quote:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Euphoria Dev Team
-- =============================================
CREATE TRIGGER UnlockUM
ON PS_UserData.dbo.Users_Master [COLOR="rgb(139, 0, 0)"]<-- trigger is working in the current database and should be attach to database correspondant PS_GameData.dbo.Users_Master BUT working when there is already the user in country, If new user arrive cant created new toon because of
Quote:
2014-11-30 20:39:50 err=-1, [Microsoft][ODBC SQL Server Driver][SQL Server]Violation of PRIMARY KEY constraint 'PK_UserMaxGrow'. Cannot insert duplicate key in object 'dbo.UserMaxGrow'. The duplicate key value is (1, 1006)., SQL STATE: 23000, NATIVE ERROR: 2627 (0xA43)

2014-11-30 20:39:50 ::SaveCountry 15 ret=0, qerr=-1, {?=call usp_Save_Char_Country_E(1,1006,1,1)}
[/COLOR]
AFTER INSERT
AS
BEGIN

SET NOCOUNT ON;

DECALRE @UserUID INT = (SELECT UserUID FROM inserted) <--Okey DeCLare as Shoree told,

INSERT INTO [PS_GameData].[dbo].[UserMaxGrow]
([ServerID],[UserUID],[Country],[MaxGrow],[Del])
VALUES(1,@UserUID,2,3,0)

END
GO