Junior Spellweaver
- Joined
- Nov 23, 2004
- Messages
- 125
- Reaction score
- 2
This is my own code, created from scratch. I take no responsibility for the use of my code. Expect Clan War procs when me and LGKiez get bored of them xD Kidding lol where working out bugs with point system atm.
Clan Table:
spGetCharClan:
spRemoveClanMember:
spRemoveClanMemberFromCharName:
spUpdateClanGrade:
spAddClanMember:
spCreateClan:
Clan Table:
Code:
USE [GunzDB]
GO
/****** Object: Table [dbo].[Clan] Script Date: 01/28/2007 10:28:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Clan](
[CLID] [int] NOT NULL,
[Level] [int] NULL,
[Name] [varchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ClanMaster] [varchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[EmblemURL] [varchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[TotalPoint] [int] NULL,
[Point] [int] NULL,
[Wins] [int] NULL,
[Losses] [int] NULL,
[MemberCount] [int] NULL,
[Ranking] [int] NULL,
[EmblemCheckSum] [varchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
spGetCharClan:
Code:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[spGetCharClan]
@nCID varchar(50)
AS
BEGIN
SET NOCOUNT ON;
SELECT ClanName
FROM Character
WHERE CID = @nCID
END
spRemoveClanMember:
Code:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Mackintosh> www.jointherev.org
-- Create date: <January 12, 2007>
-- Description: This procedure will enable Clan Masters
-- to remove current clan members.
-- =============================================
CREATE PROCEDURE [dbo].[spRemoveClanMember]
@CLID INT,
@CID INT
AS
BEGIN
UPDATE Character
SET ClanGrade = 0, ClanName = NULL, CLID = 0
WHERE CID = @CID
SELECT @CLID Ret
END
spRemoveClanMemberFromCharName:
Code:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Mackintosh> www.jointherev.org
-- Create date: <January 12, 2007>
-- Description: This procedure will enable Clan Masters
-- to remove current clan members.
-- =============================================
CREATE PROCEDURE [dbo].[spRemoveClanMemberFromCharName]
@CLID INT,
@CID INT,
@UserID VARCHAR(20)
AS
BEGIN
UPDATE Character
SET ClanGrade = 0, ClanName = NULL, CLID = 0
WHERE Name = @UserID
SELECT @CLID Ret
END
spUpdateClanGrade:
Code:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Mackintosh> www.jointherev.org
-- Create date: <January 12, 2007>
-- Description: Updates users status in the clan
-- ie. Leader
-- =============================================
CREATE PROCEDURE [dbo].[spUpdateClanGrade]
@CLID INT,
@CID INT,
@Grade INT
AS
BEGIN
UPDATE Character
SET ClanGrade = @Grade
WHERE CID = @CID
END
spAddClanMember:
Code:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[spAddClanMember]
@CLID int,
@CID int,
@unknown varchar(20)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @clanName VARCHAR(20)
SELECT @clanName = Name FROM Clan
WHERE CLID = @CLID
UPDATE Character
SET ClanName = @clanName
WHERE CID = @CID
UPDATE Character
SET CLID = @CLID
WHERE CID = @CID
SELECT @CLID Ret
END
spCreateClan:
Code:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[spCreateClan]
@ClanName varchar(50),
@Master int,
@Founder1 int,
@Founder2 int,
@Founder3 int,
@Founder4 int
AS
BEGIN
SET NOCOUNT ON;
DECLARE @clid INT
SELECT @clid=(COUNT(*)+1)
FROM Clan
-- Add Clan master and founders
UPDATE Character
SET ClanName = @ClanName,
CLID = @clid,
ClanGrade = 1
WHERE CID = @Master
UPDATE Character
SET ClanName = @ClanName,
CLID = @clid
WHERE CID = @Founder1
UPDATE Character
SET ClanName = @ClanName,
CLID = @clid
WHERE CID = @Founder2
UPDATE Character
SET ClanName = @ClanName,
CLID = @clid
WHERE CID = @Founder3
UPDATE Character
SET ClanName = @ClanName,
CLID = @clid
WHERE CID = @Founder4
INSERT INTO Clan ([CLID],[Name])
VALUES (@clid, @ClanName)
SELECT @clid Ret, @clid NewCLID
END
Last edited: