Re: [Newbie] Getting character's name for == conditional

From: Brian (brian@IMI-BOTTLING.COM)
Date: 03/24/98


-----Original Message-----
From: Benjamin Draper <satrycus@DRACHENBURG.DEMON.CO.UK>
To: CIRCLE@post.queensu.ca <CIRCLE@post.queensu.ca>
Date: Tuesday, March 24, 1998 4:35 PM
Subject: Re:  [Newbie] Getting character's name for == conditional


>Brian wrote:
>> All that I already know... :)  My question is what would the conditional
>> look like to compare "testdummy" to the value that's taken from
>> GET_NAME(vict)?
>
>I think this is what you're after:
>
>  if (!strcmp(argument, "testdummy") && GET_LEVEL(ch) == LVL_IMPL) {
>    raw_kill(ch);
>    return;
>  }
>
>Place it in act.offensive.c in do_kill after it's established there
>is an argument.


Ok...  here's the code:

------------------------------ do_kill in act.offensive.c -----------

ACMD(do_kill)
{
  struct char_data *vict;


  if ((GET_LEVEL(ch) < LVL_IMPL) || IS_NPC(ch)) {
    do_hit(ch, argument, cmd, subcmd);
    return;
  }
  one_argument(argument, arg);

  if (!*arg) {
    send_to_char("Kill who?\r\n", ch);
  } else {
    if (!(vict = get_char_room_vis(ch, arg)))
      send_to_char("They aren't here.\r\n", ch);
    else if (ch == vict)
      send_to_char("Your mother would be so sad.. :(\r\n", ch);
    else if (((strcmp(argument, "testdummy")) && (GET_LEVEL(ch) ==
LVL_IMPL) && (strcmp(GET_NAME(vict), "testdummy")))) {
    raw_kill(ch);
    return;
   } else {
   printf("Argument = %s\r\n", argument); /* just for me to see that the
args are working */
      act("You chop $M to pieces!  Ah!  The blood!", FALSE, ch, 0, vict,
TO_CHAR);
      act("$N chops you to pieces!", FALSE, vict, 0, ch, TO_CHAR);
      act("$n brutally slays $N!", FALSE, ch, 0, vict, TO_NOTVICT);
      raw_kill(vict);
    }
  }
}

------------------------------- end of
do_kill ------------------------------------

I guess I'm still stumped... I think I used the syntax correctly, and the
arguments are working, but it's not doing what it should be doing...  no
matter who kills who, as long as they're LVL_IMPL, it runs thru the strcmp
lines and just raw_kill's the person who tried to type kill <whoever>.

Does anyone see anything wrong?  Do I have some ()'s or {} out of place
maybe?

 - Brian


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST