Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[RELEASE] Updated spInsertChar Creation Fix

Initiate Mage
Joined
Aug 4, 2006
Messages
88
Reaction score
0
Here's mine.. it has the structure to equip the item on the character when you make it.. so when you make char now.. item is already equip.. I re-order things a bit from the one a few post down.. then fetch CIID of every item.........if you can clean this up please do.. also please test that this work for you..

thanks to nekroido for original..

Modify the line VALUES(@nAID,@szName,@cnt,1,@nSex, ... if you want.. the 500000 is the starting bounty..

Code:
USE [GunzDB]
GO
/****** Object:  StoredProcedure [dbo].[spInsertChar]    Script Date: 03/28/2007 17:20:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[spInsertChar]
    @nAID INT,
    @nCharIndex INT,
    @szName nvarchar(32),
    @nSex INT,
    @nHair INT,
    @nFace INT,
    @nCostume INT
AS
BEGIN
    SET NOCOUNT ON;

    DECLARE @cnt INT
    SELECT @cnt=COUNT(*)
    FROM Character
    WHERE AID = @nAID

    DECLARE @cid INT
    SELECT @cid=COUNT(*)
    FROM Character

    INSERT INTO Character
    VALUES(@nAID,@szName,@cnt,1,@nSex,@nCostume,@nFace,@nHair,NULL,0,500000,0,0,0,0,0,0,0,0,0,0,0,0,@cnt,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL,getdate(),getdate(),0)

    DECLARE @charid INT
    SELECT @charid=CID
    FROM Character
    WHERE Name = @szName

IF @nSex = 0
BEGIN
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,21001)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,23001)

    DECLARE @ciid1 INT
    SELECT @ciid1=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 21001
    DECLARE @ciid2 INT
    SELECT @ciid2=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 23001

    UPDATE Character
    SET
    chest_itemid = 21001,
    legs_itemid = 23001,
    chest_slot = @ciid1,
    legs_slot = @ciid2
    WHERE CID = @charid
END
ELSE
BEGIN
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,21501)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,23501)

    DECLARE @ciid3 INT
    SELECT @ciid3=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 21501
    DECLARE @ciid4 INT
    SELECT @ciid4=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 23501

    UPDATE Character
    SET
    chest_itemid = 21501,
    legs_itemid = 23501,
    chest_slot = @ciid3,
    legs_slot = @ciid4
    WHERE CID = @charid
END

IF @nCostume = 0
BEGIN
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,1)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,5001)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,4001)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,30301)

    DECLARE @ciid5 INT
    SELECT @ciid5=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 1
    DECLARE @ciid6 INT
    SELECT @ciid6=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 5001
    DECLARE @ciid7 INT
    SELECT @ciid7=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 4001
    DECLARE @ciid8 INT
    SELECT @ciid8=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 30301

    UPDATE Character
    SET
    melee_itemid = 1,
    primary_itemid = 5001,
    secondary_itemid = 4001,
    custom1_itemid = 30301,
    melee_slot = @ciid5,
    primary_slot = @ciid6,
    secondary_slot = @ciid7,
    custom1_slot = @ciid8
    WHERE CID = @charid
END
ELSE IF @nCostume = 1
BEGIN
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,2)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,5002)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,30301)

    DECLARE @ciid9 INT
    SELECT @ciid9=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 2
    DECLARE @ciid10 INT
    SELECT @ciid10=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 5002
    DECLARE @ciid11 INT
    SELECT @ciid11=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 30301

    UPDATE Character
    SET
    melee_itemid = 2,
    primary_itemid = 5002,
    custom1_itemid = 30301,
    melee_slot = @ciid9,
    primary_slot = @ciid10,
    custom1_slot = @ciid11
    WHERE CID = @charid

END
ELSE IF @nCostume = 2
BEGIN
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,1)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,4005)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,5001)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,30401)

    DECLARE @ciid12 INT
    SELECT @ciid12=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 1
    DECLARE @ciid13 INT
    SELECT @ciid13=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 4005
    DECLARE @ciid14 INT
    SELECT @ciid14=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 5001
    DECLARE @ciid15 INT
    SELECT @ciid15=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 30401

    UPDATE Character
    SET
    melee_itemid = 1,
    primary_itemid = 4005,
    secondary_itemid = 5001,
    custom1_itemid = 30401,
    melee_slot = @ciid12,
    primary_slot = @ciid13,
    secondary_slot = @ciid14,
    custom1_slot = @ciid15
    WHERE CID = @charid

END
ELSE IF @nCostume = 3
BEGIN
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,2)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,4001)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,30301)

    DECLARE @ciid16 INT
    SELECT @ciid16=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 2
    DECLARE @ciid17 INT
    SELECT @ciid17=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 4001
    DECLARE @ciid18 INT
    SELECT @ciid18=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 30301

    UPDATE Character
    SET
    melee_itemid = 2,
    primary_itemid = 4001,
    custom1_itemid = 30401,
    melee_slot = @ciid16,
    primary_slot = @ciid17,
    custom1_slot = @ciid18
    WHERE CID = @charid
END
ELSE IF @nCostume = 4
BEGIN
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,2)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,4002)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,30401)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,30001)

    DECLARE @ciid19 INT
    SELECT @ciid19=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 2
    DECLARE @ciid20 INT
    SELECT @ciid20=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 4002
    DECLARE @ciid21 INT
    SELECT @ciid21=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 30401
    DECLARE @ciid22 INT
    SELECT @ciid22=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 30001

    UPDATE Character
    SET
    melee_itemid = 2,
    primary_itemid = 4002,
    custom1_itemid =30401,
    custom2_itemid = 30001,
    melee_slot = @ciid19,
    primary_slot = @ciid20,
    custom1_slot = @ciid21,
    custom2_slot = @ciid22
    WHERE CID = @charid

END
ELSE IF @nCostume = 5
BEGIN
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,1)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,40026)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,30101)
    INSERT INTO Items ([CID],[ItemID])
    VALUES(@charid,30001)

    DECLARE @ciid23 INT
    SELECT @ciid23=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 1
    DECLARE @ciid24 INT
    SELECT @ciid24=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 40026
    DECLARE @ciid25 INT
    SELECT @ciid25=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 30101
    DECLARE @ciid26 INT
    SELECT @ciid26=CIID
    FROM Items
    WHERE CID = @charid AND ItemID = 30001

    UPDATE Character
    SET
    melee_itemid = 1,
    primary_itemid = 4006,
    custom1_itemid = 30101,
    custom2_itemid = 30001,
    melee_slot = @ciid23,
    primary_slot = @ciid24,
    custom1_slot = @ciid25,
    custom2_slot = @ciid26
    WHERE CID = @charid
END

END
 
Junior Spellweaver
Joined
Mar 24, 2007
Messages
134
Reaction score
0
Works I Havn't Tested Yet But Commands Completed Suscefully
 
Junior Spellweaver
Joined
Mar 16, 2007
Messages
177
Reaction score
0
Mine's fixed too. %)
I can't see big differences between our sqls.
 
Initiate Mage
Joined
Aug 4, 2006
Messages
88
Reaction score
0
basically none.. just the CIID had to be fetched.. so i moved insert item to the top.. then fetch ciid.. then update character with everything.. just re ordering of code..
 
C/C++ Programmer
Joined
Mar 1, 2006
Messages
310
Reaction score
180
100% Bugged lol no post script buggeds.
USE [GunzDB]
GO
/****** Object: StoredProcedure [dbo].[spInsertChar] Script Date: 03/28/2007 17:20:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[spInsertChar]
@nAID INT,
@nCharIndex INT,
@szName nvarchar(32),
@nSex INT,
@nHair INT,
@nFace INT,
@nCostume INT
AS
BEGIN
SET NOCOUNT ON;

INSERT INTO Character
VALUES(@nAID,@szName,@nCharIndex,1,@nSex,@nCostume,@nFace,@nHair,NULL,NULL,1000,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,@nCharIndex,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)

DECLARE @charid INT
SELECT @charid=CID
FROM Character
WHERE Name = @szName

IF (@nSex = 0)
BEGIN
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,21001)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,23001)

DECLARE @ciid1 INT
SELECT @ciid1=CIID
FROM Items
WHERE CID = @charid AND ItemID = 21001
DECLARE @ciid2 INT
SELECT @ciid2=CIID
FROM Items
WHERE CID = @charid AND ItemID = 23001

UPDATE Character
SET
chest_itemid = 21001,
legs_itemid = 23001,
chest_slot = @ciid1,
legs_slot = @ciid2
WHERE CID = @charid
END
ELSE IF (@nSex = 1)
BEGIN
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,21501)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,23501)

DECLARE @ciid3 INT
SELECT @ciid3=CIID
FROM Items
WHERE CID = @charid AND ItemID = 21501
DECLARE @ciid4 INT
SELECT @ciid4=CIID
FROM Items
WHERE CID = @charid AND ItemID = 23501

UPDATE Character
SET
chest_itemid = 21501,
legs_itemid = 23501,
chest_slot = @ciid3,
legs_slot = @ciid4
WHERE CID = @charid
END

IF @nCostume = 0
BEGIN
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,1)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,5001)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,4001)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,30301)

DECLARE @ciid5 INT
SELECT @ciid5=CIID
FROM Items
WHERE CID = @charid AND ItemID = 1
DECLARE @ciid6 INT
SELECT @ciid6=CIID
FROM Items
WHERE CID = @charid AND ItemID = 5001
DECLARE @ciid7 INT
SELECT @ciid7=CIID
FROM Items
WHERE CID = @charid AND ItemID = 4001
DECLARE @ciid8 INT
SELECT @ciid8=CIID
FROM Items
WHERE CID = @charid AND ItemID = 30301

UPDATE Character
SET
melee_itemid = 1,
primary_itemid = 5001,
secondary_itemid = 4001,
custom1_itemid = 30301,
melee_slot = @ciid5,
primary_slot = @ciid6,
secondary_slot = @ciid7,
custom1_slot = @ciid8
WHERE CID = @charid
END
ELSE IF @nCostume = 1
BEGIN
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,2)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,5002)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,30301)

DECLARE @ciid9 INT
SELECT @ciid9=CIID
FROM Items
WHERE CID = @charid AND ItemID = 2
DECLARE @ciid10 INT
SELECT @ciid10=CIID
FROM Items
WHERE CID = @charid AND ItemID = 5002
DECLARE @ciid11 INT
SELECT @ciid11=CIID
FROM Items
WHERE CID = @charid AND ItemID = 30301

UPDATE Character
SET
melee_itemid = 2,
primary_itemid = 5002,
custom1_itemid = 30301,
melee_slot = @ciid9,
primary_slot = @ciid10,
custom1_slot = @ciid11
WHERE CID = @charid

END
ELSE IF @nCostume = 2
BEGIN
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,1)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,4005)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,5001)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,30401)

DECLARE @ciid12 INT
SELECT @ciid12=CIID
FROM Items
WHERE CID = @charid AND ItemID = 1
DECLARE @ciid13 INT
SELECT @ciid13=CIID
FROM Items
WHERE CID = @charid AND ItemID = 4005
DECLARE @ciid14 INT
SELECT @ciid14=CIID
FROM Items
WHERE CID = @charid AND ItemID = 5001
DECLARE @ciid15 INT
SELECT @ciid15=CIID
FROM Items
WHERE CID = @charid AND ItemID = 30401

UPDATE Character
SET
melee_itemid = 1,
primary_itemid = 4005,
secondary_itemid = 5001,
custom1_itemid = 30401,
melee_slot = @ciid12,
primary_slot = @ciid13,
secondary_slot = @ciid14,
custom1_slot = @ciid15
WHERE CID = @charid

END
ELSE IF @nCostume = 3
BEGIN
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,2)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,4001)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,30301)

DECLARE @ciid16 INT
SELECT @ciid16=CIID
FROM Items
WHERE CID = @charid AND ItemID = 2
DECLARE @ciid17 INT
SELECT @ciid17=CIID
FROM Items
WHERE CID = @charid AND ItemID = 4001
DECLARE @ciid18 INT
SELECT @ciid18=CIID
FROM Items
WHERE CID = @charid AND ItemID = 30301

UPDATE Character
SET
melee_itemid = 2,
primary_itemid = 4001,
custom1_itemid = 30401,
melee_slot = @ciid16,
primary_slot = @ciid17,
custom1_slot = @ciid18
WHERE CID = @charid
END
ELSE IF @nCostume = 4
BEGIN
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,2)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,4002)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,30401)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,30001)

DECLARE @ciid19 INT
SELECT @ciid19=CIID
FROM Items
WHERE CID = @charid AND ItemID = 2
DECLARE @ciid20 INT
SELECT @ciid20=CIID
FROM Items
WHERE CID = @charid AND ItemID = 4002
DECLARE @ciid21 INT
SELECT @ciid21=CIID
FROM Items
WHERE CID = @charid AND ItemID = 30401
DECLARE @ciid22 INT
SELECT @ciid22=CIID
FROM Items
WHERE CID = @charid AND ItemID = 30001

UPDATE Character
SET
melee_itemid = 2,
primary_itemid = 4002,
custom1_itemid =30401,
custom2_itemid = 30001,
melee_slot = @ciid19,
primary_slot = @ciid20,
custom1_slot = @ciid21,
custom2_slot = @ciid22
WHERE CID = @charid

END
ELSE IF @nCostume = 5
BEGIN
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,1)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,40026)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,30101)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,30001)

DECLARE @ciid23 INT
SELECT @ciid23=CIID
FROM Items
WHERE CID = @charid AND ItemID = 1
DECLARE @ciid24 INT
SELECT @ciid24=CIID
FROM Items
WHERE CID = @charid AND ItemID = 40026
DECLARE @ciid25 INT
SELECT @ciid25=CIID
FROM Items
WHERE CID = @charid AND ItemID = 30101
DECLARE @ciid26 INT
SELECT @ciid26=CIID
FROM Items
WHERE CID = @charid AND ItemID = 30001

UPDATE Character
SET
melee_itemid = 1,
primary_itemid = 4006,
custom1_itemid = 30101,
custom2_itemid = 30001,
melee_slot = @ciid23,
primary_slot = @ciid24,
custom1_slot = @ciid25,
custom2_slot = @ciid26
WHERE CID = @charid
END

END


Script Edited by My for full function. i'dont post my original script xD.
 
C/C++ Programmer
Joined
Mar 1, 2006
Messages
310
Reaction score
180
@cnt cause errors in Char Index and CID: you need use @nCharIndex from MatchServer for full function in CharIndex and CID.

END
ELSE
BEGIN? is incorrect

CORRECT:
END
ELSE IF (@nSex =1)
BEGIN
 
Junior Spellweaver
Joined
Mar 16, 2007
Messages
177
Reaction score
0
Initiate Mage
Joined
Apr 6, 2005
Messages
53
Reaction score
11
wtf more than 300 lines o_O, the mine have less than 200 lines lol
 
Junior Spellweaver
Joined
Feb 19, 2007
Messages
178
Reaction score
0
Msg 137, Level 15, State 2, Procedure spInsertChar, Line 14
Must declare the scalar variable "@nCharInde".

with SirMisters ..
 
Junior Spellweaver
Joined
Mar 16, 2007
Messages
177
Reaction score
0
All BUGGED @nSex = 0 is MALE no Female lol.
If u're noob in sql, don't say "it's all bugged".

IF @nSex != 0 — if variable @nSex NOT EQUAL '0', dumbo.


And once again I say to ya all: check my code here.
 
C/C++ Programmer
Joined
Mar 1, 2006
Messages
310
Reaction score
180
USE [GunzDB]
GO
/****** Object: StoredProcedure [dbo].[spInsertChar] Script Date: 03/28/2007 17:20:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[spInsertChar]
@nAID INT,
@nCharIndex INT,
@szName nvarchar(32),
@nSex INT,
@nHair INT,
@nFace INT,
@nCostume INT
AS
BEGIN
SET NOCOUNT ON;

INSERT INTO Character
VALUES(@nAID,@szName,@nCharIndex,1,@nSex,@nCostume ,@nFace,@nHair,NULL,NULL,1000,NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,@nCharIndex,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NUL L,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NUL L,NULL,NULL,NULL,NULL,NULL)

DECLARE @charid INT
SELECT @charid=CID
FROM Character
WHERE Name = @szName

IF (@nSex = 0)
BEGIN
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,21001)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,23001)

DECLARE @ciid1 INT
SELECT @ciid1=CIID
FROM Items
WHERE CID = @charid AND ItemID = 21001
DECLARE @ciid2 INT
SELECT @ciid2=CIID
FROM Items
WHERE CID = @charid AND ItemID = 23001

UPDATE Character
SET
chest_itemid = 21001,
legs_itemid = 23001,
chest_slot = @ciid1,
legs_slot = @ciid2
WHERE CID = @charid
END
ELSE IF (@nSex = 1)
BEGIN
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,21501)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,23501)

DECLARE @ciid3 INT
SELECT @ciid3=CIID
FROM Items
WHERE CID = @charid AND ItemID = 21501
DECLARE @ciid4 INT
SELECT @ciid4=CIID
FROM Items
WHERE CID = @charid AND ItemID = 23501

UPDATE Character
SET
chest_itemid = 21501,
legs_itemid = 23501,
chest_slot = @ciid3,
legs_slot = @ciid4
WHERE CID = @charid
END

IF @nCostume = 0
BEGIN
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,1)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,5001)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,4001)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,30301)

DECLARE @ciid5 INT
SELECT @ciid5=CIID
FROM Items
WHERE CID = @charid AND ItemID = 1
DECLARE @ciid6 INT
SELECT @ciid6=CIID
FROM Items
WHERE CID = @charid AND ItemID = 5001
DECLARE @ciid7 INT
SELECT @ciid7=CIID
FROM Items
WHERE CID = @charid AND ItemID = 4001
DECLARE @ciid8 INT
SELECT @ciid8=CIID
FROM Items
WHERE CID = @charid AND ItemID = 30301

UPDATE Character
SET
melee_itemid = 1,
primary_itemid = 5001,
secondary_itemid = 4001,
custom1_itemid = 30301,
melee_slot = @ciid5,
primary_slot = @ciid6,
secondary_slot = @ciid7,
custom1_slot = @ciid8
WHERE CID = @charid
END
ELSE IF @nCostume = 1
BEGIN
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,2)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,5002)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,30301)

DECLARE @ciid9 INT
SELECT @ciid9=CIID
FROM Items
WHERE CID = @charid AND ItemID = 2
DECLARE @ciid10 INT
SELECT @ciid10=CIID
FROM Items
WHERE CID = @charid AND ItemID = 5002
DECLARE @ciid11 INT
SELECT @ciid11=CIID
FROM Items
WHERE CID = @charid AND ItemID = 30301

UPDATE Character
SET
melee_itemid = 2,
primary_itemid = 5002,
custom1_itemid = 30301,
melee_slot = @ciid9,
primary_slot = @ciid10,
custom1_slot = @ciid11
WHERE CID = @charid

END
ELSE IF @nCostume = 2
BEGIN
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,1)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,4005)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,5001)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,30401)

DECLARE @ciid12 INT
SELECT @ciid12=CIID
FROM Items
WHERE CID = @charid AND ItemID = 1
DECLARE @ciid13 INT
SELECT @ciid13=CIID
FROM Items
WHERE CID = @charid AND ItemID = 4005
DECLARE @ciid14 INT
SELECT @ciid14=CIID
FROM Items
WHERE CID = @charid AND ItemID = 5001
DECLARE @ciid15 INT
SELECT @ciid15=CIID
FROM Items
WHERE CID = @charid AND ItemID = 30401

UPDATE Character
SET
melee_itemid = 1,
primary_itemid = 4005,
secondary_itemid = 5001,
custom1_itemid = 30401,
melee_slot = @ciid12,
primary_slot = @ciid13,
secondary_slot = @ciid14,
custom1_slot = @ciid15
WHERE CID = @charid

END
ELSE IF @nCostume = 3
BEGIN
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,2)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,4001)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,30301)

DECLARE @ciid16 INT
SELECT @ciid16=CIID
FROM Items
WHERE CID = @charid AND ItemID = 2
DECLARE @ciid17 INT
SELECT @ciid17=CIID
FROM Items
WHERE CID = @charid AND ItemID = 4001
DECLARE @ciid18 INT
SELECT @ciid18=CIID
FROM Items
WHERE CID = @charid AND ItemID = 30301

UPDATE Character
SET
melee_itemid = 2,
primary_itemid = 4001,
custom1_itemid = 30401,
melee_slot = @ciid16,
primary_slot = @ciid17,
custom1_slot = @ciid18
WHERE CID = @charid
END
ELSE IF @nCostume = 4
BEGIN
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,2)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,4002)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,30401)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,30001)

DECLARE @ciid19 INT
SELECT @ciid19=CIID
FROM Items
WHERE CID = @charid AND ItemID = 2
DECLARE @ciid20 INT
SELECT @ciid20=CIID
FROM Items
WHERE CID = @charid AND ItemID = 4002
DECLARE @ciid21 INT
SELECT @ciid21=CIID
FROM Items
WHERE CID = @charid AND ItemID = 30401
DECLARE @ciid22 INT
SELECT @ciid22=CIID
FROM Items
WHERE CID = @charid AND ItemID = 30001

UPDATE Character
SET
melee_itemid = 2,
primary_itemid = 4002,
custom1_itemid =30401,
custom2_itemid = 30001,
melee_slot = @ciid19,
primary_slot = @ciid20,
custom1_slot = @ciid21,
custom2_slot = @ciid22
WHERE CID = @charid

END
ELSE IF @nCostume = 5
BEGIN
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,1)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,40026)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,30101)
INSERT INTO Items ([CID],[ItemID])
VALUES(@charid,30001)

DECLARE @ciid23 INT
SELECT @ciid23=CIID
FROM Items
WHERE CID = @charid AND ItemID = 1
DECLARE @ciid24 INT
SELECT @ciid24=CIID
FROM Items
WHERE CID = @charid AND ItemID = 40026
DECLARE @ciid25 INT
SELECT @ciid25=CIID
FROM Items
WHERE CID = @charid AND ItemID = 30101
DECLARE @ciid26 INT
SELECT @ciid26=CIID
FROM Items
WHERE CID = @charid AND ItemID = 30001

UPDATE Character
SET
melee_itemid = 1,
primary_itemid = 4006,
custom1_itemid = 30101,
custom2_itemid = 30001,
melee_slot = @ciid23,
primary_slot = @ciid24,
custom1_slot = @ciid25,
custom2_slot = @ciid26
WHERE CID = @charid
END

END




@nCharInde x Fixed. Now @nCharIndex.


IF (@nSex = 0) Check Sex is male use this script.
IF (@nSex = 1) Check Sex is Female use this script.

No more noob Answers ok?.


and i'dont upload my originals scripts and DataBase ok? no ask more for my DB.
 
Junior Spellweaver
Joined
Mar 16, 2007
Messages
177
Reaction score
0
Well, SirMaster, AFAIC u're not programmer if don't know "!=" statement(it means "NOT EQUAL").
MatchServer will give two values of variable @nSex — 0 or 1, male or female.
So "ELSE IF @nSex = 1" IS NOT necessary here. Just "ELSE" is enough.

Etiolated fix has lots of variables, SQL must not have lots of them, 'cause it will "eat" lots of memory.
 
C/C++ Programmer
Joined
Mar 1, 2006
Messages
310
Reaction score
180
Nekroido ELSE IF (@nSex = 1) is necesary.
since if it does not have commando the IF (@nSex = 1) does not serve since it also created the items of women in the personages of men. it learns a little Administration of Data base you are not so beast.
 
Back
Top