BoxBoy writes, "Bored of checking the 'user' command everytime someone logins on, just to make sure they aren't sharing equipment/items? Heres what I did to stop people." replace with a tab
How I dealt with Multiplaying
Bored of checking the 'user' command everytime someone logins on, just to make sure they aren't
sharing equipment/items? Heres what I did to stop people.
Whats so special about this? It allows you to set a maximum amount of connections from a single
host.
** Disclaimer **
This worked for me, and should work for you. If it kills your mud do not blame me, because its
not my fault :)
This is nice and basic.
Firstly lets define the plr_flag.
Open structs.h
and search for:
#define PLR_
at the bottom of that list add:
#define PLR_MULTIPLAYER (1 >> XX) // XX should be one number higher than then PLR_ above
Next, at the top of interpreter.c look for the external ints and just below the last one add:
int multi_play_limit = 2;
Then go down to nanny(), at the top you will need to add some bits.
Look for:
struct descriptor_data *pt;
and change it to:
struct descriptor_data *pt, *k, *next_k;
and just below that you should see:
int player_i, load_result;
and change that to:
int player_i, load_result, connections=0;
further on down you should see this bit of the WizLock code:
if (GET_LEVEL(d->character) < circle_restrict) {
SEND_TO_Q("The game is temporarily restricted.. try again later.\r\n", d);
STATE(d) = CON_CLOSE;
sprintf(buf, "Request for login denied for %s [%s] (wizlock)",
GET_NAME(d->character), d->host);
mudlog(buf, NRM, LVL_GOD, TRUE);
return;
}
then below it just add:
//BoxBoy: Multiplay checking (d->host)
for (k = descriptor_list; k; k = next_k) {
next_k = k->next;
if (k->host == d->host) {
connections++;
if(connections > multi_play_limit && !PLR_FLAGGED(d->character, PLR_MULTIPLAYER)) {
SEND_TO_Q("No more connections from your server, max multiplay limit reached.\r\n", d);
STATE(d) = CON_CLOSE;
sprintf(buf, "Max Multiplayer Limit Reached by [%s]", d->host);
mudlog(buf, NRM, LVL_GOD, TRUE);
return;
}
}
}
//BoxBoy: End Multiplay Checks
and thats it.
I actually put multi_play_limit in my config.c and then put an extern at the top of the file
but it seemed simpler to do it like this.
NOTE: I have an immortal command called 'world' which lets me change certain parts things in
the mud whilst I am online, I would recommend that you have a similar command.
BoxBoy
(Dimensia will hopefully be up full time soon.)
mud.guam.net 6000
http://dimensia.iwarp.com/
<< FTP Uploads 2001/05/27 | Reply | Flattened | Zone Flags [by Ming] >>
|
|
|||||||||||||||||
|
|
| Setting the Multiplayer Flag by BoxBoy (boruki@as-if.com) on Saturday, June 23rd @ 01:34:25 AM http:// |
| Just incase anyone is wondering about how to set the plr_multiplayer flag, I did this using the do_set command. If you don't know how to add things to do_set I have written it below. search for this in act.wizard.c: { "weight", LVL_GOD, BOTH, NUMBER }, /* 50 */ If there is any other lines like this directly below keep going down until you reach the line which looks like: { " ", 0, BOTH, MISC } and above that add: { "multiplayer", LVL_GRGOD, PC, BINARY }, then move down to: default: send_to_char("Can't set that! ", ch); return (0); and above that add this above it: case 69: SET_OR_REMOVE(PLR_FLAGS(vict), PLR_MULTIPLAYER); send_to_char("Muliplayer Flag set.", ch); sprintf(buf, "(GC) %s set Multiplayer Flag on %s", GET_NAME(ch), GET_NAME(vict)); mudlog(buf, NRM, LVL_GRGOD, TRUE); break; make sure the case number is one number higher than the case above. I believe thats about it (don't forget to update the help set in your library files) BoxBoy |
| [ Reply to this comment ] |
| |
|
|
| No Subject Given by BoxBoy (b) on Monday, July 16th @ 02:50:14 AM http:// |
| find and change: if (k->host = d->host) { to: if (!strcmp(k->host, d->host)) { This will make it run under Linux. For some reason though (probably me being a muppet) it doesn't send the msg to the connecting person, nor does it disconnect..it just blocks them. Anyway, it does the job..and I'm happy with it |
| [ Reply to this comment ] |
| |
|
|
| re: MP Patch by Mysidia () on Saturday, September 1st @ 08:04:55 PM http:// |
| " if (k->host == d->host) {" Should use strcmp or strcasecmp. Bug. |
| [ Reply to this comment ] |
| |