|
Immlist Command [by Brian Helms] |
|
|
|
Posted Wednesday, August 12th @ 11:29:00 PM, by George Greer in the Wizard dept.
Added May 6, 1997. Click the link below to read it or download it.
From: Brian Helms <bhelms1@gl.umbc.edu>
Subject: List off all immortals in playerfile
For want of something better to do I'll post this little snippet and hope
it'll help a fellow newbie out there :) The following code, when added to
do_show in act.wizard.c, will allow you to search through your player file
and lists everyone >= LVL_IMMORT. For anyone who wants a "real" check of
whos-who from your playerfile, this is it.
In act.wizard.c:
-in do_show add the following variables:
FILE *fl;
struct char_file_u player;
-insert into show_struct:
{ "immortals", LVL_IMPL},
-insert <changing the case statement from case 15: to be the appropriate
number in your code> into the big case statement at the end of do_show:
case 15:
if (!(fl = fopen(PLAYER_FILE, "r+"))) {
send_to_char("Can't open player file.", ch);
return;
}
sprintf(buf, "Player Name Player Level\r\n");
while (!done) {
fread(&player, sizeof(struct char_file_u), 1, fl);
if (feof(fl)) {
fclose(fl);
done=TRUE;
}
if (!done)
if (player.level>=LVL_IMMORT)
sprintf(buf, "%s%-20s %-2i\r\n", buf, player.name, player.level);
}
send_to_char(buf, ch);
break;
And that's it! The outline for this code has shamelessly been twisted out
of the playerfile update utilities packaged with the stock code.
Brian
bhelms1@gl.umbc.edu
<< Ignore Code [by Josh B.] | Reply | View as text | Flattened | Innate Spell Code [by Patrick J. Dughi] >> |
|
Related Links |
|
|
|
CircleMUD Snippets |
|
|
Note: Not all of these snippets will work perfectly with
your version of code, so be prepared to fix one
or two bugs that may arise, and please let me know
what you needed to do to fix it. Sending a corrected
version is always welcome.
|
Finally, if you wish to use any of the snippets from this
page, you are more than welcome, just mention the
authors in your credits. If you wish to release any
of these snippets to the public on another site,
contact me FIRST.
|
|
|
|
|
|
|