Hey all,
I'm trying to get a mudlog/syslog message to work, however I'm not
absolutely sure what it entails or what I should do. Here's what I would
"like" to do to the do_set function I'm working on.
1. char old_player_name = GET_NAME(vict);
Basically, I want to store the character's name in the variable
old_player_name so that I can call it for the syslog message the gods see
when a player has his/her name changed. However, I'm not real sure how to do
it.. Currently it merely says something lame like :
[ (GC) George changes Bloomer's name to ... ]
It's supposed to say:
[ (GC) George changes Bloomer's name to Tommas ]
Here's my code in do_set minus the millions of attempts and current ideas
from above, if you can help me out I'd appreciate it. :P
case 54:
any_one_arg(val_arg, buf);
if (buf == NULL || strlen(buf) <= 2) {
send_to_char("Name is too short.\r\n", ch);
return(0);
}
else if ((i = get_id_by_name(buf)) != -1) {
send_to_char("A player by that name already exists!", ch);
return(0);
}
else {
char logbuf[MAX_STRING_LENGTH];
CAP(buf);
sprintf(old_name, victim->player.name);
free(vict->player.name);
vict->player.name = str_dup(buf);
for (i = 0; i <= top_of_p_table; i++)
if ((player_table + i)->id == GET_IDNUM(vict))
break;
if ((player_table + i)->name) /* Another redundant check? */
free((player_table + i)->name);
CREATE((player_table + i)->name, char, strlen(buf) + 1);
for (j = 0;(*((player_table + i)->name + j) = LOWER(buf[j])); j++);
sprintf(buf, "Name changed to %s.", GET_NAME(vict));
create_char_dir((player_table+i)->name);
save_char(vict, vict->in_room);
save_player_index();
/* Log and messages - Armageddon */
sprintf(buf, "Your name has been changed to %s.\r\n", GET_NAME(vict));
send_to_char(buf, vict);
sprintf(logbuf, "(GC) %s changes %s's name to ...",GET_NAME(ch),
GET_NAME(vict));
mudlog(logbuf, NRM, LVL_LGOD, TRUE);
}
break;
default:
send_to_char("Can't set that!\r\n", ch);
return 0;
}
_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
--
+---------------------------------------------------------------+
| FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
| Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
| Newbie List: http://groups.yahoo.com/group/circle-newbies/ |
+---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT