DeadlySilence Posted May 7, 2013 Posted May 7, 2013 File Name: Ingame GM List File Submitter: DeadlySilence File Submitted: 06 May 2013 File Category: Utilities Content Author: DeadlySilence This script shows a list of all GMs with their corresponding status (i.e. online or offline). You can configure the script to show or hide the last login time of each GM. As a special feature, the result is cached for a certain amount of time if you wish (see inline configuration, by default caching for 30 seconds is enabled). This prevents players from spamming the database with SELECT queries. Version 2.0 comes with a source modification to show the group name the GM is in and the option to show the list directly in the user's chat (dispbottom) rather than the NPC dialogue. Special thanks to Akinari for helping me with the script command and Armor for requesting this feature. Instructions To get version 2.0 working, you need to patch your src/map/script.c file with the "groupid.diff" and recompile. To apply the patch use patch -p0 < /location/to/the/groupid.diff from your rAthena directory root. If you use Windows and TortoiseSVN, you have to right click into your rAthena directory root, select "TortoiseSVN -> Apply Patch" and select the patch file. Click "patch all items" and you're done. If you do not want to change your source for this, you can remove all occurences of "groupIdToName" inside the script to deactivate the automatic group name display. Click here to download this file 1 Quote
Drakkus Posted May 29, 2013 Posted May 29, 2013 (edited) NVM. Thank you! Edited May 29, 2013 by Vlync Quote
DeadlySilence Posted July 7, 2013 Author Posted July 7, 2013 As requested by Armor, I updated the script a bit. The group name of every GM (thus, his/her position on your server) is now shown in front of the name. To enable this feature you have to follow the instructions and apply the patch. Thanks to Akinari for helping me with the script command and Armor for suggesting this feature. Quote
Caith1991 Posted July 9, 2013 Posted July 9, 2013 A litte Bug Report, Our Server Version: rAthena Verion SVN r17407 is it normal that every last login shows the exact same date/time? 1 Quote
DeadlySilence Posted July 9, 2013 Author Posted July 9, 2013 Oh, I see the problem. I'll fix this later today, thanks for the bug report. Should be fixed in version 2.1. Thanks for reporting. Quote
mrlongshen Posted July 19, 2013 Posted July 19, 2013 Oh, I see the problem. I'll fix this later today, thanks for the bug report. Should be fixed in version 2.1. Thanks for reporting. sir have u fix it ? Quote
DeadlySilence Posted July 19, 2013 Author Posted July 19, 2013 Oh, I see the problem. I'll fix this later today, thanks for the bug report. Should be fixed in version 2.1. Thanks for reporting. sir have u fix it ? I have fixed it one week ago with version 2.1 Quote
mrlongshen Posted July 19, 2013 Posted July 19, 2013 Oh, I see the problem. I'll fix this later today, thanks for the bug report. Should be fixed in version 2.1. Thanks for reporting. sir have u fix it ? I have fixed it one week ago with version 2.1 thx you. i need to diff manually right ? Quote
DeadlySilence Posted July 19, 2013 Author Posted July 19, 2013 You don't need to diff it manually, you can simply replace your current version with the latest script. Quote
mrlongshen Posted July 19, 2013 Posted July 19, 2013 sir i would like to ask, why all player online list are there ? what do i mistake ? here the source i edit. http://pastebin.com/DcJngnXu Quote
DeadlySilence Posted July 19, 2013 Author Posted July 19, 2013 You need to configure it first. // minimum level to be recognized as a GM .minLevel = 0; 1 Quote
mrlongshen Posted July 19, 2013 Posted July 19, 2013 You need to configure it first. // minimum level to be recognized as a GM .minLevel = 0; yay! its works like charm. fuhh.. luckily no need to edit source . heheh Thanks alot bro Quote
uDe Posted July 22, 2013 Posted July 22, 2013 parse_line: need ';' 31 : // if .msgToChat is enabled, send the list directly to the chat 32 : if (.msgToChat) { 33 : 34 : dispbottom "GM List:"; 35 : for (.@i = 0; .@i < getarraysize(.online$); .@i += 1) { * 36 : dispbottom "[" + groupIdToName'('.group[.@i]) + "] " +.name$[.@i] + ": " + (("0" != .online$[.@i]) ? "online" : "offline" + ((.showLastOnline) ? ", last online at " + .date$[.@i] + " " + .time$[.@i] : "")); 37 : } 38 : end; 39 : } 40 : 41 : mes "[GM List]", ""; This is from gm_status_v2_1.txt Quote
uDe Posted July 22, 2013 Posted July 22, 2013 @ude, have u patch manually ? Ah. My bad. I didn't apply the .diff provided. Thank you very much. My problem solved. Quote
mrlongshen Posted July 22, 2013 Posted July 22, 2013 @ude, have u patch manually ? Ah. My bad. I didn't apply the .diff provided. Thank you very much. My problem solved. haha ok sir xD Quote
rqueen Posted July 27, 2013 Posted July 27, 2013 (edited) Hello, is there any possibility you'll make an eA-compatible release for this? Edited July 27, 2013 by rqueen Quote
DeadlySilence Posted July 28, 2013 Author Posted July 28, 2013 Hello, is there any possibility you'll make an eA-compatible release for this? This might work, but I didn't test it: prontera,160,180,4 script GMs Online 857,{ // check if caching is enabled AND caching time is over OR caching is disabled if ((.caching && (.onlineCachingTime + .cachingTime <= gettimetick(2))) || !.caching) { query_sql( "SELECT `l`.`level`, DATE_FORMAT( `l`.`lastlogin`, '" + .dateString$ + "') as date, DATE_FORMAT(`l`.`lastlogin`, '" + .timeString$ + "') as time, `c`.`name`, `c`.`online` FROM `login` l " + "JOIN (`char` c) " + "ON (`l`.`account_id` = `c`.`account_id`) " + "WHERE `l`.`group_id` >= " + .minLevel + " " + "ORDER BY `c`.`online` DESC, `l`.`group_id` DESC, `c`.`name` ASC" , .group, .date$, .time$, .name$, .online$ ); .onlineCachingTime = gettimetick(2); } // if .msgToChat is enabled, send the list directly to the chat if (.msgToChat) { dispbottom "GM List:"; for (.@i = 0; .@i < getarraysize(.online$); .@i += 1) { dispbottom "[Level " + .group[.@i] + "] " +.name$[.@i] + ": " + (("0" != .online$[.@i]) ? "online" : "offline" + ((.showLastOnline) ? ", last online at " + .date$[.@i] + " " + .time$[.@i] : "")); } end; } mes "[GM List]", ""; for (.@i = 0; .@i < getarraysize(.online$); .@i += 1) { mes "[Level " + .group[.@i] + "] " +.name$[.@i] + ": " + ("0" != .online$[.@i] ? "^00AA00online^000000" : "^FF0000offline^000000"); if ((.showLastOnline) && ("0" == .online$[.@i])) { mes "last online at " + .date$[.@i] + " " + .time$[.@i]; } mes "———————————————————"; } close; OnInit: // cache the results to prevent spam .caching = 0; // caching time in seconds .cachingTime = 30; // minimum level to be recognized as a GM .minLevel = 1; // if activated, show when the GM was online the last time (account based) .showLastOnline = 1; // format the date string (%Y for year, %m for month, %d for day) .dateString$ = "%m/%d/%Y"; // format the time string (%H for hour (24 hour format), %h for hour (12 hour format), %i for minute) .timeString$ = "%H:%i"; // show GM list directly to chat rather than in an NPC window .msgToChat = 0; } Quote
rqueen Posted July 31, 2013 Posted July 31, 2013 Hello! Thanks for entertaining my post. Much appreciated. I tried your revised script, I get this: parse_line: expect command, missing function name or calling undeclared function 20 : + "WHERE `l`.`group_id` >= " + .minLevel + " " 21 : + "ORDER BY `c`.`online` DESC, `l`.`group_id` DESC, `c`.`name` ASC" 22 : , .group, .date$, .time$, .name$, .online$ 23 : ); 24 : * 25 : '.'onlineCachingTime = gettimetick(2); 26 : } 27 : 28 : // if .msgToChat is enabled, send the list directly to the chat 29 : if (.msgToChat) { 30 : Quote
DeadlySilence Posted July 31, 2013 Author Posted July 31, 2013 Oh, right... I forgot eAthena doesn't support this method of setting variables... prontera,160,180,4 script GMs Online 857,{ // check if caching is enabled AND caching time is over OR caching is disabled if ((.caching && (.onlineCachingTime + .cachingTime <= gettimetick(2))) || !.caching) { query_sql( "SELECT `l`.`level`, DATE_FORMAT( `l`.`lastlogin`, '" + .dateString$ + "') as date, DATE_FORMAT(`l`.`lastlogin`, '" + .timeString$ + "') as time, `c`.`name`, `c`.`online` FROM `login` l " + "JOIN (`char` c) " + "ON (`l`.`account_id` = `c`.`account_id`) " + "WHERE `l`.`group_id` >= " + .minLevel + " " + "ORDER BY `c`.`online` DESC, `l`.`group_id` DESC, `c`.`name` ASC" , .group, .date$, .time$, .name$, .online$ ); set .onlineCachingTime, gettimetick(2); } // if .msgToChat is enabled, send the list directly to the chat if (.msgToChat) { dispbottom "GM List:"; for (set .@i, 0; .@i < getarraysize(.online$); set .@i, .@i + 1) { dispbottom "[Level " + .group[.@i] + "] " +.name$[.@i] + ": " + (("0" != .online$[.@i]) ? "online" : "offline" + ((.showLastOnline) ? ", last online at " + .date$[.@i] + " " + .time$[.@i] : "")); } end; } mes "[GM List]", ""; for (set .@i, 0; .@i < getarraysize(.online$); set .@i, .@i + 1) { mes "[Level " + .group[.@i] + "] " +.name$[.@i] + ": " + ("0" != .online$[.@i] ? "^00AA00online^000000" : "^FF0000offline^000000"); if ((.showLastOnline) && ("0" == .online$[.@i])) { mes "last online at " + .date$[.@i] + " " + .time$[.@i]; } mes "———————————————————"; } close; OnInit: // cache the results to prevent spam set .caching, 0; // caching time in seconds set .cachingTime, 30; // minimum level to be recognized as a GM set .minLevel, 1; // if activated, show when the GM was online the last time (account based) set .showLastOnline, 1; // format the date string (%Y for year, %m for month, %d for day) set .dateString$, "%m/%d/%Y"; // format the time string (%H for hour (24 hour format), %h for hour (12 hour format), %i for minute) set .timeString$, "%H:%i"; // show GM list directly to chat rather than in an NPC window set .msgToChat, 0; } 1 Quote
rqueen Posted August 2, 2013 Posted August 2, 2013 Thanks! A new error at line 38 though. parse_line: need ';' 33 : dispbottom "[Level " + .group[.@i] + "] " +.name$[.@i] + ": " + (("0" != .online$[.@i]) ? "online" : "offline" + ((.showLastOnline) ? ", last online at " + .date$[.@i] + " " + .time$[.@i] : "")); 34 : } 35 : end; 36 : } 37 : * 38 : mes "[GM List]"',' ""; 39 : for (set .@i, 0; .@i < getarraysize(.online$); set .@i, .@i + 1) { 40 : 41 : mes "[Level " + .group[.@i] + "] " +.name$[.@i] + ": " + ("0" != .online$[.@i] ? "^00AA00online^000000" : "^FF0000offline^000000"); 42 : if ((.showLastOnline) && ("0" == .online$[.@i])) { 43 : mes "last online at " + .date$[.@i] + " " + .time$[.@i]; Quote
DeadlySilence Posted August 3, 2013 Author Posted August 3, 2013 Ok, I fixed this problem and tried to run it. The map server gives no more errors now. prontera,160,180,4 script GMs Online 857,{ // check if caching is enabled AND caching time is over OR caching is disabled if ((.caching && (.onlineCachingTime + .cachingTime <= gettimetick(2))) || !.caching) { query_sql( "SELECT `l`.`level`, DATE_FORMAT( `l`.`lastlogin`, '" + .dateString$ + "') as date, DATE_FORMAT(`l`.`lastlogin`, '" + .timeString$ + "') as time, `c`.`name`, `c`.`online` FROM `login` l " + "JOIN (`char` c) " + "ON (`l`.`account_id` = `c`.`account_id`) " + "WHERE `l`.`group_id` >= " + .minLevel + " " + "ORDER BY `c`.`online` DESC, `l`.`group_id` DESC, `c`.`name` ASC" , .group, .date$, .time$, .name$, .online$ ); set .onlineCachingTime, gettimetick(2); } // if .msgToChat is enabled, send the list directly to the chat if (.msgToChat) { dispbottom "GM List:"; for (set .@i, 0; .@i < getarraysize(.online$); set .@i, .@i + 1) { dispbottom "[Level " + .group[.@i] + "] " +.name$[.@i] + ": " + (("0" != .online$[.@i]) ? "online" : "offline" + ((.showLastOnline) ? ", last online at " + .date$[.@i] + " " + .time$[.@i] : "")); } end; } mes "[GM List]"; for (set .@i, 0; .@i < getarraysize(.online$); set .@i, .@i + 1) { mes "[Level " + .group[.@i] + "] " +.name$[.@i] + ": " + ("0" != .online$[.@i] ? "^00AA00online^000000" : "^FF0000offline^000000"); if ((.showLastOnline) && ("0" == .online$[.@i])) { mes "last online at " + .date$[.@i] + " " + .time$[.@i]; } mes "———————————————————"; } close; OnInit: // cache the results to prevent spam set .caching, 0; // caching time in seconds set .cachingTime, 30; // minimum level to be recognized as a GM set .minLevel, 1; // if activated, show when the GM was online the last time (account based) set .showLastOnline, 1; // format the date string (%Y for year, %m for month, %d for day) set .dateString$, "%m/%d/%Y"; // format the time string (%H for hour (24 hour format), %h for hour (12 hour format), %i for minute) set .timeString$, "%H:%i"; // show GM list directly to chat rather than in an NPC window set .msgToChat, 0; } 2 Quote
rqueen Posted August 5, 2013 Posted August 5, 2013 Getting some SQL errors, but that's probably on my side. Thanks! Quote
Drakkus Posted September 6, 2013 Posted September 6, 2013 @Dealysilence possible to add feature P.M or A.M ? Thanks in Advance! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.