LoginStatus problem

03/19/2018 15:44 [PH]KEO(DEV)#1
LoginStatus not Detect! please help how to fix this? thanks
03/19/2018 15:52 {Skrillex}#2
Hi,
please explain your problem more.

Regards
03/19/2018 15:58 [PH]KEO(DEV)#3
Quote:
Originally Posted by .:Skrillex:. View Post
Hi,
please explain your problem more.

Regards
LoginStatus problem .. (Online Players)
can't detect if the players is online or offline.. my php script is correct .. i think in SQL scripts i need! can you help me?
03/19/2018 16:06 {Skrillex}#4
Hi,
sure I can.

ADD the query below in
Quote:
PS_GameLog -> Programmability -> Stored Procedures -> usp_Insert_Action_Log_E
Quote:
IF (@ActionType = '107')
BEGIN
DECLARE @CheckCountry int

-- Get country of the player
-- 0: Light 1: Dark
SET @CheckCountry = (SELECT Country FROM PS_GameData.dbo.UserMaxGrow WHERE UserUID = @UserUID)

IF (@CheckCountry = '0') -- light
BEGIN
UPDATE PS_GameData.dbo.Chars SET LoginStatus = '1' WHERE CharID = @CharID
END
IF (@CheckCountry = '1') -- dark
BEGIN
UPDATE PS_GameData.dbo.Chars SET LoginStatus = '2' WHERE CharID = @CharID
END

END

IF (@ActionType = '108')
BEGIN
UPDATE PS_GameData.dbo.Chars SET LoginStatus = '0' WHERE CharID = @CharID
END
03/19/2018 16:23 [PH]KEO(DEV)#5
Quote:
Originally Posted by .:Skrillex:. View Post
Hi,
sure I can.

