Code:
/*
* 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 sprengte %s zum Mars!!!", NameA, NameV );
printMessage( Message );
}
case 1:
{
snprintf( Message, MAX_TEXT_LENGTH, "%s, hat die Granate aufgefangen von %s", NameV, NameA );
printMessage( Message );
}
case 2:
{
snprintf( Message, MAX_TEXT_LENGTH, "%s, sprengte sich in 1000 Stuecke.", NameV );
printMessage( Message );
}
case 3:
{
snprintf( Message, MAX_TEXT_LENGTH, "%s rennt los und wirft %s an Kopf, BOOOM", NameA, NameV );
printMessage( Message );
}
case 4:
{
snprintf( Message, MAX_TEXT_LENGTH, "%s wurde gebombt von %s", NameV, NameA );
printMessage( Message );
}
case 5:
{
snprintf( Message, MAX_TEXT_LENGTH, "gesprengt und zerlegt von %s", NameA);
printMessage( Message );
}
case 6:
{
snprintf( Message, MAX_TEXT_LENGTH, "%s dachte wohl es ist Ostern und nahm das Ei!", NameV );
printMessage( Message );
}
case 7:
{
snprintf( Message, MAX_TEXT_LENGTH, "%s, konnte die Granate nicht mehr wegtreten", NameV );
printMessage( Message );
}
case 8:
{
snprintf( Message, MAX_TEXT_LENGTH, "%s, hats weh getan?", NameV );
printMessage( Message );
}
default:
{
snprintf( Message, MAX_TEXT_LENGTH, "%s spielte mit %s Granatenweitwurf, AUTSCH!!!", 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;
}
Was muss ich ändern damit es auf Granaten reagiert und nicht Messer?