Voltecs punish command, I knocked this up when I was bored coZ I thought it might be a bit neater to have all the punishments available in one command! Syntax: punish [parameters] Where punishment is one of the following... noemote notell noshout nochannels noexp notitle lag Feel free to add your own punishment options... The last 3 are not stock Rom, but are available as snippets on the web (probably on the same page as this code...) The following function calls the other punishment commands rather than re-coding them from scratch, this makes it a bit nicer for me to code... (And a little easier to modify!) It also has the added bonus that you can keep the original punishment commands in interp.* as well if you so wish... You may want to move all the related commands out of act_wiz.c and into punish.c, (As I did...) or alternatively include all the bits of punish.c in act_wiz, either way, I'd appreciate it if you kept the header at the top of the routines... It's an ego thing! Anyway, on with the code! -Voltec As usual, add lines to intep.c / interp.h regarding the punish command. and add the new wiznet flag WIZ_PUNISH to merc.h, and the wiznet table etc, I'll let you find all that stuff (I can't remember off the top of my head where it is...) ------------------------------------------------- /****************************************************************** * PUNISH.C Version 1.1 * * Written by Voltec (Voltec@cyberdude.com) 1998 * * For Empire Of The Night (eotn.oaktree.co.uk 4100) * * All the usual DIKU/MERC/ROM/EOTN Licences apply * * If you use this code, drop me a line so I can see if people * * Actually find this usefull. * * REMEMBER * * Share and Enjoy! -Voltec 98 * ******************************************************************/ #if defined(macintosh) #include #else #include #endif #include #include #include #include #include "merc.h" DECLARE_DO_FUN( do_notell ); DECLARE_DO_FUN( do_noemote ); DECLARE_DO_FUN( do_noshout ); DECLARE_DO_FUN( do_nochannels ); /* Non-stock code Punishments... * * You might not have them... * * Inwhich case, just remove them! */ DECLARE_DO_FUN( do_noexp ); DECLARE_DO_FUN( do_notitle ); DECLARE_DO_FUN( do_lag ); struct punish_type /* Similar to the command table in interp.c */ { char * const name; DO_FUN * do_fun; sh_int level; }; const struct punish_type punish_table []; const struct punish_type punish_table [] = { { "notell", do_notell, SUPREME }, { "noemote", do_noemote, SUPREME }, { "noshout", do_noshout, SUPREME }, { "nochannels", do_nochannels, CREATOR }, /* Non-stock code Punishments... * * You might not have them... * * Inwhich case, just remove them! */ { "noexp", do_noexp, CREATOR }, { "notitle", do_notitle, CREATOR }, { "lag", do_lag, IMPLEMENTOR }, { NULL, 0, 0 } /* Table terminator */ }; void do_punish(CHAR_DATA *ch, char *argument) { char arg1[MAX_STRING_LENGTH]; char arg2[MAX_STRING_LENGTH]; char argtemp[MAX_STRING_LENGTH]; char buf[MAX_STRING_LENGTH]; CHAR_DATA *victim; int index; if (IS_NPC(ch)) return; argument = one_argument(argument, arg1); argument = one_argument(argument, arg2); /* * so in theory, arg1 holds arg2 holds argument * holds the [parameters] if any */ if (!strcmp(arg1, "show") ) { send_to_char("You can administer the following Punnishments... \n\r",ch); for(index=0 ; punish_table[index].name != NULL ; index++) { if ( ch->trust >= punish_table[index].level ) { send_to_char(" ", ch); send_to_char(punish_table[index].name, ch); } } send_to_char("\n\r", ch); return; } if ( (arg1[0]=='\0') || (arg2[0]=='\0') ) { send_to_char(" Syntax : punish [parameters] \n\r", ch); return; } victim = get_char_world(ch, arg1); if ( victim == NULL) { send_to_char("They have to be playing to be punished!\n\r",ch); return; } for(index=0 ; punish_table[index].name != NULL ; index++) { if ( punish_table[index].level <= ch->trust ) { if ( !strcmp(punish_table[index].name, arg2) ) { sprintf(buf, "%s %s", victim->name, argument); /*ie reassemble the argument for calling the punishment*/ /* Dispatch the command */ (*punish_table[index].do_fun) (ch, buf); sprintf(buf, "%s has just punished %s with %s\n\r", ch->name, victim->name, arg2); wiznet(buf, ch, NULL, WIZ_PUNISH, 0, 110); return; } } } /* If we get here, the punishment wasn't executed... */ send_to_char("No such punishment option!\n\r", ch); return; } /* This is the end of the do_punish routine, add all the other * * punnishment routines here if you like... Whatever keeps you * * Happy! -Voltec 98 */ /* NB to add a punnishment to this command, simply put a new line for it * in the punishment table, and add a DECLARE_DO_FUN for it at the top * of the routine. */