OGO/******************************************* * * * Cheater Log * * - Logging Cheaters * * Catch the cheaters before they cheat * * * * Written by Ichike for World of Naruto * * 13-15 January 2009 * * * * Written for Rom 2.4b. May work in * * other code bases, but not guaranteed. * * * * Visit us at http://wonmud.com/ * * or telnet://wonmud.com:9000/ * * * ******************************************/ /* Add this to merc.h to declare the file */ #define CHEATER_FILE "cheater.txt" /* For Cheaters */ /* BIG NOTE - do this or else it won't work! */ /* Now, in areas, create a NEW file (do this manually) called cheater.txt and put some text in it, e.g. "This is where we log cheaters" - if you don't do this then it won't log as it only appends the file, doesn't create it */ /* Add this to interp.h */ DECLARE_DO_FUN( log_cheater ); /* to log cheaters */ /* Add this to a main file somewhere. act_wiz.c would seem like an appropriate place, but it doesn't really matter */ void log_cheater (CHAR_DATA * ch, char * argument) { /* to log cheats */ append_file (ch, CHEATER_FILE, argument); return; } /* Yes, the main file really is that small */ /* Examples of how you can utilise this command */ /* Command cheat number 1 - give LOTS of gold to another player */ /* Add this to do_give in act_obj.c if you want to stop gold abuse */ /* Note that this "cheat check" is silent - players aren't aware that you are doing it. The give gold/silver limit is level based but they could simply get around this by giving 1,000 lots of a smaller amount (etc) so I actually log all gives */ if (!IS_NPC (ch) && !IS_NPC (victim) && !IS_IMMORTAL (victim)) { /* limits amount of money to give from one player to another to stop multiplayer abuse */ int maxsilver = victim->level * victim->level * 10; int maxgold = victim->level * victim->level / 10; char buf[MAX_STRING_LENGTH]; if ((silver) && (amount > maxsilver) && !IS_IMMORTAL (ch)) { sprintf (buf, "You can't give %s that much silver.\n\r", victim->name); send_to_char (buf, ch); sprintf (buf, "POSSIBLE CHEAT: %s (level %d) tried to give %s (level %d) too much silver. They tried to give %d silver while the maximum allowed is %d silver\n\r", ch->name, ch->level, victim->name, victim->level, amount, maxsilver); bug (buf, 0); log_cheater (ch, buf); return; } if ((!silver) && (amount > maxgold) && !IS_IMMORTAL (ch)) { sprintf (buf, "You can't give %s that much Gold.\n\r", victim->name); send_to_char (buf, ch); sprintf (buf, "POSSIBLE CHEAT: %s (level %d) tried to give %s (level %d) too much Gold. They tried to give %d Gold while the maximum allowed is %d Gold\n\r", ch->name, ch->level, victim->name, victim->level, amount, maxgold); bug (buf, 0); log_cheater (ch, buf); return; } if (silver) sprintf (buf, "NOT A CHEAT BUT CHECK FOR MULTIPLES: %s gives %d silver to %s", ch->name, amount, victim->name); else sprintf (buf, "NOT A CHEAT BUT CHECK FOR MULTIPLES: %s gives %d Gold to %s", ch->name, amount, victim->name); log_cheater (ch, buf); } /* Command cheat number 2 - drop money - commonly used to drop money, log off, pick it up with another character */ /* Add this to do_drop in act_obj.c if you want to stop gold drop abuse */ if (amount <= 0 || (str_cmp (arg, "coins") && str_cmp (arg, "coin") && str_cmp (arg, "gold") && str_cmp (arg, "silver"))) { send_to_char ("You can't drop money.\n\r", ch); sprintf (buf, "CHEATER ALERT: %s just tried to drop %d money.", ch->name, amount); bug (buf, 0); log_cheater (ch, buf); return; } send_to_char ("You can't drop money, but even if you were going to, you did it wrong.\n\r", ch); sprintf (buf, "CHEATER ALERT: %s just tried to drop money, but did it wrong.", ch->name); bug (buf, 0); log_cheater (ch, buf); return;