Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Shaiya > Shaiya Private Server > Shaiya PServer Guides & Releases
You last visited: Today at 14:17

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[RELEASE] Script - Number of Players Online

Discussion on [RELEASE] Script - Number of Players Online within the Shaiya PServer Guides & Releases forum part of the Shaiya Private Server category.

Reply
 
Old 06/10/2013, 04:23   #46
 
elite*gold: 0
Join Date: Jun 2011
Posts: 108
Received Thanks: 269
1st
creat the LoginStatus in the Chars Table as follows
Code:
USE PS_GameData 
IF NOT EXISTS(SELECT * FROM sys.columns WHERE Name = 'LoginStatus' AND object_id = OBJECT_ID('Chars')) 
BEGIN 
    ALTER TABLE Chars 
        ADD LoginStatus bit 
    PRINT 'Column successfully added!' 
END 
ELSE 
BEGIN 
    PRINT 'Column already exists!' 
END
2nd
update the Read Chars Stored procedure as follows

Code:
USE [PS_GameData]
GO
/****** Object:  StoredProcedure [dbo].[usp_Read_Chars_Detail2_R]    Script Date: 6/9/2013 12:12:20 PM ******/
SET ANSI_NULLS ON
GO
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

-- 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() WHERE CharID=@CharID
--

-- loged in Chars setup --
UPDATE Chars SET LoginStatus = 0 Where UserUID = @UserUID
UPDATE Chars SET LoginStatus = 1 WHERE CharID = @CharID and UserUID = @UserUID

SET NOCOUNT OFF
3rd
Update Leave Chars Procedure as follows
Code:
USE [PS_GameData]
GO
/****** Object:  StoredProcedure [dbo].[usp_Save_Char_LeaveDate_R]    Script Date: 6/9/2013 7:06:00 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO


ALTER Proc [dbo].[usp_Save_Char_LeaveDate_R] 

@CharID int

AS

SET NOCOUNT ON

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

SET NOCOUNT OFF
4th not shure if its requierd but i did it anyways just for added if it failes on leave char stuff
Code:
USE [PS_userdata]
GO
/****** Object:  StoredProcedure [dbo].[usp_Try_GameLogout_R]    Script Date: 6/9/2013 7:18:26 PM ******/
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

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

-- For Login status updates --
UPDATE PS_GameData.dbo.Chars SET LoginStatus = 0, LeaveDate = GETDATE() WHERE UserUID = @UserUID
SET NOCOUNT OFF
5th and final ( FOR ALL DC's caused by server shutdown and altF4 players ) creat this trigger witch uses the logtype and error codes i found to set the login status to 0 when players dc and alt F4 out of game also sets loginstatus to 0 if a player just reguler logs out with this trigger
Code:
USE [PS_GameLog]
GO
/****** Object:  Trigger [dbo].[Leave]    Script Date: 6/9/2013 7:22:25 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER TRIGGER [dbo].[Leave]
ON [PS_GameLog].[dbo].[UserLog]
FOR INSERT
AS
declare @UserUID int

SET @UserUID= (SELECT UserUID FROM inserted where LogoutType in (1,3,4) and ErrType in (64,1236))

UPDATE PS_GameData.dbo.Chars SET LoginStatus=0 WHERE UserUID=@UserUID
[DEV]xXDASHXx is offline  
Thanks
10 Users
Old 11/05/2013, 14:54   #47
 
elite*gold: 0
Join Date: Feb 2011
Posts: 295
Received Thanks: 18
the php script dosent work, 0 players online on HP, how to fix this?
accuface35 is offline  
Old 11/05/2013, 16:44   #48
 
Mithrandir.'s Avatar
 
elite*gold: 0
Join Date: Jun 2013
Posts: 1,867
Received Thanks: 401
I'm absoluty sure after 2 years shaiya developing you dont know how to execute a query :S
Mithrandir. is offline  
Reply


Similar Threads Similar Threads
[Release]Users Visiting/Players Online
03/28/2012 - EO PServer Guides & Releases - 5 Replies
Just some simple code to display how many people are visiting your site and the number of players on your server. Players Online: This one will not display your players online unless you are running a website on the same computer as the server. I am working on making a code that can grab the users online from a website that isn't hosted on the servers computer. <?php echo (exec('netstat -a -n |find "5816" |find "ESTABLISHED" /c')-2); ?> Users Visiting: <?php $output = shell_exec...
[HELP]SCRIPT PHP PLAYERS ONLINE
04/12/2011 - Dekaron Private Server - 12 Replies
Not know much about PHP I'M WITH A DOUBT AS AGENT IN AN ONLINE PLAYERS SYNTAX WHAT IT IN TIME FOR YOU TO READ THE DATABASE NOT READ NAMES OF FILES CONTAINING ", ... BELOW IS THE FILE: <style type="text/css"> <!-- body,td,th { font-family: Verdana, Geneva, sans-serif; color: #FFFF00; font-weight: bold; } body {
[Release] Total Players Online
09/09/2009 - CO2 PServer Guides & Releases - 1 Replies
For Who Looking For that code that code let you know how many players play on your server now Its Not Made by Me Total Players Online: 30 Just Put it On Register.php
[RELEASE] Free Items to all Online Players
07/30/2009 - CO2 PServer Guides & Releases - 17 Replies
A "free" Command, put this Command in Client.cs under GM or Owner Command and change "@" to "/" if your command start with "/" "LOFT code not CoEmu v2" if (Splitter == "@free") { if (Splitter == "db") { foreach (DictionaryEntry DE in World.AllChars) { ...
[REQUEST] online players script
10/30/2008 - EO PServer Hosting - 18 Replies
hi all , i think that the titel says enouf of what i want to aks , but to be shure i goin write a little more ^^ i aim looking for a script whit a few things server offline server online players online



All times are GMT +2. The time now is 14:17.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.