Hide GMs from rankings..?

Results 1 to 11 of 11
  1. #1
    Enthusiast privlolek is offline
    MemberRank
    Aug 2011 Join Date
    30Posts

    Support Hide GMs from rankings..?

    Hello,

    I am using cabal website from this link: http://forum.ragezone.com/f459/storm...ite-v1-761472/

    Is it possible to hide the GMs from the rankings and the "Who is Online" pages ?

    I don't want players to see when GMs are online.
    Last edited by privlolek; 18-08-11 at 01:21 PM.


  2. #2
    The Cat in the Hat cypher is offline
    MemberRank
    Oct 2005 Join Date
    IrelandLocation
    5,073Posts

    Re: Hide GMs from rankings..?

    Ofcourse you can. Just edit the query that lists the who is online to exclude those who have nation 3.

  3. #3
    Enthusiast privlolek is offline
    MemberRank
    Aug 2011 Join Date
    30Posts

    Re: Hide GMs from rankings..?

    Quote Originally Posted by cypher View Post
    Ofcourse you can. Just edit the query that lists the who is online to exclude those who have nation 3.
    The problem is I am a complete noob in PHP and I really don't know how to do that...

    Well, I thought about making something like this :
    if ($nation < 3) { ....
    But I don't know where to put it in the code...
    Last edited by privlolek; 18-08-11 at 10:41 PM.

  4. #4
    Fuck. SheenBR is offline
    ModeratorRank
    Feb 2008 Join Date
    Jaú, BrazilLocation
    2,433Posts

    Re: Hide GMs from rankings..?

    you could do something like:

    SELECT * FROM table WHERE nation blablaba AND WHERE NATION NOT LIKE ('%3%')

    This would remove gms from rank.

  5. #5
    Account Upgraded | Title Enabled! Alphakilo23 is offline
    MemberRank
    Jun 2010 Join Date
    Ze German ländLocation
    428Posts

    Re: Hide GMs from rankings..?

    Find this line in the rankings.php file:

    Code:
    $r=mssql_query('select top 20 * from '.DB_GAM.'.dbo.cabal_character_table WHERE Playtime > 0 order by exp desc, reputation desc, playtime desc, alz desc');
    change it to:
    Code:
    $r=mssql_query('select top 20 * from '.DB_GAM.'.dbo.cabal_character_table WHERE Playtime > 0 AND Nation != 3 order by exp desc, reputation desc, playtime desc, alz desc');

  6. #6
    Enthusiast privlolek is offline
    MemberRank
    Aug 2011 Join Date
    30Posts

    Re: Hide GMs from rankings..?

    Quote Originally Posted by Alphakilo23 View Post
    Find this line in the rankings.php file:

    Code:
    $r=mssql_query('select top 20 * from '.DB_GAM.'.dbo.cabal_character_table WHERE Playtime > 0 order by exp desc, reputation desc, playtime desc, alz desc');
    change it to:
    Code:
    $r=mssql_query('select top 20 * from '.DB_GAM.'.dbo.cabal_character_table WHERE Playtime > 0 AND Nation != 3 order by exp desc, reputation desc, playtime desc, alz desc');
    It worked ! However, it only makes GMs disappear from Top 20 in Rankings and the Who is Online page.

    I was trying to make it work in the Combo Rankings and Dungeon Runs rankings, but it gave me errors...

    Here's the code from Combo rankings:
    Code:
     $r=mssql_query('select top 10 * from '.DB_GAM.' .dbo.cabal_record_combo order by cntcombo desc');
    Dungeon Single:
    Code:
    $r=mssql_query('select top 10 * from '.DB_GAM.'.dbo.cabal_event_singledg where dungeounName="'.$name.'" order by passtime desc');
    Group:
    Code:
    $r=mssql_query('select top 10 * from '.DB_GAM.'.dbo.cabal_event_partydg where dungeounName="'.$name.'" order by passtime desc');
    Do you know where to put it there to make it work ?
    I tried something like this:
    Code:
    $r=mssql_query('select top 10 * from '.DB_GAM.'.dbo.cabal_event_partydg where dungeounName="'.$name.'" WHERE Nation != 3 order by passtime desc');
    But it gave me an error..

  7. #7
    Account Upgraded | Title Enabled! Alphakilo23 is offline
    MemberRank
    Jun 2010 Join Date
    Ze German ländLocation
    428Posts

    Re: Hide GMs from rankings..?

    Quote Originally Posted by privlolek View Post
    Here's the code from Combo rankings:
    Code:
     $r=mssql_query('select top 10 * from '.DB_GAM.' .dbo.cabal_record_combo order by cntcombo desc');
    Dungeon Single:
    Code:
    $r=mssql_query('select top 10 * from '.DB_GAM.'.dbo.cabal_event_singledg where dungeounName="'.$name.'" order by passtime desc');
    Group:
    Code:
    $r=mssql_query('select top 10 * from '.DB_GAM.'.dbo.cabal_event_partydg where dungeounName="'.$name.'" order by passtime desc');
    Those tables don't store nation informations, so in order to make that work you need to retrieve the nation columns from the cabal_character_table, possible using JOINs. Try to figure it out yourself first.

  8. #8
    Enthusiast privlolek is offline
    MemberRank
    Aug 2011 Join Date
    30Posts

    Re: Hide GMs from rankings..?

    Unfortunately I didn't understand anything from the site you gave me :(

    Maybe there's an easier way to do that or you could explain me exactly what to do ?

    As I said I completely don't know PHP what makes me a noob in such things... Most of the things I do alone, I only ask for help when I don't know something and it isn't described anywhere.

  9. #9
    Account Upgraded | Title Enabled! Alphakilo23 is offline
    MemberRank
    Jun 2010 Join Date
    Ze German ländLocation
    428Posts

    Re: Hide GMs from rankings..?

    Quote Originally Posted by privlolek View Post
    Unfortunately I didn't understand anything from the site you gave me :(

    Maybe there's an easier way to do that or you could explain me exactly what to do ?

    As I said I completely don't know PHP what makes me a noob in such things... Most of the things I do alone, I only ask for help when I don't know something and it isn't described anywhere.
    This isn't about PHP, it's T-SQL.

    JOIN creates a relation between data in different tables, that way you can query information that isn't in the table you're querying in the first place.

    Let me show you an example:

    Spoiler:

    Say we want to get and oversight of all characters on the account with the UserNum 1, we'd run this query:
    Code:
    SELECT UserNum, ID, chars.CharacterIdx, chars.Name, chars.LEV 
    	FROM [account].[dbo].[cabal_auth_table]
    	JOIN [gamedb].[dbo].[cabal_character_table] chars
    		ON ([CharacterIdx] BETWEEN (UserNum * 8) AND (UserNum *8) +5)UserNum 1
    	WHERE UserNum = 1
    Let me explain it line by line.

    First we must specify what we want to know from the database.
    We want to get the UserNum and ID of the account, and the ids, names and levels of all their characters.

    Code:
    SELECT UserNum, ID, chars.CharacterIdx, chars.Name, chars.LEV FROM [account].[dbo].[cabal_auth_table]
    Since the account- and the character-informations are on two different tables, we need to JOIN them. That will create a virtual table, that only resides in the RAM until the query returns it's result.
    And because I'm lazy, I'm going to name that virtual table "chars", so I don't have to type out cabal_character_table in the SELECT statement.

    Code:
    JOIN [gamedb].[dbo].[cabal_character_table] chars
    Here comes the important part: We want to make the relation between characters and accounts. Since the cabal DB is kinda messy, that'd be the usernum multiplied with 8 for the first character on the account and (usernum * 8) + 5 for the last character.
    Code:
    ON ([CharacterIdx] BETWEEN (UserNum * 8) AND (UserNum *8) +5)
    Oh and yes, we only want it from the account with the UserNum 1
    Code:
    WHERE UserNum = 1

    Now if you run the query from the management studio, it should look like this:


  10. #10
    Enthusiast privlolek is offline
    MemberRank
    Aug 2011 Join Date
    30Posts

    Re: Hide GMs from rankings..?

    Ok....thanks for explaining a bit :P

    Now I have question.. you showed me example as a query in management studio. Now I am confused... I can't put it in the rankings.php, right ? Only run it as a query in MySQL ?

    If so, I should join the dbo.cabal_record_combo and dbo.cabal_character_table tables or which ?

  11. #11
    Account Upgraded | Title Enabled! Alphakilo23 is offline
    MemberRank
    Jun 2010 Join Date
    Ze German ländLocation
    428Posts

    Re: Hide GMs from rankings..?

    Quote Originally Posted by privlolek View Post
    Ok....thanks for explaining a bit :P

    Now I have question.. you showed me example as a query in management studio. Now I am confused... I can't put it in the rankings.php, right ? Only run it as a query in MySQL ?
    MSSQL. Huge difference there.

    Replace the query within the brackets, like this:
    PHP Code:
    $r=mssql_query('-- Just replace this part, oh and remove the double minus'); 

    Quote Originally Posted by privlolek View Post
    If so, I should join the dbo.cabal_record_combo and dbo.cabal_character_table tables or which ?
    I'm writing that one last query for you and hope you'll experience an "Aha!"-moment:
    PHP Code:
    $r=mssql_query(SELECT TOP 10 cumbo.*  FROM gamedb.dbo.cabal_record_combo cumbo JOIN gamedb.dbo.cabal_character_table chars ON (chars.CharacterIdx cumbo.charIdx WHERE chars.Nation != 3 ORDER BY cntcombo desc
    It could possible mess up the table layout of the website, if it does so, PM me an URL to your website.


    Aaand now, back to the more important aspects of life
    Spoiler:


    Last edited by Alphakilo23; 19-08-11 at 11:23 PM.



Advertisement