Jump to content

Recommended Posts

Posted

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

  • Upvote 1
  • 4 weeks later...
  • 1 month later...
Posted

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.

  • 2 weeks later...
Posted

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 ? 

Posted

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 :)

Posted

 

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 ? :)

Posted

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 :)

Posted
    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

Posted

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;
}
Posted

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 :

Posted

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;
}
  • Upvote 1
Posted

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];

Posted

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;
}
  • Upvote 2
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...