[Release] Database Total Online Time Mod

Page 1 of 3 123 LastLast
Results 1 to 15 of 37
  1. #1
    Account Inactive john_d is offline
    InactiveRank
    Feb 2004 Join Date
    PhilippinesLocation
    2,868Posts

    [Release] Database Total Online Time Mod

    [Release] Database Total Online Time Mod
    What this does?
    - add a new column in your MEMB_STAT table for total online time for the user EVER!

    Does can it count in HOUR, DATE, Minutes?
    - yes

    Do i need this?
    - no idea... it's ur life

    What of things i can do with this?
    - well i don't really know but i use as referral system on my test server. referral Total Online TIme = Mu CASH ^^

    STEPS TO INSTALL

    1. NEED TO ADD A NEW COLUMN in MEMB_STAT TABLE
    -----
    COLUMN NAME: TotalTime
    TYPE: int
    NOT NULL
    DEFAULT 0
    -----

    2. Change your WZ_DISCONNECT_MEMB ( stored procedure )
    PHP Code:
    CREATE PROCEDURE WZ_DISCONNECT_MEMB
    @memb___id varchar(10)
     AS
    Begin    
    set nocount on
        
    Declare  @find_id varchar(10)    
        Declare @
    ConnectStat tinyint
        Set 
    @ConnectStat 0     
        Set 
    @find_id 'NOT'
        
    select @find_id S.memb___id from MEMB_STAT S INNER JOIN MEMB_INFO I ON S.memb___id I.memb___id 
               where I
    .memb___id = @memb___id
        
    if( @find_id <> 'NOT' )    
        
    begin        
            update MEMB_STAT set ConnectStat 
    = @ConnectStatDisConnectTM getdate(), TotalTime TotalTime+(DATEDIFF(mi,ConnectTM,getdate()))
             
    where memb___id = @memb___id
                
    -- TIMEONLINE MOD by john_d
        end
    end

    GO 


  2. #2
    RZ's most loyal knight Dios is online now
    ModeratorRank
    Apr 2005 Join Date
    ArgentinaLocation
    5,250Posts

    re: [Release] Database Total Online Time Mod

    Approved it is
    "I stole that fuckin' clock, I took the time
    and I came up from behind and pretty much snuck up
    and butt fucked this game up.
    Better be careful when you bring my name up
    fuck this fame, that ain't what I came to claim
    but the game ain't gonna be the same on the day that I leave it.
    But I swear one way or another I'm a make these fuckin' haters believe it"

  3. #3
    Banned DarkMaster. is offline
    BannedRank
    Feb 2007 Join Date
    BulgariaLocation
    812Posts

    Re: [Release] Database Total Online Time Mod

    great release

  4. #4
    Registered .:[CZ]Memphis:. is offline
    MemberRank
    Jul 2005 Join Date
    PragueLocation
    5Posts

    Re: [Release] Database Total Online Time Mod

    Quote Originally Posted by john_d View Post
    What this does?
    - add a new column in your MEMB_STAT table for total online time for the user EVER!

    Does can it count in HOUR, DATE, Minutes?
    - yes

    Do i need this?
    - no idea... it's ur life

    What of things i can do with this?
    - well i don't really know but i use as referral system on my test server. referral Total Online TIme = Mu CASH ^^

    STEPS TO INSTALL

    1. NEED TO ADD A NEW COLUMN in MEMB_STAT TABLE
    -----
    COLUMN NAME: TotalTime
    TYPE: int
    NOT NULL
    DEFAULT 0
    -----

    2. Change your WZ_DISCONNECT_MEMB ( stored procedure )
    PHP Code:
    CREATE PROCEDURE WZ_DISCONNECT_MEMB
    @memb___id varchar(10)
     AS
    Begin    
    set nocount on
        
    Declare  @find_id varchar(10)    
        Declare @
    ConnectStat tinyint
        Set 
    @ConnectStat 0     
        Set 
    @find_id 'NOT'
        
    select @find_id S.memb___id from MEMB_STAT S INNER JOIN MEMB_INFO I ON S.memb___id I.memb___id 
               where I
    .memb___id = @memb___id
        
    if( @find_id <> 'NOT' )    
        
    begin        
            update MEMB_STAT set ConnectStat 
    = @ConnectStatDisConnectTM getdate(), TotalTime TotalTime+(DATEDIFF(mi,ConnectTM,getdate()))
             
    where memb___id = @memb___id
                
    -- TIMEONLINE MOD by john_d
        end
    end

    GO 
    but it's just for logged account, not character ?

  5. #5
    Account Inactive john_d is offline
    InactiveRank
    Feb 2004 Join Date
    PhilippinesLocation
    2,868Posts

    Re: [Release] Database Total Online Time Mod

    Quote Originally Posted by .:[CZ]Memphis:. View Post
    but it's just for logged account, not character ?
    Add another Column in Character table

    Same as the one on MEMB_STAT

    Code:
    CREATE PROCEDURE WZ_DISCONNECT_MEMB
    @memb___id varchar(10)
     AS
    Begin    
    set nocount on
        Declare  @find_id varchar(10)    
       Declare  @con_tm DATETIME
        Declare @ConnectStat tinyint
        Set @ConnectStat = 0     
        Set @find_id = 'NOT'
        select @find_id = S.memb___id, @con_tm = S.ConnectTM from MEMB_STAT S INNER JOIN MEMB_INFO I ON S.memb___id = I.memb___id 
               where I.memb___id = @memb___id
        if( @find_id <> 'NOT' )    
        begin        
            update MEMB_STAT set ConnectStat = @ConnectStat, DisConnectTM = getdate(), TotalTime = TotalTime+(DATEDIFF(mi,ConnectTM,getdate()))
             where memb___id = @memb___id
                -- TIMEONLINE MOD by john_d
             update character set TotalTime = TotalTime+(DATEDIFF(mi,@con_tm,getdate())) 
             from character as c INNER join AccountCharacter as ac ON 
             c.Name = ac.GameIDC where c.accountid = @memb___id
        end
    end
    
    GO
    pst dont have time to test it :p tell me if it works

    EDIT: just tested it. works fine

  6. #6
    Account Inactive santiz is offline
    InactiveRank
    Oct 2008 Join Date
    ArgentinaLocation
    96Posts

    Re: [Release] Database Total Online Time Mod

    I have this problem!

  7. #7
    Account Upgraded | Title Enabled! crlfrancis is offline
    True MemberRank
    Sep 2006 Join Date
    250Posts

    Re: [Release] Database Total Online Time Mod

    Can you write a script to display Top 10 most players online?
    You can use this for top online contest

  8. #8
    Member Stinger 7100 is offline
    MemberRank
    Aug 2008 Join Date
    AustraliaLocation
    91Posts

    Re: [Release] Database Total Online Time Mod

    Or you could just leave it and out of the list the top 10 most online. Would be the same?

  9. #9
    Account Inactive john_d is offline
    InactiveRank
    Feb 2004 Join Date
    PhilippinesLocation
    2,868Posts

    Re: [Release] Database Total Online Time Mod

    select top 10 * from character where ctl_code = 0 order by TotalTime desc

    or u mean a php page?

  10. #10
    Account Upgraded | Title Enabled! crlfrancis is offline
    True MemberRank
    Sep 2006 Join Date
    250Posts

    Re: [Release] Database Total Online Time Mod

    never mind i found one on muweb.org and it works fine with totaltime, i like how it shows the mins instead of hours

    http://www.gameznetwork.com.ar/Gamez...TopOnline.html

  11. #11
    Account Inactive john_d is offline
    InactiveRank
    Feb 2004 Join Date
    PhilippinesLocation
    2,868Posts

    Re: [Release] Database Total Online Time Mod

    Quote Originally Posted by crlfrancis View Post
    never mind i found one on muweb.org and it works fine with totaltime, i like how it shows the mins instead of hours

    http://www.gameznetwork.com.ar/Gamez...TopOnline.html
    wat the original script in hours?

  12. #12
    Account Upgraded | Title Enabled! crlfrancis is offline
    True MemberRank
    Sep 2006 Join Date
    250Posts

    Re: [Release] Database Total Online Time Mod

    <div align="center">
    <div align="center">
    <table width="50%" border="0" cellspacing="1" cellpadding="1">
    <tr>
    <td class="normal_text_white">Players</td>
    <td class="normal_text_white">Online Time</td>
    <td class="normal_text_white">Status</td>
    </tr>
    <?php

    /**
    * @DjSoulz
    * @copyright 2008
    */

    if( !isset($_GET['op']))
    {
    require('../includes/denied.php');
    denied('Time');
    }
    require('config.php');

    //We get the user
    $online = $db->Execute('SELECT DISTINCT
    TOP 25
    AccountCharacter.ID,
    AccountCharacter.GameIDC,
    MEMB_STAT.ServerName,
    MEMB_STAT.IP,
    MEMB_STAT.ConnectTM,
    MEMB_STAT.DisConnectTM,
    MEMB_STAT.OnlineHours
    from
    MEMB_STAT
    join
    AccountCharacter
    on
    Memb_stat.memb___id = AccountCharacter.ID
    ORDER BY
    MEMB_STAT.OnlineHours DESC');
    while($online_time = $online->fetchrow())
    {
    //Maybe the statut too
    $statut = $db->Execute("Select ConnectStat FROM MEMB_STAT WHERE memb___id='".$online_time[0]."'");
    $statut_ok = $statut->fetchrow();
    if($statut_ok[0] == 1){$online_stat = '<span style="color:green"><b>Online</b></span>';}
    elseif($statut_ok[0] == 0){$online_stat = '<span style="color:red"><b>Offline</b></span>';}
    ?>
    <tr>
    <td class="normal_text_white"><a href="index.php?op=character&character=<?=$online_time[1];?>"><?=$online_time[1];?></a></td>
    <td class="normal_text_white"><?=$online_time[6];?></td>
    <td class="normal_text_white"><?=$online_stat?></td>
    </tr>
    <?
    }
    ?>
    </table>
    </div>
    there you go
    i just changed OnlineHours to TotalOnline to show in mins

  13. #13
    Account Inactive john_d is offline
    InactiveRank
    Feb 2004 Join Date
    PhilippinesLocation
    2,868Posts

    Re: [Release] Database Total Online Time Mod

    looks good. but query is a bit craptastic :p

    could easily be

    PHP Code:
    $online $db->Execute('select top 25 c.Name, c.Class, c.cLevel, ms.ConnectStat,c.TotalTime from Character as C left outer join MEMB_STAT as ms ON c.Accountid = ms.memb___id order by c.TotalTime desc');
    echo 
    '<table cellpadding="2" cellspacing="2">';
    foreach (
    $online as $on => $r) {
     echo 
    '<tr><td>'.$r['NAME'].'</td><td>'.$r['TOTALTIME'].' Minutes</td></tr>';
    }
    echo 
    '</table>'

  14. #14
    Account Upgraded | Title Enabled! crlfrancis is offline
    True MemberRank
    Sep 2006 Join Date
    250Posts

    Re: [Release] Database Total Online Time Mod

    i use me_muonline database for the accounts so that wouldn't work for me

  15. #15
    Account Inactive john_d is offline
    InactiveRank
    Feb 2004 Join Date
    PhilippinesLocation
    2,868Posts

    Re: [Release] Database Total Online Time Mod

    Quote Originally Posted by crlfrancis View Post
    i use me_muonline database for the accounts so that wouldn't work for me
    Easily fixed. in 2 steps

    1. Create a Link servers. let say we call it "MULINK"
    Link server info
    Provider: OLE DB PROVIDER for ODBC DRIVERS
    Product name: MULINK
    Datasource: MuOnline;MuOnlineJoinDB;Ranking;
    Driver: DRIVER={SQL Server};SERVER=127.0.0.1;UID=;PWD=;

    to very if it is working.

    Query this:
    1. Use Me_MuOnline;
    2. Select * FROM MULINK.MuOnline.dbo.Character

    :p
    so everytime u need the character table... just use MULINK.MuOnline.dbo.Character lol:



Page 1 of 3 123 LastLast

Advertisement