viewing paste Unknown #19458 | Athena

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
/*
    Shows current players online, then a list with players online
    (C) 2015, Oxxy, v1.9.8
    v1.0 initial release.
    v1.1 added @online atcommand.
    v1.2 added GMs online list.
    v1.2.1 fixed typos.
    v1.2.2 fixed menu.
    v1.2.3 fixed more typos.
    v1.3 added config to show location, level, location+level or nothing but name.
    v1.3.1 fixed MORE typos, finally should be working.
    v1.4 Added .MaxGrpID config. See OnInit for description.
    v1.5 Added GM Level to show together with GM's name. Location of GM will only be shown if the variable .showLocation equals to 1 and your group id is more than 0
    v1.5.1 fixed small typo in check of group id. (OnPCLoginEvent and OnPCLogoutEvent)
    v1.5.2 Instead of SQL query, update waitingroom with script command getusers(1). - ty Dastgir for pointing that out.
    v1.5.3 Merged .showLocation and .showLevel variable into one bitwise variable .showPlayerInfo - ty Dastgir
    v1.5.4 Added Job level to show in NPC. so .showPlayerInfo = 1; shows Base and Job level together.
    v1.6 Added Peak Online
    v1.7 Added disabling of location show when WOE is on if setting .checkWOE equal to 1.
    v1.8 Added menu after every .maxPlayersPerPage players, that will allow you to quit at any point, or just continue listing through players.
    v1.8.1 translated russian string, accidently got from my script.
    v1.8.2 now only players with .minGrpID can see GMs location, fixed one more russian string. hehe.
    v1.9 Added Job to show, changed variable .showLocLevel to .showPlayerInfo
    v1.9.1 Fixed peak online. Now should be saving properly.
    v1.9.2 Cleaned up code a bit(GM location showing code)
    v1.9.3 Swapped array variables from .NPC_type to $Global_type -> GMs will be still shown even if you @reloadscript
    v1.9.4 Added .showPeakOnline bitwise variable. Check OnInit
    v1.9.5 Added new option .announceCurrentOnline. Check OnInit
    v1.9.6 Added support of .hidePlayerInfoWOE
    v1.9.7 Renamed .hidePlayerInfoWOE to .showPlayerInfoWOE, updated info. Check OnInit
    v1.9.8 Updated script, made it with infinite loop which makes it more user-friendly to players
 
*/
 
