Hier mal meine version der killstreak plugins
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.5";
#define Level1 4 //Multikill
#define Level2 6 //Ultrakill
#define Level3 8 //Killingspree
#define Level4 10 //Monsterkill
#define Level5 15 //Monsterkill
#define Level6 20 //Godlike
#define Level7 30 //Godlike
#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)
{
playFile( "misc/multikill.wav" );
snprintf(Message, MAX_TEXT_LENGTH, "%s: Multi Kill !!! (%i Kills)", Name,FragCount[iIDA]);
typesay(Message,3, 255, 255, 255);
}
else if( FragCount[ iIDA ] == Level2 )
{
playFile( "misc/ultrakill.wav" );
snprintf( Message, MAX_TEXT_LENGTH, "%s: Ultra Kill !!! (%i Kills)", Name,FragCount[iIDA]);
typesay(Message,3,150,200,0);
}
else if( FragCount[iIDA ] == Level3 )
{
playFile( "misc/killingspree.wav" );
snprintf( Message, MAX_TEXT_LENGTH, "%s is on a Killing Spree !!! (%i Kills)", Name,FragCount[iIDA]);
typesay(Message,4,200,100,0);
}
else if( FragCount[iIDA ] == Level4 || FragCount[iIDA ] == Level5 )
{
playFile( "misc/monsterkill.wav" );
snprintf( Message, MAX_TEXT_LENGTH, "%s made a MONSTERKILLLLL !!! (%i Kills)", Name,FragCount[iIDA]);
typesay(Message,4,0,100,200);
}
else if( FragCount[iIDA ] == Level6 || FragCount[iIDA ] == Level7 )
{
playFile( "misc/godlike.wav" );
snprintf( Message, MAX_TEXT_LENGTH, "%s is playing G - O - D - L - I - K - E ! ! ! (%i Kills)", Name,FragCount[iIDA]);
typesay(Message,4,225,0,0);
}
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( "Game_Commencing", 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;
}