[Code][MobProc][Help][Question] Banker Proc

From: Lethal Access (lethalaccess@DEATHSDOOR.COM)
Date: 03/19/98


This is driving me crazy.. does anyone have a viable solution to this?
Has anyone
tried incorporating something like this with Circle3.0bpl+ ???

How would I go about telling the banker that tch is the person who said
the
command? I've tried several different things. Either they diddn't
compile, they
diddn't work, or they crashed on me... here's what I started out
with....

SPECIAL(banker)
{
  struct char_data *tch;
  int amount;

  if (!AWAKE(ch) || FIGHTING(ch))
    return FALSE;

  if (CMD_IS("balance"))
  {
 sprintf(buf, "|R%s tells you|W: '|R", GET_NAME(ch));
    if (GET_BANK_GOLD(tch) > 0)
 {
      sprintf(buf, "%sYour current balance is %d coins.|W'|n\r\n", buf,
       GET_BANK_GOLD(tch));
 }
    else
 {
      sprintf(buf, "%sYou currently have no money deposited.|W'|n\r\n",
buf);
 }
    send_to_char(buf, tch);
    return 1;
  }
  else if (CMD_IS("deposit"))
  {
 sprintf(buf, "|R%s tells you|W: '|R", GET_NAME(ch));
    if ((amount = atoi(argument)) <= 0)
 {
      sprintf(buf, "%sHow much do you want to deposit?|W'|n\r\n", buf);
   send_to_char(buf, tch);
      return 1;
    }
    if (GET_GOLD(tch) < amount)
 {
      sprintf(buf, "%sYou don't have that many coins!|W'|n\r\n", buf);
   send_to_char(buf, tch);
      return 1;
    }
    GET_GOLD(tch) -= amount;
    GET_BANK_GOLD(tch) += amount;
    sprintf(buf, "You deposit %d |Ycoins|R.|W'|n\r\n", amount);
    send_to_char(buf, tch);
    act("$n makes a bank transaction.", TRUE, tch, 0, FALSE, TO_ROOM);
    return 1;
  }
  else if (CMD_IS("withdraw"))
  {
 sprintf(buf, "|R%s tells you|W: '|R", GET_NAME(ch));
    if ((amount = atoi(argument)) <= 0)
 {
      sprintf(buf, "%sHow much do you want to withdraw?|W'|n\r\n", buf);

   send_to_char(buf, tch);
      return 1;
    }
    if (GET_BANK_GOLD(tch) < amount)
 {
      sprintf(buf, "%sYou don't have that many coins
deposited!|W'|n\r\n", buf);
   send_to_char(buf, tch);
      return 1;
    }
    GET_GOLD(tch) += amount;
    GET_BANK_GOLD(tch) -= amount;
    sprintf(buf, "%sYou withdraw %d |Ycoins|R.|W'|n\r\n", buf, amount);
    send_to_char(buf, tch);
    act("$n makes a bank transaction.", TRUE, tch, 0, FALSE, TO_ROOM);
    return 1;
  }
  else
  {
    return 0;
  }
}


     +------------------------------------------------------------+
     | 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