Rank.txt
snippets · 2.3 KB · 2010-03-30
Command that lets immortals set their own rank on who (for Buddha-style ASCII pfiles).
Download « Back to the snippets list
Here is a command that gives your immortals able to set there on immortal ranks on who.
This is for buddha any version that runs the ascii pfiles.
:::::PFDEFAULTS.H:::::
Add this:
#define PFDEF_IMMTITLE 0
:::::UTILS.H:::::
Add this under void set_title:
void set_immtitle(struct char_data *ch, char *title);
Add this under #define GET_TITLE(ch):
#define GET_IMMTITLE(ch) ((ch)->player.immtitle)
:::::LIMITS.C:::::
Add this anywhere:
void set_immtitle(struct char_data *ch, char *title)
{
if (strlen(title) > MAX_TITLE_LENGTH)
title[MAX_TITLE_LENGTH] = '\0';
if (GET_IMMTITLE(ch) != NULL)
free(GET_IMMTITLE(ch));
GET_IMMTITLE(ch) = strdup(title);
}
:::::ACT.OTHER.C:::::
UNDER ACMD(do_title); Add:
ACMD(do_rank);
Then search for do_title and above it add:
ACMD(do_rank)
{
skip_spaces(&argument);
delete_doubledollar(argument);
if (IS_NPC(ch))
send_to_char(ch, "Your title is fine... go away.\r\n");
else if (PLR_FLAGGED(ch, PLR_NOTITLE))
send_to_char(ch, "You can't title yourself -- you shouldn't have abused it!\r\n");
else if (strstr(argument, "(") || strstr(argument, ")"))
send_to_char(ch, "Titles can't contain the ( or ) characters.\r\n");
else if (strlen(argument) > MAX_TITLE_LENGTH)
send_to_char(ch, "Sorry, titles can't be longer than %d characters.\r\n", MAX_TITLE_LENGTH);
else {
set_immtitle(ch, argument);
send_to_char(ch, "Okay, you're immtitle is now: %s.\r\n", GET_IMMTITLE(ch));
}
}
:::::STRUCTS.H:::::
search char_player_data { in there somewhere add:
char *immtitle;
:::::INTERPRETER.C::::
Where all the other ACMD(do_*.*) are add:
ACMD(do_rank);
Then add this with the rest:
{ "rank" , "rank" , POS_DEAD , do_rank , LVL_IMMORT, 0 },
:::::ACT.INFORMATIVE.C::::
search till you find the do_who with all the code, now where it says IF (GET_LEVEL(tch) >= LVL_IMMORT) { where it displays the immortal output add a:
%s in there, then with all the GET_ things, add GET_IMMTITLE(tch). it must be in the right order.
now search do_score now add this somewhere:
if (GET_LEVEL(ch) > LVL_IMMORT)
send_to_char(ch, "@cCharacter Rank@W: %s\r\n", GET_IMMTITLE(ch));
this makes it so only immortals can see it on do_score.
::::NOW TYPE MAKE CLEAN, THEN MAKE::::::
Well done, you did it:) - Rikishi