[CODE] gohome

From: Admin (admin@mudservices.com)
Date: 01/29/97


Hey all,

  Here are three commands that I wrote pertaining to player houses. I hope
you all enjoy them!


This is a long message (you know three functions are kinda big) so if you
don't want it, then don't look at it! :) 

And if ya want, Alex, you can put this on the snippet site.

ACMD(do_gohome)
{

if (GET_GOHOME(ch) == 0)
{
  send_to_char("You don't have a gohome!\r\n", ch);
  return;
}

if (real_room(GET_GOHOME(ch)) < 0)
{
  sprintf(buf, "Invalid Gohome, Room %d does not exist.\r\n",
GET_GOHOME(ch));
  send_to_char(buf, ch);
  return;
}

  sprintf(buf, "%s fades into nothingness and is gone.\r\n",
GET_NAME(ch));
  send_to_room(buf, ch->in_room);
  char_from_room(ch);
  char_to_room(ch, real_room(GET_GOHOME(ch)));
  sprintf(buf, "%s appears in a flash of blinding light!\r\n",
GET_NAME(ch));
  send_to_room(buf, ch->in_room);
  look_at_room(ch, 0);

}

ACMD(do_givehome)
{
  struct char_data *vict;
  int home;

  half_chop(argument, arg, buf);

  if (!*arg || !*buf || !isdigit(*buf))
  {
    send_to_char("Usage: givehome <player> <location>\r\n", ch);
    return;
   }

  if (!(vict = get_char_vis(ch, arg)))
  {
    send_to_char(NOPERSON, ch);
    return;
  }

  if (GET_GOHOME(vict) != 0)
  {
    send_to_char("Character already has a gohome, remove the old one
first!\r\n$
    return;
   }

  home = atoi(buf);

  if (real_room(home) < 0)
  {
  send_to_char("Room does not exist.\r\n", ch);
  return;
  }

  GET_GOHOME(vict) = home;
  GET_LOADROOM(vict) = home;
  sprintf(buf1, "You make %s a gohome!\r\n", GET_NAME(vict));
  send_to_char(buf1, ch);
  sprintf(buf1, "%s makes you a gohome!\r\n", GET_NAME(ch));
  send_to_char(buf1, vict);
}




=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                                           ** FINALITY **
The Last Great Adventure           finality.mudservices.com 4444
             "Judge not, lest ye be judged."
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
   Rasdan: rasdan@necromium.com            Magus: magus560@aol.com


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



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