idle.c

ds2.1.1/lib/cmds/players/idle.c · 1.0 KB

From the archive ds2.1.1.zip

Download the archive   « Back to the archive contents

/*  /cmds/players/idle
 *  Simple command which displays named player's idle time
 *  Recreated by Blitz@Dead Souls 960108
 */

mixed cmd(string args) {
    int x;
    object who;

    if( !sizeof(args) ) return "Syntax: idle <user name>";
    args = convert_name(args);
    who = find_player(args);
    if( !who || who->GetInvis() )
	return "Unable to locate anyone by that name.";
    if( !interactive(who) )
	return (string)who->GetName() + " is link dead.";
    x = query_idle(who);
    if( x > 4 ) {
	this_player()->eventPrint( sprintf("%s has been idle for %s%s.",
	    (string)who->GetName(),
	    ( x>59 ? ( consolidate(x/60, "one minute") + " and " ) : "" ),
	    consolidate(x%60, "one second")) );

    }
    else this_player()->eventPrint((string)who->GetName() + " is "
	  "not idle.");
    return 1;
}

string GetHelp(string str) {
    return "Syntax: idle <user name>\n\n"
    "Displays named user's idle time.  A user's \"idle time\" is "
    "the amount of time since the named user last sent input "
    "to the MUD.";
}

Site Stats

Snippets: 1791
Codebases: 571