prontera,155,167,6  script  Online  700,{
    OnShowOnline:
    query_sql "SELECT `name`,`last_map`,`base_level`,`job_level`,`class` FROM `char` WHERE `online` > 0 ORDER BY `last_map`", .@names$, .@loc$, .@blevel, .@jlevel, .@job;
    while(1) {
        switch(select("Players Online:GMs online["+getarraysize($GM_Name$)+"]:Close")) {
        
        case 2://GMs online
            if(getarraysize($GM_Name$) == 0) {
                mes "At the moment, there're no GMs online.";
                continue;
            }
            
            mes "[GMs online: ^0000FF"+getarraysize($GM_Name$)+"^000000]";
            for(.@i = 0; .@i < getarraysize($GM_Name$); .@i++) {
                getmapxy(.Map$,.x,.y, 0, $GM_Name$[.@i]);
                mes "["+$GM_Level[.@i]+"]"+$GM_Name$[.@i]+""+((.showPlayerInfo&2 && getgroupid() > .MinGrpID)?": "+.Map$+"":"")+"";
            }
            continue;
        
        
        case 1://Players Online
        mes "[Players Online: ^FF0000"+getarraysize(.@names$)+"^000000"+((.showPeakOnline&1)?" / ^FF0000"+$PeakOnline+"^000000]":"]")+"";
        for(.@i = 0; .@i < getarraysize(.@names$); .@i++) {
                mes "["+ (.@i + 1)+ "] "+ .@names$[.@i]+ " "+
                ( .showPlayerInfo&4 && ( !.checkWOE || ((agitcheck() == 0 && agitcheck2() == 0) && .showPlayerInfoWOE&4 )) ? " - "+ jobname(.@job[.@i])+ "" : "" )+ 
                ( .showPlayerInfo&1 && ( !.checkWOE || ((agitcheck() == 0 && agitcheck2() == 0) && .showPlayerInfoWOE&1 )) ? " - Lvl: "+ .@blevel[.@i]+ "/"+ .@jlevel[.@i]+ " " : "" )+
                ( .showPlayerInfo&2 && ( !.checkWOE || ((agitcheck() == 0 && agitcheck2() == 0) && .showPlayerInfoWOE&2 )) ? " - Map: "+ .@loc$[.@i]+ "" : "");
            if ( ((.@i+1) % .maxPlayersPerPage) == 0 && .@names$[.@i+1] != "" ) {
                if(select("Show next "+.maxPlayersPerPage+" players:Close") == 2) close;
                next;
            }
        }
        continue;
        
        case 3: close;
        }
    }
    
    OnInit:
        .maxPlayersPerPage = 20;    // Max number per page that'll be shown.
        .MinGrpID = 1;              // Min. group id to show in GM list. Also player with grp id < .MinGrpID can't see GMs location.
        .MaxGrpID = 99;             // Max. group id to show in GM list. Players that have grp id > .MaxGrpID won't be shown in the GMs list.
        
        .showPlayerInfo = 7;        // Bitwise variable,
                                    // 1 = Show only Base/Job Level after the name
                                    // 2 = Show only Map after the name
                                    // 3 = Show Base/Job Level + Map after the name
                                    // 4 = Show only Job after the name
                                    // 5 = Show Job + Base/Job Level
                                    // 6 = Show Job + Map
                                    // 7 = Show Job + Base/Job level + Map
                                
        .checkWOE = 1;              // If you set this to 1, then it will not show locations during WOE.
                                    // 0 to disable this check.
                    
        .showPlayerInfoWOE = 5;     // Hide players info while WOE is on? Bitwsie Variable; .checkWOE have to be set to 1.
                                    // 1 = Hide only Base/Job Level
                                    // 2 = Hide only Map
                                    // 3 = Hide Base/Job Level + Map
                                    // 4 = Hide only Job
                                    // 5 = Hide Job + Base/Job Level
                                    // 7 = Hide Job + Base/Job Level + Map
                                
        .showPeakOnline = 3;        // Show peak online? Bitwise variable
                                    // 1 = show only in NPC dialog
                                    // 2 = show only in waitingroom
                                    // 3 = show in NPC and waitingroom together.
        
        .announceCurrentOnline = 1; // Announce current online every hour?
                                
        bindatcmd "online", strnpcinfo(0)+"::OnShowOnline";
        initnpctimer;
        end;
    
    OnTimer1000:
        delwaitingroom;
        waitingroom "Players online: "+getusers(1)+" "+((.showPeakOnline&2)?"/ "+$PeakOnline+"":"")+"",0;
        if(.announceCurrentOnline && gettime(2) == 00 && gettime(1) == 01)
            announce "[System]: There"+((getusers(1) > 2)?"'re":"'s")+" "+getusers(1)+" player"+((getusers(1)>2)?"s":"")+" online.",bc_all;
        stopnpctimer;
        initnpctimer;
        end;
 
    OnPCLoginEvent:
        if($PeakOnline < getusers(1)) $PeakOnline = getusers(1);
        if(getgroupid() < .MinGrpID || getgroupid() > .MaxGrpID) end;
        $GM_Name$[getarraysize($GM_Name$)] = strcharinfo(0);
        $GM_Level[getarraysize($GM_Level)] = getgroupid();
        end;
 
    OnPCLogoutEvent:
        if(getgroupid() < .MinGrpID || getgroupid() > .MaxGrpID) end;
        for(.@i = 0; .@i < getarraysize($GM_Name$); .@i++) {
            if(strcharinfo(0) != $GM_Name$[.@i]) continue;
            deletearray $GM_Name$[.@i],1;
            deletearray $GM_Level[.@i],1;
            end;
        }
        end;
}
Viewed 684 times, submitted by Guest.