Da hast du, Pontifexus.
Code:
/*
* Bud-froggy Productions® -- July 26nd, 2001
* Killing Streak Announcer®
*
* Announces Kill streaks
* Place in logd_kill
* new features added by SDal
*/
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
new STRING_VERSION[MAX_DATA_LENGTH] = "1.0";
#define Level1 3
#define Level2 4
#define Level3 5
#define Level4 6
#define Level5 7
#define Level6 8
#define Level7 9
#define Level8 10
#define Level9 11
#define ACCESS_CONSOLE 131072
#define CLEAN_SLATE 0
new FragCount[ MAX_PLAYERS ] = {CLEAN_SLATE,...};
new on = 1;
playFile( sFileName[ ] )
{
new Name[ MAX_NAME_LENGTH ];
new iUserID;
new iWONID;
new maxplayers = maxplayercount();
for( new i = 1; i <= maxplayers; i++ )
{
if( playerinfo(i, Name, MAX_NAME_LENGTH, iUserID, iWONID ) ) {
//if its not a bot
if( iWONID != 0 ) {
playsound(Name, sFileName );
}
}
}
return 1;
}
public admin_killstreak( HLCommand,HLData,HLUserName,UserIndex )
{
new User[MAX_NAME_LENGTH];
new Data[MAX_DATA_LENGTH];
convert_string(HLUserName, User, MAX_NAME_LENGTH);
convert_string(HLData,Data,MAX_DATA_LENGTH);
if (streq(Data, "1")==1)
{
on = 1;
selfmessage("Killstreak aktiviert");
return PLUGIN_HANDLED;
}
if (streq(Data, "0")==1)
{
on = 0;
selfmessage("Killstreak deaktiviert");
return PLUGIN_HANDLED;
}
selfmessage("Muss Zahl zwischen 0 und 1 sein!");
return PLUGIN_HANDLED;
}
public logd_killstreak( HLCommand,HLData,HLUserName,UserIndex )
{
if (on == 1)
{
new iIDA;
new iIDV;
new sID1[3];
new sID2[3];
new Data[MAX_DATA_LENGTH];
new Message[ MAX_TEXT_LENGTH ];
new Name[MAX_NAME_LENGTH];
new Victim[MAX_NAME_LENGTH];
new iUserID;
new iWONID;
new iTeamA;
new iTeamV;
convert_string( HLData, Data, MAX_DATA_LENGTH );
strsplit( Data, " ", sID1, 3, sID2, 3);
iIDA = strtonum( sID1 );
iIDV = strtonum( sID2 );
if(playerinfo(iIDA, Name, MAX_NAME_LENGTH, iUserID, iWONID, iTeamA))
{
if(playerinfo(iIDV, Victim, MAX_NAME_LENGTH, iUserID, iWONID, iTeamV))
{
if(iTeamV != iTeamA)
FragCount[ iIDA ] += 1;
else
{
FragCount[iIDA] -=1;
}
}
}
FragCount[ iIDV ] = CLEAN_SLATE;
if (FragCount[ iIDA ] == Level1)
{
playsound(Name, "misc/3frags.wav" );
}
else if( FragCount[ iIDA ] == Level2 )
{
playsound(Name, "misc/2frags.wav" );
}
else if( FragCount[iIDA ] == Level3 )
{
playsound(Name, "misc/1frag.wav" );
}
else if( FragCount[iIDA ] == Level4 )
{
playFile( "misc/multikill.wav" );
snprintf(Message, MAX_TEXT_LENGTH, "%s: Multi Kill!!!", Name);
typesay(Message, 6, 255, 255, 255);
}
else if( FragCount[iIDA ] == Level5 )
{
playsound(Name, "misc/1frag.wav" );
}
else if( FragCount[iIDA ] == Level6 )
{
playFile( "misc/ultrakill.wav" );
snprintf( Message, MAX_TEXT_LENGTH, "%s: Ultra Kill!!!", Name);
typesay(Message, 6, 255, 10, 255 );
}
else if( FragCount[iIDA ] == Level7 )
{
playsound(Name, "misc/1frag.wav" );
}
else if( FragCount[iIDA ] == Level8 )
{
playFile( "misc/killingspree.wav" );
snprintf( Message, MAX_TEXT_LENGTH, "%s is on a Killing Spree!!!", Name);
typesay(Message, 6, 255, 15, 15 );
}
else if( FragCount[iIDA ] >= Level9 )
{
playFile( "misc/killingspree.wav" );
snprintf( Message, MAX_TEXT_LENGTH, "%s is on a Killing Spree!!! (%i Kills)", Name, FragCount[iIDA ] );
typesay(Message, 6, 255, 15, 15 );
}
return PLUGIN_HANDLED;
}
return PLUGIN_HANDLED;
}
/*public ks_resetscore(HLCommand,HLData,HLUserName,UserIndex,Param)
{
new loop;
new Data[MAX_NAME_LENGTH];
convert_string(HLData,Data,MAX_NAME_LENGTH);
if( strcmp( "Round_Start", Data ) != 0 )
return PLUGIN_HANDLED;
for( loop = 0; loop < MAX_PLAYERS; loop += 1 ) {
FragCount[loop] = CLEAN_SLATE;
}
return PLUGIN_HANDLED;
}*/
public plugin_connect(HLUserName,HLIP, UserIndex)
{
if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS) {
FragCount[UserIndex] = CLEAN_SLATE;
}
return PLUGIN_CONTINUE;
}
public plugin_disconnect(HLUserName,UserIndex)
{
if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS) {
FragCount[UserIndex] = CLEAN_SLATE;
}
return PLUGIN_CONTINUE;
}
public plugin_init()
{
plugin_registerinfo("Kill Streak Announcer","Announces kill streaks.",STRING_VERSION);
plugin_registercmd("logd_killstreak", "logd_killstreak", ACCESS_CONSOLE, "");
/*plugin_registercmd("ks_resetscore", "ks_resetscore", ACCESS_CONSOLE, "");*/
plugin_registercmd("admin_killstreak","admin_killstreak",ACCESS_BAN, "admin_killstreak (0/1): 0 = Aus,1= AN");
plugin_registerhelp("admin_killstreak",ACCESS_BAN,"admin_killstreak (0/1): 0 = Aus,1= AN");
exec( "logd_reg 57 admin_command logd_killstreak" );
/*exec( "logd_reg 62 admin_command ks_resetscore" );*/
return PLUGIN_CONTINUE;
}