Re: [OLC] [Newbie] A command for use on obj amd mobs only in thier OLC zone

From: Phillip A Ames (kirk47@juno.com)
Date: 11/28/98


On Sat, 28 Nov 1998 01:20:16 -0500 RHS Linux User
<carnage@GAMES2.MUDSRUS.COM> writes:
>Ok my general idea was to fix the load command so that builders could
only
>load things within thier OLC zone.  So for say I have zone 8 and I want
to
>load obj 900, it ain't gonna happen cause 9 is not my zone, but if the
obj
>was number 800 it would load.  Ok so I peared thrue olc.c and found that
>this is how OLC stops one from editing a zone thats not theirs unless
their an >imp.
> if ((GET_LEVEL(ch) < LVL_IMPL) &&
>        (zone_table[OLC_ZNUM(d)].number != GET_OLC_ZONE(ch))) {
>    send_to_char("You do not have permission to edit this zone.\r\n",
ch);
>    free(d->olc);
>    return;
>
>Ok so I know to make this a common check I'll have to pull out the
>free(d->olc) part, but what about defining in the structure which
decides
>if the stuff they want to load comes from their zone?  Anyone have
>any ideas?  LAterz.

Simple, what you need to do is multiply their olc zone by 100, like this:

int min_vnum = GET_OLC_ZONE(ch) * 100;
int max_vnum = min_vnum + 99;

So if they had an olc of 8, min_vnum would be 800, and max_vnum would be
899.  Then you'd just need a check to see if the vnum of the object/mob
was > max_vnum or < min_vnum, something like this in this chunk of code:

if (is_abbrev(buf, "mob")) { // Begin placeholder
  if ((r_num = real_mobile(number)) < 0) {
    send_to_char("There is no monster with that number.\r\n", ch);
    return;
  }
// Begin Addition
if(GET_LEVEL(ch) < LVL_IMPL){
if(number > max_vnum || number < min_vnum){
    send_to_char("You don't have permission to load this mob.", ch);
    return;
  }
}
// End addition
mob = read_mobile(r_num, REAL);
char_to_room(mob, ch->in_room);
// End placeholder

And then just do something similar to this in the object part.  Hope that
helps!

-Phillip


Phillip Ames    | Satisfaction is not guaranteed.
kirk47@juno.com | -Ferengi Rule of Acquisition #19
ICQ: 8778335    | AOL IM: Grathol
http://members.xoom.com/Gowron/index.html

___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com/getjuno.html
or call Juno at (800) 654-JUNO [654-5866]


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