Automatic Scoring System (AP)

02/17/2013 14:03 yukolo#1
Hi I have the following point system that automatically committed automated AP system, the same figure is a one-to-
23 hours in the game not to be alone, even committed despite my tsar 1 point
I wonder if I have the following code, I did a mistake or there is missing something you have processed the following code to MySQL mysql my system 2008R2
I want our servers to enable automatic point system
So long as the game points to win clients and
itemmal item scores will buy it.
I found I just committed this code did not work, please help me thank you in advance
Sorry for my english is bad


Quote:
USE [PS_UserData]
GO
/****** Object: StoredProcedure [dbo].[usp_Try_GameLogout_R] Script Date: 02/17/2013 14:50:51 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

/****** Object: Stored Procedure dbo.usp_Try_GameLogout_R Script Date: 2008-6-7 18:34:05 ******/
ALTER Proc [dbo].[usp_Try_GameLogout_R]

/*
Created by humanws, 2005-10-18
???? ?? ??
*/

@UserUID int,
@SessionID bigint,
@LogoutType smallint = 0,
@ErrType int = 0

AS

SET NOCOUNT ON

DECLARE @LogTime datetime
DECLARE @Sql nvarchar(4000)
DECLARE @yyyy varchar(4)
DECLARE @mm varchar(2)
DECLARE @dd varchar(2)
DECLARE @LogType bit -- Login:0, Logout:1

SET @LogType = 1
SET @LogTime = GETDATE()
SET @yyyy = DATEPART(yyyy, @LogTime)
SET @mm = DATEPART(mm, @LogTime)
SET @dd = DATEPART(dd, @LogTime)

IF( LEN(@mm) = 1 )
BEGIN
SET @mm = '0' + @mm
END

IF( LEN(@dd) = 1 )
BEGIN
SET @dd = '0' + @dd
END
UPDATE Users_Master SET Leave = 0, LeaveDate = GETDATE() WHERE UserUID = @UserUID

SET @Sql = N'
INSERT INTO PS_GameLog.dbo.UserLog
(SessionID, UserUID, LogType, LogTime, LogoutType, ErrType)
VALUES(@SessionID, @UserUID, @LogType, @LogTime, @LogoutType, @ErrType)'

EXEC sp_executesql @Sql,
N'@SessionID bigint, @UserUID int, @LogType bit, @LogTime datetime, @LogoutType smallint, @ErrType int',
@SessionID, @UserUID, @LogType, @LogTime, @LogoutType, @ErrType
update PS_UserData.dbo.UserLoginStatus
set LoginStatus=0,LogoutTime=@LogTime,LogoutSession=@S essionID,LastPlayTime=datediff(minute,LoginTime,@L ogTime)
where UserUID=@UserUID

DECLARE @LoginTime datetime
DECLARE @LastPlayTime int
DECLARE @OldPoint int
DECLARE @LoginSession bigint
SET @LoginSession=(select LoginSession from PS_UserData.dbo.UserLoginStatus where UserUID=@UserUID)
SET @LastPlayTime=(select LastPlayTime from PS_UserData.dbo.UserLoginStatus where UserUID=@UserUID)
SET @LoginTime=(select LoginTime from PS_UserData.dbo.UserLoginStatus where UserUID=@UserUID)
SET @OldPoint=(select Point from PS_UserData.dbo.Users_Master where UserUID=@UserUID)
IF (@SessionID=@LoginSession)
BEGIN
Update PS_UserData.dbo.Users_Master
SET point= 1
WHERE UserUID=@UserUID
INSERT INTO PS_UserData.dbo.UserOnlineTimeLog(UserUID,OldPoint ,Addpoint,LoginTime,LogoutTime,SessionID)
values(@UserUID,@OldPoint,@LastPlayTime,@LoginTime ,@LogTime,@SessionID)
end
SET NOCOUNT OFF
02/17/2013 22:29 JohnHeatz#2
I just checked it briefly and I can spot a huge problem with this:

Code:
BEGIN
Update PS_UserData.dbo.Users_Master
SET point= 1
WHERE UserUID=@UserUID
You are not adding + 1 point to the AP of your players, you are always setting it up to 1. I might be mistaken, yet this is what might be giving you issues.
02/17/2013 22:35 yukolo#3
What I do not understand exactly what you mean to do that
02/17/2013 23:03 [DEV]xXDASHXx#4
BEGIN
Update PS_UserData.dbo.Users_Master
SET point= 1
WHERE UserUID=@UserUID


looking at it ta me this line needs to read something to this efect

BEGIN
Update PS_UserData.dbo.Users_Master
SET point= [Point]+1
WHERE UserUID=@UserUID

this will take the curent row point and add 1 as where your previous setup just updated the point to 1 and never added anything
02/17/2013 23:54 JohnHeatz#5
Exactly, as I said, you are not adding points but just setting them, whatever amount is there, back to 1 instead of actually adding + 1 to current points.
02/18/2013 14:34 yukolo#6
Thanks to this too, I figured I would much as you say you set the gerekmiş RESOLVED theothers
:) :)