[Server Scripting] Authlist change

Discussion in 'Server and Client Scripting' started by Binix, Nov 29, 2014.

  1. Binix

    Binix work drugs

    Joined:
    Jun 13, 2014
    Messages:
    58
    Likes Received:
    11
    Is there anyway to change this code?: http://pastebin.com/1DCsDWKk so that it shows a ball corrisponding to its auth like master ball, ultra ball, great ball. and then show it as an unidle if the user is online and idle if the user is offline and then for it to say (offline) if the user is offline and (online) if the user is online?
    kinda like this: http://prntscr.com/504nfz
    Anyone have an idea of how to do so??????
     
  2. Crystal Moogle

    Crystal Moogle Ayaya~ Administrator Administrator

    Joined:
    Jul 19, 2010
    Messages:
    3,205
    Likes Received:
    531
    PO Trainer Name:
    Hanako
    Try replacing it with this

    Code (JAVASCRIPT):
    1.  
    2. if (command == "authlist") {
    3.     var DoNotShowIfOffline = ["loseyourself", "oneballjay"];
    4.     var filterByAuth = function(level) {
    5.         return function(name) {
    6.             return sys.dbAuth(name) == level;
    7.         };
    8.     };
    9.     var authToIcon = ["u", "m", "a", "o"];
    10.     var printOnlineOffline = function(name) {
    11.         if (sys.id(name) === undefined) {
    12.             if (DoNotShowIfOffline.indexOf(name) == -1) sys.sendHtmlMessage(src, "<timestamp/><img src=\"Themes\\Classic\\client\\" + authToIcon[sys.dbAuth(name)] + "Away.png\">" + name + "(offline)", channel);
    13.         }
    14.         else {
    15.             sys.sendHtmlMessage(src, "<timestamp/><img src=\"Themes\\Classic\\client\\" + authToIcon[sys.dbAuth(name)] + "Available.png\"><font color = " + sys.getColor(sys.id(name)) + "><b>" + name.toCorrectCase() + "</b></font> (online)", channel);
    16.         }
    17.     };
    18.     var authlist = sys.dbAuths().sort();
    19.     sys.sendMessage(src, "", channel);
    20.     switch (commandData) {
    21.         case "owners":
    22.             sys.sendMessage(src, "*** Owners ***", channel);
    23.             authlist.filter(filterByAuth(3)).forEach(printOnlineOffline);
    24.             break;
    25.         case "admins":
    26.         case "administrators":
    27.             sys.sendMessage(src, "*** Administrators ***", channel);
    28.             authlist.filter(filterByAuth(2)).forEach(printOnlineOffline);
    29.             break;
    30.         case "mods":
    31.         case "moderators":
    32.             sys.sendMessage(src, "*** Moderators ***", channel);
    33.             authlist.filter(filterByAuth(1)).forEach(printOnlineOffline);
    34.             break;
    35.         default:
    36.             sys.sendMessage(src, "*** Owners ***", channel);
    37.             authlist.filter(filterByAuth(3)).forEach(printOnlineOffline);
    38.             sys.sendMessage(src, '', channel);
    39.             sys.sendMessage(src, "*** Administrators ***", channel);
    40.             authlist.filter(filterByAuth(2)).forEach(printOnlineOffline);
    41.             sys.sendMessage(src, '', channel);
    42.             sys.sendMessage(src, "*** Moderators ***", channel);
    43.             authlist.filter(filterByAuth(1)).forEach(printOnlineOffline);
    44.     }
    45.     sys.sendMessage(src, '', channel);
    46.     return;
    47. }
    48.  
     
    Binix likes this.
  3. Binix

    Binix work drugs

    Joined:
    Jun 13, 2014
    Messages:
    58
    Likes Received:
    11
    Thanks so much lol