ADD the query below in
still not working :( this is my

USE [PS_GameLog]
GO
/****** Object: StoredProcedure [dbo].[usp_Insert_Action_Log_E] Script Date: 3/19/2018 4:21:35 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

/****** Object: Stored Procedure dbo.usp_Insert_Action_Log_E Script Date: 2008-6-7 18:32:40 ******/

/****** Object: Stored Procedure dbo.usp_Insert_Action_Log_E Script Date: 2008/3/15 下午 05:16:53 ******/



ALTER Proc [dbo].[usp_Insert_Action_Log_E]


/*

*/

@UserID varchar(18),
@[Only registered and activated users can see links. Click Here To Register...]ID int,
@CharID int,
@CharName varchar(50),
@CharLevel tinyint,
@CharExp int,
@MapID smallint,
@PosX real,
@PosY real,
@PosZ real,
@ActionTime datetime,
@ActionType tinyint,
@[Only registered and activated users can see links. Click Here To Register...] bigint = null,
@[Only registered and activated users can see links. Click Here To Register...] int = null,
@[Only registered and activated users can see links. Click Here To Register...]3 int = null,
@[Only registered and activated users can see links. Click Here To Register...]4 bigint = null,
@[Only registered and activated users can see links. Click Here To Register...]5 int = null,
@[Only registered and activated users can see links. Click Here To Register...]6 int = null,
@[Only registered and activated users can see links. Click Here To Register...]7 int = null,
@[Only registered and activated users can see links. Click Here To Register...]8 int = null,
@[Only registered and activated users can see links. Click Here To Register...]9 int = null,
@[Only registered and activated users can see links. Click Here To Register...]0 int = null,
@Text1 varchar(100) = '',
@Text2 varchar(100) = '',
@Text3 varchar(100) = '',
@Text4 varchar(100) = '',
@Sql nvarchar(4000) = '',
@[Only registered and activated users can see links. Click Here To Register...] varchar(4) = '',
@mm varchar(2) = '',
@dd varchar(2) = '',
@Bucket smallint = -1

AS

SET @[Only registered and activated users can see links. Click Here To Register...] = datepart(yyyy, @ActionTime)
SET @mm = datepart(mm, @ActionTime)
SET @dd = datepart(dd, @ActionTime)


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

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

/* Login - Logout replacement for players online */
IF @ActionType = '108'
BEGIN
UPDATE PS_GameData.dbo.Chars SET [LoginStatus]=0 WHERE PS_GameData.dbo.Chars.CharID=@CharID
END
IF @ActionType = '107'
BEGIN
UPDATE PS_GameData.dbo.Chars SET [LoginStatus]=1 WHERE PS_GameData.dbo.Chars.CharID=@CharID
END

/* Login - Logout replacement for players online */
IF @ActionType = '108'
BEGIN
UPDATE PS_GameData.dbo.Chars SET [LoginStatus]=0 WHERE PS_GameData.dbo.Chars.CharID=@CharID
END
IF @ActionType = '107'
BEGIN
UPDATE PS_GameData.dbo.Chars SET [LoginStatus]=1 WHERE PS_GameData.dbo.Chars.CharID=@CharID
END
UPDATE PS_GameData.dbo.Chars
SET LoginStatus = 0
Where CharID = @CharID

SET @Sql = N'
INSERT INTO PS_GameLog.dbo.ActionLog
(UserID, UserUID, CharID, CharName, CharLevel, CharExp, MapID, PosX, PosY, PosZ, ActionTime, ActionType,
Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Text1, Text2, Text3, Text4)
VALUES(@UserID, @[Only registered and activated users can see links. Click Here To Register...]ID, @CharID, @CharName, @CharLevel, @CharExp, @MapID, @PosX, @PosY, @PosZ, @ActionTime, @ActionType,
@[Only registered and activated users can see links. Click Here To Register...], @[Only registered and activated users can see links. Click Here To Register...], @[Only registered and activated users can see links. Click Here To Register...]3, @[Only registered and activated users can see links. Click Here To Register...]4, @[Only registered and activated users can see links. Click Here To Register...]5, @[Only registered and activated users can see links. Click Here To Register...]6, @[Only registered and activated users can see links. Click Here To Register...]7, @[Only registered and activated users can see links. Click Here To Register...]8, @[Only registered and activated users can see links. Click Here To Register...]9, @[Only registered and activated users can see links. Click Here To Register...]0, @Text1, @Text2, @Text3, @Text4)'

EXEC sp_executesql @Sql,
N'@UserID varchar(18), @[Only registered and activated users can see links. Click Here To Register...]ID int, @CharID int, @CharName varchar(50),
@CharLevel tinyint, @CharExp int, @MapID smallint, @PosX real, @PosY real, @PosZ real, @ActionTime datetime, @ActionType tinyint,
@[Only registered and activated users can see links. Click Here To Register...] bigint, @[Only registered and activated users can see links. Click Here To Register...] int, @[Only registered and activated users can see links. Click Here To Register...]3 int, @[Only registered and activated users can see links. Click Here To Register...]4 bigint, @[Only registered and activated users can see links. Click Here To Register...]5 int, @[Only registered and activated users can see links. Click Here To Register...]6 int, @[Only registered and activated users can see links. Click Here To Register...]7 int, @[Only registered and activated users can see links. Click Here To Register...]8 int,
@[Only registered and activated users can see links. Click Here To Register...]9 int, @[Only registered and activated users can see links. Click Here To Register...]0 int, @Text1 varchar(100), @Text2 varchar(100), @Text3 varchar(100), @Text4 varchar(100)',
@UserID, @[Only registered and activated users can see links. Click Here To Register...]ID, @CharID, @CharName, @CharLevel, @CharExp, @MapID, @PosX, @PosY, @PosZ, @ActionTime, @ActionType,
@[Only registered and activated users can see links. Click Here To Register...], @[Only registered and activated users can see links. Click Here To Register...], @[Only registered and activated users can see links. Click Here To Register...]3, @[Only registered and activated users can see links. Click Here To Register...]4, @[Only registered and activated users can see links. Click Here To Register...]5, @[Only registered and activated users can see links. Click Here To Register...]6, @[Only registered and activated users can see links. Click Here To Register...]7, @[Only registered and activated users can see links. Click Here To Register...]8, @[Only registered and activated users can see links. Click Here To Register...]9, @[Only registered and activated users can see links. Click Here To Register...]0, @Text1, @Text2, @Text3, @Text4
03/19/2018 16:28 {Skrillex}#6
Do you have the Column Loginstatus in your Chars Table?

Check it with this query:
Quote:
SELECT *FROM [PS_GameData].[dbo].[Chars] where LoginStatus = 0
When It results your Characters then is everything ok there. When You have an error there you need to Add the LognStatus Column

Cheers
03/19/2018 16:32 [PH]KEO(DEV)#7
Quote:
Originally Posted by .:Skrillex:. View Post
Do you have the Column Loginstatus in your Chars Table?

Check it with this query:


When It results your Characters then is everything ok there. When You have an error there you need to Add the LognStatus Column

Cheers
yes i have but still not working
03/19/2018 16:44 {Skrillex}#8
Okay. When you execute the query with =1 at the end does it show your online charakter? When yes something is wrong with your PHP-file.

Regards
03/19/2018 16:59 [PH]KEO(DEV)#9
when i query = 1 does not show online player but im online now and my players!

my php file is correct because i try this to other db and its working but when i connect to db its not working..
03/19/2018 17:06 {Skrillex}#10
hm ok..

then try this scripts:

Quote:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO


ALTER Proc [dbo].[usp_Read_Chars_Detail2_R]

@CharID int

AS

SET NOCOUNT ON

DECLARE @UserUID int
DECLARE @Money bigint
DECLARE @GuildID int
DECLARE @GuildLevel tinyint
DECLARE @UID varchar (18)

-- 2005-12-30 스탯,스킬 이벤트관련...
DECLARE @Event1 tinyint
DECLARE @Event2 tinyint
--

SET @Money = 0
SET @UserUID = (SELECT UserUID FROM Chars WHERE CharID = @CharID)
SET @GuildID = (SELECT GuildID FROM GuildChars WHERE CharID = @CharID AND Del = 0)

IF(@UserUID IS NOT NULL)
BEGIN
SET @Money = (SELECT ISNULL([Money], 0) FROM UserStoredMoney WHERE UserUID = @UserUID)
END
ELSE
BEGIN
SET @Money = 0
END

IF(@GuildID IS NOT NULL)
BEGIN
SET @GuildLevel = (SELECT GuildLevel FROM GuildChars WHERE CharID = @CharID AND Del = 0)
END
ELSE
BEGIN
SET @GuildID = 0
SET @GuildLevel = 0
END

-- 2005-12-30 스탯,스킬 이벤트관련...
SELECT @Event1=Event1, @Event2=Event2 FROM CharEvents WHERE CharID=@CharID
--

SELECT UserUID, CharID, CharName, Slot, Family, Grow, Hair, Face, [Size], Job, Sex, [Level],
StatPoint AS DistPoint, SkillPoint, [Str], Dex, Rec, [Int], Luc, Wis, HP, MP, SP, Map, Dir, [Exp], [Money],
PosX, PosY, PosZ, Hg, Vg, Cg, Og, Ig, Del, K1, K2, K3, K4, @Money AS StoredMoney, @GuildID AS GuildID, @GuildLevel AS GuildLevel,

-- 전투공로관 보상레벨
KillLevel, DeadLevel,
--

-- 스탯,스킬 이벤트관련...
@Event1, @Event2,
--

DATEPART(yyyy, LeaveDate) AS LeaveDate_YYYY,
DATEPART(mm, LeaveDate) AS LeaveDate_MM,
DATEPART(dd, LeaveDate) AS LeaveDate_DD,
DATEPART(hh, LeaveDate) AS LeaveDate_HH,
DATEPART(mi, LeaveDate) AS LeaveDate_MI,
DATEPART(ss, LeaveDate) AS LeaveDate_SS

--

FROM Chars WHERE CharID = @CharID

-- 접속시간 기록
UPDATE Chars SET JoinDate=GETDATE(), LoginStatus = 1 WHERE CharID=@CharID
SELECT @UID=UserID FROM CHARS WHERE CharID=@CharID
UPDATE Chars SET LoginStatus = 0 WHERE (CharID<>@CharID) AND (UserID=@UID)
--

SET NOCOUNT OFF
SET QUOTED_IDENTIFIER OFF
SET ANSI_NULLS OFF
Quote:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO


ALTER Proc [dbo].[usp_Save_Char_LeaveDate_R]

@CharID int

AS

SET NOCOUNT ON

-- 종료시간 기록
UPDATE Chars SET LeaveDate=GETDATE(), LoginStatus=0 WHERE CharID=@CharID

SET NOCOUNT OFF

SET QUOTED_IDENTIFIER OFF

SET ANSI_NULLS OFF
Now it should work!
03/19/2018 17:19 [PH]KEO(DEV)#11
Quote:
Originally Posted by .:Skrillex:. View Post
hm ok..

then try this scripts:





Now it should work!
result

Msg 208, Level 16, State 6, Procedure usp_Read_Chars_Detail2_R, Line 3
Invalid object name 'dbo.usp_Read_Chars_Detail2_R'.
Msg 208, Level 16, State 6, Procedure usp_Save_Char_LeaveDate_R, Line 3
Invalid object name 'dbo.usp_Save_Char_LeaveDate_R'.
03/19/2018 17:30 {Skrillex}#12
you have to choose the database in the top mate...

Please learn sql basics...