Top Duel [ 4FUNer coding request ]
Ok bro so after your great Release of top modules, I have one more request, if we can do this for our server :
Take a look here and you will understand what I mean :
http://img38.imageshack.us/img38/6774/oop.png
PS : If you will work on something about this module , can you please keep the same style as your modules in Release section ? I have all blended in and that Gray you used is amazing.
Thank you in advance, Martin !
Re: Top Duel [ 4FUNer coding request ]
Well will require new ado connection since it is suspossed to be in Ranking database
anw check if you have DUEL_INFO table, in Ranking databse and give me screenshot or names of all the columns, & i'll see.
Re: Top Duel [ 4FUNer coding request ]
Quote:
Originally Posted by
4FUNer
Well will require new ado connection since it is suspossed to be in Ranking database
anw check if you have DUEL_INFO table, in Ranking databse and give me screenshot or names of all the columns, & i'll see.
I don't think I have it ... http://img69.imageshack.us/img69/3194/nsuu.png
Re: Top Duel [ 4FUNer coding request ]
Then i have no idea if/where your db store Duel Info :)
Re: Top Duel [ 4FUNer coding request ]
Quote:
Originally Posted by
4FUNer
Then i have no idea if/where your db store Duel Info :)
Damn ... maybe someone else could tell us ?
PS : I just find out a thing you don't know hurrrreeeyyy ! :thumbup:
Re: Top Duel [ 4FUNer coding request ]
Anyone can help me and Martin with a clue about this module ?
Re: Top Duel [ 4FUNer coding request ]
Quote:
Originally Posted by
epocal
Anyone can help me and Martin with a clue about this module ?
Help you not me :D i got table for save duel info and ranking ^^
ur db missing it in Ranking DB or use different place to save :)
You can try create & test (i guess u use tt files)
Execute query on Ranking DB
Code:
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DUEL_INFO]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[DUEL_INFO]
GO
CREATE TABLE [dbo].[DUEL_INFO] (
[ID] [int] IDENTITY (1, 1) NOT NULL ,
[ServerCode] [int] NOT NULL ,
[Account] [varchar] (10) COLLATE Modern_Spanish_CI_AS NOT NULL ,
[Name] [varchar] (10) COLLATE Modern_Spanish_CI_AS NOT NULL ,
[Win] [int] NOT NULL ,
[Lost] [int] NOT NULL ,
[Average] [int] NOT NULL
) ON [PRIMARY]
GO
& create procedure
Code:
CREATE PROCEDURE [dbo].[TT_DuelScore]
@ServerCode INT,
@AccountID VARCHAR(10),
@Name VARCHAR(10),
@Result INT,
@Average INT
As
Begin
BEGIN TRANSACTION
SET NOCOUNT ON
IF EXISTS (SELECT NULL FROM DUEL_INFO WHERE Account = @AccountID AND Name = @Name AND ServerCode = @ServerCode)
IF(@Result = 1)
UPDATE DUEL_INFO SET Win = Win+1, Average = Average + @Average WHERE Account = @AccountID AND Name = @Name AND ServerCode = @ServerCode
ELSE
UPDATE DUEL_INFO SET Lost = Lost+1, Average = Average + @Average WHERE Account = @AccountID AND Name = @Name AND ServerCode = @ServerCode
ELSE
IF(@Result = 1)
INSERT INTO DUEL_INFO (ServerCode, Account, Name, Win, Lost, Average) VALUES (@ServerCode,@AccountID,@Name,1,0,@Average)
ELSE
INSERT INTO DUEL_INFO (ServerCode, Account, Name, Win, Lost, Average) VALUES (@ServerCode,@AccountID,@Name,0,1,@Average)
IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
SET NOCOUNT OFF
End
GO
& test in game if duel info will be saved after win / losse
I've ready ranking, so it will be like few secs to release xD
Re: Top Duel [ 4FUNer coding request ]
Quote:
Originally Posted by
4FUNer
Help you not me :D i got table for save duel info and ranking ^^
ur db missing it in Ranking DB or use different place to save :)
You can try create & test (i guess u use tt files)
Execute query on Ranking DB
Code:
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DUEL_INFO]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[DUEL_INFO]
GO
CREATE TABLE [dbo].[DUEL_INFO] (
[ID] [int] IDENTITY (1, 1) NOT NULL ,
[ServerCode] [int] NOT NULL ,
[Account] [varchar] (10) COLLATE Modern_Spanish_CI_AS NOT NULL ,
[Name] [varchar] (10) COLLATE Modern_Spanish_CI_AS NOT NULL ,
[Win] [int] NOT NULL ,
[Lost] [int] NOT NULL ,
[Average] [int] NOT NULL
) ON [PRIMARY]
GO
& create procedure
Code:
CREATE PROCEDURE [dbo].[TT_DuelScore]
@ServerCode INT,
@AccountID VARCHAR(10),
@Name VARCHAR(10),
@Result INT,
@Average INT
As
Begin
BEGIN TRANSACTION
SET NOCOUNT ON
IF EXISTS (SELECT NULL FROM DUEL_INFO WHERE Account = @AccountID AND Name = @Name AND ServerCode = @ServerCode)
IF(@Result = 1)
UPDATE DUEL_INFO SET Win = Win+1, Average = Average + @Average WHERE Account = @AccountID AND Name = @Name AND ServerCode = @ServerCode
ELSE
UPDATE DUEL_INFO SET Lost = Lost+1, Average = Average + @Average WHERE Account = @AccountID AND Name = @Name AND ServerCode = @ServerCode
ELSE
IF(@Result = 1)
INSERT INTO DUEL_INFO (ServerCode, Account, Name, Win, Lost, Average) VALUES (@ServerCode,@AccountID,@Name,1,0,@Average)
ELSE
INSERT INTO DUEL_INFO (ServerCode, Account, Name, Win, Lost, Average) VALUES (@ServerCode,@AccountID,@Name,0,1,@Average)
IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
SET NOCOUNT OFF
End
GO
& test in game if duel info will be saved after win / losse
I've ready ranking, so it will be like few secs to release xD
Bro, where do I create that procedure ?
2. Where can I see if it records the duel info after I test it ?
Re: Top Duel [ 4FUNer coding request ]
Quote:
Originally Posted by
epocal
Bro, where do I create that procedure ?
2. Where can I see if it records the duel info after I test it ?
Told you execute Query's on Ranking database in SQL Query Analyzer
Where you can see ? checking in SQL -> DUEL_INFO TABLE after correctly adding table&procedue
& few duels in game xD
shud work but you never know...
Re: Top Duel [ 4FUNer coding request ]
Let me explain myself better :
I know how to execute this on Ranking DB :
Code:
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DUEL_INFO]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[DUEL_INFO]
GO
CREATE TABLE [dbo].[DUEL_INFO] (
[ID] [int] IDENTITY (1, 1) NOT NULL ,
[ServerCode] [int] NOT NULL ,
[Account] [varchar] (10) COLLATE Modern_Spanish_CI_AS NOT NULL ,
[Name] [varchar] (10) COLLATE Modern_Spanish_CI_AS NOT NULL ,
[Win] [int] NOT NULL ,
[Lost] [int] NOT NULL ,
[Average] [int] NOT NULL
) ON [PRIMARY]
GO
2. How to create a procedure with this ?
Code:
CREATE PROCEDURE [dbo].[TT_DuelScore]
@ServerCode INT,
@AccountID VARCHAR(10),
@Name VARCHAR(10),
@Result INT,
@Average INT
As
Begin
BEGIN TRANSACTION
SET NOCOUNT ON
IF EXISTS (SELECT NULL FROM DUEL_INFO WHERE Account = @AccountID AND Name = @Name AND ServerCode = @ServerCode)
IF(@Result = 1)
UPDATE DUEL_INFO SET Win = Win+1, Average = Average + @Average WHERE Account = @AccountID AND Name = @Name AND ServerCode = @ServerCode
ELSE
UPDATE DUEL_INFO SET Lost = Lost+1, Average = Average + @Average WHERE Account = @AccountID AND Name = @Name AND ServerCode = @ServerCode
ELSE
IF(@Result = 1)
INSERT INTO DUEL_INFO (ServerCode, Account, Name, Win, Lost, Average) VALUES (@ServerCode,@AccountID,@Name,1,0,@Average)
ELSE
INSERT INTO DUEL_INFO (ServerCode, Account, Name, Win, Lost, Average) VALUES (@ServerCode,@AccountID,@Name,0,1,@Average)
IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
SET NOCOUNT OFF
End
GO
Create procedure with query execution too ? On ranking database ? or how ?
3. " after correctly adding table&procedue " - what table ? where to add it ? more specific ?
I might be a little sleepy and I don't understand you this morning :)) Thank you in advance !
Re: Top Duel [ 4FUNer coding request ]
Re: Top Duel [ 4FUNer coding request ]
Quote:
Originally Posted by
4FUNer
No comment.
I'll try ........... :sleep:
Re: Top Duel [ 4FUNer coding request ]
Quote:
Originally Posted by
epocal
I'll try ........... :sleep:
Hehe just execute procedure query in sql query analyzer, why no comment? cuz google would tell u the same ;)
Re: Top Duel [ 4FUNer coding request ]
Quote:
Originally Posted by
4FUNer
Hehe just execute procedure query in sql query analyzer, why no comment? cuz google would tell u the same ;)
I've executed the 2 codes with query on the Ranking database, like this :
http://img29.imageshack.us/img29/830/ny47.png
Now I will make some duels to see if it records, where should I see the records ? In ranking database / tables ?
Re: Top Duel [ 4FUNer coding request ]
in table you've created - DUEL_INFO
should be
win = 1 on 1st char
and on second lost = 1