|
Restricting access to rooms [by Billy H. Chan] |
|
|
|
Posted Wednesday, August 12th @ 11:35:51 PM, by George Greer in the Rooms dept.
. Click the link below to read it or download it.
From: "Billy H. Chan" <bhchan@po.EECS.Berkeley.EDU>
Subject: CODE: Restricting Movement
This code example is intended to show one possible way that you
can restrict certain people from entering a certain room.
In do_simple_move, after checking for /* charmed? */ is
the best place to put checks in. Here is an example:
/* Check for UpperGodsRoom */
if ((ROOM_FLAGGED(ch->in_room, ROOM_UPPERGODROOM) ||
ROOM_FLAGGED(EXIT(ch, dir)->to_room, ROOM_UPPERGODROOM)) &&
GET_LEVEL(ch) < LVL_GRGOD) {
send_to_char("A strange force prevents you from going there.\r\n", ch);
return 0;
}
/* Check for GodRoom */
if ((ROOM_FLAGGED(ch->in_room, ROOM_GODROOM) ||
ROOM_FLAGGED(EXIT(ch, dir)->to_room, ROOM_GODROOM)) &&
GET_LEVEL(ch) < LVL_AMBASSADOR) {
send_to_char("A strange force prevents you from going there.\r\n", ch);
return 0;
}
So, define your ROOM flags and figure out the levels and you're done.
<< Reroll stats [by BuckFloyd] | Reply | View as text | Threaded | Retreat Skill [by S.Mead] >> |
|
Related Links |
|
|
|
CircleMUD Snippets |
|
|
Note: Not all of these snippets will work perfectly with
your version of code, so be prepared to fix one
or two bugs that may arise, and please let me know
what you needed to do to fix it. Sending a corrected
version is always welcome.
|
Finally, if you wish to use any of the snippets from this
page, you are more than welcome, just mention the
authors in your credits. If you wish to release any
of these snippets to the public on another site,
contact me FIRST.
|
|
|
|
|
|
|