- Joined
- Oct 18, 2005
- Messages
- 84
- Reaction score
- 0
Hi here is MY locator Proc. It works but not quite complete. This was made by ME and only by me. Also it might be a little messy because of trying to find out the locator options. so here it is and also its attched:
PS. if anyone gets the locator to say run tell everyone else
Code:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[spGetIPtoCountryList]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[spGetIPtoCountryList]
AS
BEGIN
SELECT IsBlock, RoutingURL
FROM BlockCountryCode
ORDER BY CountryCode3
END
'
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ServerStatus]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ServerStatus](
[ServerID] [int] NOT NULL,
[ServerName] [varchar](50) NOT NULL,
[MaxPlayer] [int] NOT NULL CONSTRAINT [DF_ServerStatus_MaxPlayer] DEFAULT ((2000)),
[CurrPlayer] [int] NOT NULL CONSTRAINT [DF_ServerStatus_CurrPlayer] DEFAULT ((0)),
[Time] [varchar](20) NULL,
[IP] [varchar](50) NOT NULL CONSTRAINT [DF_ServerStatus_IP] DEFAULT ('127.0.0.1'),
[Port] [int] NOT NULL,
[Opened] [nchar](10) NOT NULL,
CONSTRAINT [PK_ServerStatus] PRIMARY KEY CLUSTERED
(
[ServerID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[IPCountryCode]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[IPCountryCode](
[CountryCode3] [varchar](50) NOT NULL,
[IPTo] [text] NULL,
[IPFrom] [text] NULL,
CONSTRAINT [PK_IPCountryCode] PRIMARY KEY CLUSTERED
(
[CountryCode3] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[BlockCountryCode]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[BlockCountryCode](
[CountryCode3] [nchar](10) NOT NULL,
[RoutingURL] [nvarchar](50) NULL,
[IsBlock] [varchar](50) NULL CONSTRAINT [DF_BlockCountryCode_IsBlock] DEFAULT (N'no')
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Locator]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Locator](
[ServerID] [int] NOT NULL,
[IP] [nvarchar](50) NULL,
[Port] [int] NULL,
[Opened] [int] NULL,
[ServerName] [nchar](10) NULL,
[Players] [int] NOT NULL CONSTRAINT [DF_Locator_Players] DEFAULT ((0)),
CONSTRAINT [PK_Locator] PRIMARY KEY CLUSTERED
(
[ServerID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LocatorLog]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[LocatorLog](
[IP] [int] NOT NULL,
[Port] [int] NOT NULL,
[Count] [int] NOT NULL
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[spUpdateLocatorStatus]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[spUpdateLocatorStatus]
@ID INT,
@uidPlayer INT,
@CurrPlayer INT,
@nCode INT,
@Opened INT
AS
BEGIN
SET NOCOUNT ON;
UPDATE Locator
SET Players = @CurrPlayer, Opened = @Opened
END
'
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[spStartUpLocatorStatus]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[spStartUpLocatorStatus]
@ID INT,
@dwIP varchar(50),
@nPort INT,
@Opened INT
AS
BEGIN
DECLARE @cnt INT
SELECT @cnt=COUNT(*)
FROM Locator
WHERE ServerID = @ID
IF @cnt = 0
INSERT INTO ServerStatus
(ServerID, IP, Port, Opened)
VALUES (@ID,@dwIP,@nPort,1000)
END
'
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[spGetIPCountryCode]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[spGetIPCountryCode]
AS
BEGIN
SELECT CountryCode3, IPTo, IPFrom
FROM IPCountryCode
ORDER BY CountryCode3
END
'
END
PS. if anyone gets the locator to say run tell everyone else