/* * Bud-froggy Productions® -- July 26nd, 2001 * Knife Kill Announcer® * * Announces Knife fragging * * Place in logd_kill */ #include <core> #include <console> #include <string> #include <admin> #include <adminlib> #define ACCESS_CONSOLE 131072 new STRING_VERSION[MAX_DATA_LENGTH] = "v1"; public logd_knifekill(HLCommand,HLData,HLUserName,UserIndex) { new sID1[MAX_NUMBER_LENGTH]; new sID2[MAX_NUMBER_LENGTH]; new Weapon[MAX_NAME_LENGTH]; new Data[MAX_DATA_LENGTH]; convert_string(HLData, Data, MAX_DATA_LENGTH); strsplit(Data, " ", sID1, MAX_NUMBER_LENGTH, sID2, MAX_NUMBER_LENGTH, Weapon, MAX_NAME_LENGTH); if( strcmp( Weapon, "knife") == 0 ) { new Message[MAX_TEXT_LENGTH]; new NameA[MAX_NAME_LENGTH]; new NameV[MAX_NAME_LENGTH]; new iRand = random(9); new iID1 = strtonum(sID1); new iID2 = strtonum(sID2); if( !playerinfo(iID1,NameA,MAX_NAME_LENGTH) ) { return PLUGIN_FAILURE; } if( !playerinfo(iID2,NameV,MAX_NAME_LENGTH) ) { return PLUGIN_FAILURE; } switch( iRand ) { case 0: //we need braces inside the switch statements for some reason { //if soneone figures out why, tell me please!!! :) snprintf( Message, MAX_TEXT_LENGTH, "%s oWneD %s with a knife!!!", NameA, NameV ); printMessage( Message ); } case 1: { snprintf( Message, MAX_TEXT_LENGTH, "%s, you were just n00b-ized by %s", NameV, NameA ); printMessage( Message ); } case 2: { snprintf( Message, MAX_TEXT_LENGTH, "%s, you should consider changing pastimes.^nI'd recommend either gardening or under water basket weaving.", NameV ); printMessage( Message ); } case 3: { snprintf( Message, MAX_TEXT_LENGTH, "%s oWneD %s with a knife!!!", NameA, NameV ); printMessage( Message ); } case 4: { snprintf( Message, MAX_TEXT_LENGTH, "%s got sLiCeD and DiCeD by %s", NameV, NameA ); printMessage( Message ); } case 5: { snprintf( Message, MAX_TEXT_LENGTH, "Knife Kill by %s^nOoga Shaka!!!", NameA); printMessage( Message ); } case 6: { snprintf( Message, MAX_TEXT_LENGTH, "%s is now ground beef.", NameV ); printMessage( Message ); } case 7: { snprintf( Message, MAX_TEXT_LENGTH, "%s, the other white meat.", NameV ); printMessage( Message ); } case 8: { snprintf( Message, MAX_TEXT_LENGTH, "%s, have you no honor?", NameV ); printMessage( Message ); } default: { snprintf( Message, MAX_TEXT_LENGTH, "%s oWneD %s with a knife!!!", NameA, NameV ); printMessage( Message ); } } } return PLUGIN_HANDLED; } printMessage( Message[ ] ) { new iRandRed = random( 3 ); new iRandGreen = random( 3 ); new iRandBlue = random( 3 ); new iRandSayType = random( 2 ); switch( iRandRed ) { case 0: iRandRed = 10; case 1: iRandRed = 150; case 2: iRandRed = 255; } switch( iRandGreen ) { case 0: iRandGreen = 10; case 1: iRandGreen = 150; case 2: iRandGreen = 255; } switch( iRandBlue ) { case 0: iRandBlue = 10; case 1: iRandBlue = 150; case 2: iRandBlue = 255; } if( iRandSayType ) centersay( Message, 12, iRandRed, iRandGreen, iRandBlue ); else typesay( Message, 6, iRandRed, iRandGreen, iRandBlue ); return 1; } public plugin_init() { plugin_registerinfo("Knife Kill Announcer","Throws a random center/typesay when someone gets knifed.",STRING_VERSION); plugin_registercmd("logd_knifekill", "logd_knifekill", ACCESS_CONSOLE, ""); exec( "logd_reg 57 admin_command logd_knifekill" ); return PLUGIN_CONTINUE; }