ich weis allerdings nich obs funzt ich benutz statsme dafür:
Code:
/*********************************************************************
* **********
** Sir Drink a lots Playeraward v 2.0 *********
*** ********
**** INFO: Shows the Best Player and the Teamscore *******
***** in the end of a round.It displays also other best ******
****** players with the same score in the chat-area. *****
******* If you are dead, you can say score and it will display ****
******** the best player at the moment. ***
********* Thanks to Warhead,Ramirez, DaRope and the **
********** www.adminmod.de forumusers for help and the idea *
*********************************************************************/
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
new STRING_VERSION[MAX_DATA_LENGTH] = "2.0";
#define ACCESS_CONSOLE 131072
#define ACCESS_ALL 0
#define CLEAN_SLATE 0
new KillCount[ 100 ] = {CLEAN_SLATE,...};
new SpielerID;
new ctscore [MAX_DATA_LENGTH];
new terrscore[MAX_DATA_LENGTH];
public pa_playeraward( HLCommand,HLData,HLUserName,UserIndex )
{
new iIDA;
new iIDV;
new sID1[3];
new sID2[3];
new iUserID;
new iWONID;
new iTeamA;
new iTeamV
new Data[MAX_DATA_LENGTH];
new Victim[MAX_NAME_LENGTH];
new Killer[MAX_NAME_LENGTH];
new loop;
convert_string( HLData, Data, MAX_DATA_LENGTH );
strsplit( Data, " ", sID1, 3, sID2, 3 );
iIDA = strtonum( sID1 );
iIDV = strtonum (sID2 );
if(playerinfo(iIDA, Killer, MAX_NAME_LENGTH, iUserID, iWONID, iTeamA))
{
if(playerinfo(iIDV, Victim, MAX_NAME_LENGTH, iUserID, iWONID, iTeamV))
{
if(iTeamV != iTeamA)
KillCount[ iIDA ] += 1;
else
{
KillCount[iIDA] -=1;
}
}
}
for (loop = 1; loop < maxplayercount();loop++)
{
if (KillCount[SpielerID]< KillCount[loop])
SpielerID = strtonum (sID1);
}
return PLUGIN_CONTINUE;
}
public pa_resetthescore(HLCommand,HLData,HLUserName,UserIndex)
{
new loopx;
new Data[MAX_NAME_LENGTH];
convert_string(HLData,Data,MAX_NAME_LENGTH);
if( strcmp( "Round_Start", Data ) != 0 )
return PLUGIN_HANDLED;
for( loopx = 0; loopx < MAX_PLAYERS; loopx += 1 )
{
KillCount[loopx] = CLEAN_SLATE;
}
return PLUGIN_CONTINUE;
}
public pa_showintheend(HLCommand,HLData,HLUserName,UserIndex)
{
new Params[MAX_DATA_LENGTH];
new Msg[MAX_TEXT_LENGTH];
new Name[MAX_NAME_LENGTH];
new Name1[MAX_NAME_LENGTH];
new Name2[MAX_NAME_LENGTH];
new Name3[MAX_NAME_LENGTH];
new Name4[MAX_NAME_LENGTH];
new Name5[MAX_NAME_LENGTH];
new ct[MAX_DATA_LENGTH];
new terr[MAX_DATA_LENGTH];
new event[MAX_DATA_LENGTH];
new b[MAX_NAME_LENGTH];
new c[MAX_NAME_LENGTH];
new d[MAX_NAME_LENGTH];
new e[MAX_NAME_LENGTH];
new f[MAX_NAME_LENGTH];
new loop;
new a;
convert_string(HLData,Params,MAX_DATA_LENGTH);
new Data1[MAX_DATA_LENGTH];
new Data2[MAX_DATA_LENGTH];
strbreak(Params,Data1,Data2,MAX_DATA_LENGTH);
strsplit(Data2, "# " ,event,MAX_DATA_LENGTH,ct,MAX_DATA_LENGTH,ctscore,MAX_DATA_LENGTH,terr,MAX_DATA_LENGTH,terrscore,MAX_DATA_LENGTH);
if(strmatch(Data1, "CT", strlen("CT")) || strmatch(Data1, "TERRORIST", strlen("TERRORIST")))
{
if(!playerinfo(SpielerID, Name, MAX_DATA_LENGTH))
{
return PLUGIN_FAILURE;
}
for( loop = 1; loop < maxplayercount(); loop++ )
{
if (KillCount[SpielerID]== KillCount[loop])
{
a++;
switch (a)
{
case 1:
{
playerinfo(loop, Name1, MAX_NAME_LENGTH);
}
case 2:
{
if(!playerinfo(loop, Name2, MAX_NAME_LENGTH))
{
break;
}
else
{
snprintf(f,MAX_NAME_LENGTH,"with %i kill(s)",KillCount[SpielerID]);
snprintf(b,MAX_NAME_LENGTH,"Other Best Players: 2.: %s",Name2);
}
}
case 3:
{
if(!playerinfo(loop, Name3, MAX_NAME_LENGTH))
{
break;
}
else
{
snprintf(c,MAX_NAME_LENGTH,"3.: %s",Name3);
}
}
case 4:
{
if(!playerinfo(loop, Name4, MAX_NAME_LENGTH))
{
break;
}
else
{
snprintf(d,MAX_NAME_LENGTH,"4.: %s",Name4);
}
}
case 5:
{
if(!playerinfo(loop, Name5, MAX_NAME_LENGTH))
{
break;
}
else
{
snprintf(e,MAX_NAME_LENGTH,"5.: %s",Name5);
}
}
}
}
}
a = 0;
snprintf( Msg, MAX_TEXT_LENGTH, "Terrorists: %s -- Counters: %s ^nBest Player: %s -- Kills: %i",terrscore,ctscore,Name1,KillCount[SpielerID]);
typesay(Msg,12,10,255,255);
snprintf(Msg,MAX_TEXT_LENGTH,"%s %s %s %s %s",b,c,d,e,f);
say(Msg);
}
return PLUGIN_HANDLED;
}
public HandleSay(HLCommand,HLData,HLUserName,UserIndex)
{
new data[MAX_DATA_LENGTH];
new Name[MAX_NAME_LENGTH];
new Msg [MAX_TEXT_LENGTH];
new IsDead = 0,UserID,WONID,Team;
new User[MAX_DATA_LENGTH];
new iUser;
convert_string(HLData,data,MAX_DATA_LENGTH);
convert_string(HLUserName,User,MAX_DATA_LENGTH);
strstripquotes(data);
get_userindex( User, iUser );
if(streq(data, "score") ==1)
{
playerinfo(iUser,Name,MAX_DATA_LENGTH,UserID,WONID,Team,IsDead);
if(IsDead == 0)
{
return PLUGIN_CONTINUE;
}
else
{
playerinfo(SpielerID,Name,MAX_DATA_LENGTH);
snprintf( Msg, MAX_TEXT_LENGTH, "T: %s -- CT: %s^nBest Player at the moment: %s Kills: %i",terrscore,ctscore,Name,KillCount[SpielerID]);
typesay(Msg,12,10,255,255);
}
}
return PLUGIN_CONTINUE;
}
public plugin_connect(HLUserName,HLIP,UserIndex)
{
if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS)
{
KillCount[UserIndex] = CLEAN_SLATE;
}
return PLUGIN_CONTINUE;
}
public plugin_disconnect(HLUserName, UserIndex)
{
if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS)
{
KillCount[UserIndex] = CLEAN_SLATE;
}
return PLUGIN_CONTINUE;
}
public plugin_init()
{
plugin_registerinfo("Sir Drink a lots Player Award","Announces best player in the round and teamscore.",STRING_VERSION);
plugin_registercmd("pa_playeraward", "pa_playeraward", ACCESS_CONSOLE, "");
plugin_registercmd("pa_resetthescore", "pa_resetthescore", ACCESS_CONSOLE, "");
plugin_registercmd("pa_showintheend", "pa_showintheend", ACCESS_CONSOLE, "");
plugin_registercmd("say","HandleSay",ACCESS_ALL);
plugin_registerhelp("say",ACCESS_ALL,"say score: Will announce the teamscore and current best player.");
exec( "logd_reg 57 admin_command pa_playeraward" );
exec( "logd_reg 62 admin_command pa_resetthescore" );
exec( "logd_reg 61 admin_command pa_showintheend" );
return PLUGIN_CONTINUE;
}