hi alle zusammen!
hier ist jetzt der vorläufige Code. Ich denke allerdings das ihr bestimmt noch ein paar verbesserungs vorschläge habt
Code:
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
#define ACCESS_CONSOLE 131072
/* Moegliche Werte fuer Status */
#define CLEAN_SLATE 0
#define TAKEN_LEAD 1
#define TIED_LEAD 2
#define LOST_LEAD 3
/* Moegliche Werte fuer CheckOutputLead */
#define CONNECT 1
#define DISCONNECT 2
#define KILL 3
#define TK_SUICIDE 4
new FragCount[MAX_PLAYERS] = {CLEAN_SLATE,...};  /* speichert fuer jeden Spieler seine Frags */
new Status[MAX_PLAYERS] = {CLEAN_SLATE,...};     /* speichert fuer jeden Spieler seinen derzeitigen Status */   
new Sound[MAX_PLAYERS] = {CLEAN_SLATE,...};      /* speichert fuer jeden Spieler, ob er Sound hoeren moechte oder nicht */
new MostFrags = -1;                              /* speichert die hoechste Fragzahl ab  
new STRING_VERSION[MAX_DATA_LENGTH] = "v1.0";
public OutputLead(Index) {
	new WONID;
	new Name[MAX_NAME_LENGTH];
	new Msg[MAX_TEXT_LENGTH];
	playerinfo(Index, Name, MAX_NAME_LENGTH,_,WONID,_,_);
	if (WONID != 0) {
		if (Sound[Index] == 0) {
			switch(Status[Index]) {
				case TAKEN_LEAD: { 
					playsound(Name, "misc/takenlead.wav");
					snprintf(Msg,MAX_TEXT_LENGTH,"Du hast mit %d Frags die alleinige Fuehrung uebernommen", FragCount[Index]);
					messageex(Name,Msg,print_chat);
				}
				case TIED_LEAD: {
					playsound(Name, "misc/tiedlead.wav");
					snprintf(Msg,MAX_TEXT_LENGTH,"Du musst Dir leider mit %d Frags die Fuehrung mit anderen Spielern teilen", FragCount[Index]);
					messageex(Name,Msg,print_chat);
				}
				case LOST_LEAD: {
					playsound(Name, "misc/lostlead.wav");
					snprintf(Msg,MAX_TEXT_LENGTH,"Du hast die Fuehrung mit %d Frags verloren", FragCount[Index]);
					messageex(Name,Msg,print_chat);
				}
			}
		}
	}
	return PLUGIN_CONTINUE;
	
}
public CheckOutputLead(Index, Auswertung) {
	new maxplayers = maxplayercount();
	new Count;
	switch(Auswertung) {
		case CONNECT: {
			if (FragCount[Index] > MostFrags) {
				MostFrags = FragCount[Index];
				for(new i = 1; i <= maxplayers; i++) {
					if (Status[i] == TIED_LEAD || Status[i] == TAKEN_LEAD) {
						Status[i] = LOST_LEAD;
						OutputLead(i);
					}
				}
				Status[Index] = TAKEN_LEAD;
				OutputLead(Index); 
			}
			else if (FragCount[Index] == MostFrags) {
				Status[Index] = TIED_LEAD;
				OutputLead(Index);
				Count = AnzahlMostFrags();
				if (Count == 2) {
					for (new i = 1; i <= maxplayers; i++) {
						if (Status[i] == TAKEN_LEAD) {
							Status[i] = TIED_LEAD;
							OutputLead(i);
						}
					}
				}
			}
			else if (FragCount[Index] < MostFrags) {
				Status[Index] = LOST_LEAD;
			}
		}
		case DISCONNECT: {
			if (Status[Index] == TAKEN_LEAD) {
				Status[Index] = CLEAN_SLATE;
				MostFrags = ErmittelMostFrags();
				Count = AnzahlMostFrags();
				if (Count >= 2) {
					for (new i = 1; i <= maxplayers; i++) {
						if (FragCount[i] == MostFrags) {
							Status[i] = TIED_LEAD;
							OutputLead(i);
						}
					}	
				}	
				else {
					for (new i = 1; i <= maxplayers; i++) {
						if (FragCount[i] == MostFrags) {
							Status[i] = TAKEN_LEAD;
							OutputLead(i);
						}
					}	
				} 
			}
			else if (Status[Index] == TIED_LEAD) {
				Status[Index] = CLEAN_SLATE;
				Count = AnzahlMostFrags();
				if (Count == 1) {
					for (new i = 1; i <= maxplayers; i++) {
						if (Status[i] == TIED_LEAD) {
							Status[i] = TAKEN_LEAD;
							OutputLead(i);
						}
					}
				}	
			}
			else if (Status[Index] == LOST_LEAD) {
				Status[Index] = CLEAN_SLATE;
			}
		}
		case KILL: {
			if (FragCount[Index] > MostFrags) {
				MostFrags = FragCount[Index];
				if (Status[Index] == TIED_LEAD) {
					Status[Index] = TAKEN_LEAD;
					OutputLead(Index);
					for(new i = 1; i <= maxplayers; i++) {
						if (Status[i] == TIED_LEAD) {
							Status[i] = LOST_LEAD;
							OutputLead(i);
						}
					}
				}
			}
			else if (FragCount[Index] == MostFrags) {
				Status[Index] = TIED_LEAD;
				OutputLead(Index);
				Count = AnzahlMostFrags();
				if (Count == 2) {
					for (new i = 1; i <= maxplayers; i++) {
						if (Status[i] == TAKEN_LEAD) {
							Status[i] = TIED_LEAD;
							OutputLead(i);
						}
					}
				}
			}
		}
		case TK_SUICIDE: {
			if (Status[Index] == TAKEN_LEAD) {
				MostFrags -=1;
				Count = AnzahlMostFrags();
				if (Count >= 2) {
					for (new i = 1; i <= maxplayers; i++) {
						if (FragCount[i] == MostFrags) {
							Status[i] = TIED_LEAD;
							OutputLead(i);
						}
					}
				}
			}
			else if (Status[Index] == TIED_LEAD) {
				Status[Index] = LOST_LEAD;
				OutputLead(Index);
				Count = AnzahlMostFrags();
				if (Count == 1) {
					for (new i = 1; i <= maxplayers; i++) {
						if (Status[i] == TIED_LEAD) {
							Status[i] = TAKEN_LEAD;
							OutputLead(i);
						}
					}
				}
			}
		}
	}
	return PLUGIN_CONTINUE;
}
public ErmittelMostFrags() {
	new MaxFrags;
	new Durchlauf;
	new maxplayers = maxplayercount();
	for(new i = 1; i <= maxplayers; i++) {
		if (Status[i] != 0) {
			Durchlauf++;
			if (Durchlauf == 1) {
				MaxFrags = FragCount[i];
			}
			else {
				if (FragCount[i] > MaxFrags) {	
					MaxFrags = FragCount[i];
				}
			}
		}
	}
	return MaxFrags;
}
public AnzahlMostFrags() {
	new maxplayers = maxplayercount();
	new Anzahl = 0;
	for(new i = 1; i <= maxplayers; i++) {
		if (Status[i] != 0) {
			if (MostFrags == FragCount[i]) {
				Anzahl++;
			}
		}
	}
	return Anzahl;
}
public resetscore (Timer, Repeat, HLUserName, HLData) {
	for( new i = 1; i < MAX_PLAYERS; i++ ) {
		FragCount[i] = CLEAN_SLATE;
		Status[i] = TIED_LEAD;
	}
	MostFrags = 0;
	return PLUGIN_CONTINUE;
}
public lead_suicide (HLCommand,HLData,HLUserName,UserIndex) {
	new sID[MAX_NUMBER_LENGTH];
	new Weapon[MAX_NAME_LENGTH];
	new User[MAX_NAME_LENGTH];
	new Data[MAX_DATA_LENGTH];
	new Index;
	new WONID;
	convert_string( HLData, Data, MAX_DATA_LENGTH );
	strsplit(Data, " ", sID, MAX_NUMBER_LENGTH, Weapon, MAX_NAME_LENGTH);
	get_username(sID,User,MAX_NAME_LENGTH);
	Index = strtonum( sID );
	if(strcmp(Weapon, "grenade") == 0) {
		 FragCount[Index] -=1;
		 CheckOutputLead(Index, TK_SUICIDE);
		 
	}
	if(strcmp(Weapon, "world") == 0) {
		get_userWONID(User, WONID);
		if (WONID != 0) {
			FragCount[Index] -=1;
			CheckOutputLead(Index, TK_SUICIDE);
			
		}
	}
	return PLUGIN_HANDLED;
}
public HandleSay(HLCommand,HLData,HLUserName,UserIndex) {
 
	new Data[MAX_DATA_LENGTH];
	new Msg [MAX_TEXT_LENGTH];
	new User[MAX_DATA_LENGTH];
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_DATA_LENGTH);
	strstripquotes(Data);
        if(strcasecmp(Data, ".lead") ==0 ) {
        	if (Sound[UserIndex] == 0) {
        		Sound[UserIndex] = 1;
			snprintf(Msg,MAX_TEXT_LENGTH,"You won`t hear the sounds any longer. Use '.lead' if you want to enable them.");
			messageex(User,Msg,print_chat);
		}	
        	else { 
        		Sound[UserIndex]= 0;
			snprintf(Msg,MAX_TEXT_LENGTH,"You have enabled playing the sounds. Use '.lead' if you want to turn them off.");
			messageex(User,Msg,print_chat);
        	}
	}
        return PLUGIN_CONTINUE;
}
public lead_newround (HLCommand,HLData,HLUserName,UserIndex) {
	new Data[MAX_NAME_LENGTH];
	convert_string(HLData,Data,MAX_NAME_LENGTH);
	if(strcmp(Data, "Game_Commencing") == 0) 
		set_timer ("resetscore", 0, 0, Data);
	else if (strcmp(Data, "Restart_Round_(10_seconds)") == 0)
		set_timer ("resetscore", 10, 0, Data);
	else if (strcmp(Data, "Restart_Round_(9_seconds)") == 0)
		set_timer ("resetscore", 9, 0, Data);
	else if (strcmp(Data, "Restart_Round_(8_seconds)") == 0)
		set_timer ("resetscore", 8, 0, Data);
	else if (strcmp(Data, "Restart_Round_(7_seconds)") == 0)
		set_timer ("resetscore", 7, 0, Data);
	else if (strcmp(Data, "Restart_Round_(6_seconds)") == 0)
		set_timer ("resetscore", 6, 0, Data);
	else if (strcmp(Data, "Restart_Round_(5_seconds)") == 0)
		set_timer ("resetscore", 5, 0, Data);
	else if (strcmp(Data, "Restart_Round_(4_seconds)") == 0)
		set_timer ("resetscore", 4, 0, Data);
	else if (strcmp(Data, "Restart_Round_(3_seconds)") == 0)
		set_timer ("resetscore", 3, 0, Data);
	else if (strcmp(Data, "Restart_Round_(2_seconds)") == 0)
		set_timer ("resetscore", 2, 0, Data);
	else if (strcmp(Data, "Restart_Round_(1_seconds)") == 0)
		set_timer ("resetscore", 1, 0, Data);
				
	return PLUGIN_HANDLED;
}
public lead_kill (HLCommand,HLData,HLUserName,UserIndex) {
	new iIDA;
	new iIDV;
	new iTeamA;
	new iTeamV;
	new sID1[3];
	new sID2[3];
	new Attacker[MAX_NAME_LENGTH];
	new Victim[MAX_NAME_LENGTH]; 
	new Data[MAX_DATA_LENGTH];
	convert_string( HLData, Data, MAX_DATA_LENGTH );
	strsplit( Data, " ", sID1, 3, sID2, 3 );
	iIDA = strtonum( sID1 );
	iIDV = strtonum( sID2 );
	if(playerinfo(iIDA, Attacker, MAX_NAME_LENGTH,_,_,iTeamA)) {
		if(playerinfo(iIDV, Victim, MAX_NAME_LENGTH,_,_,iTeamV)) {
	        	if(iTeamV != iTeamA) {
				FragCount[iIDA] +=1;
				CheckOutputLead(iIDA, KILL);
				
			}
	                else {
	                     	FragCount[iIDA] -=1;
	                     	CheckOutputLead(iIDA, TK_SUICIDE);
	                     	
	                }
	        }
	}	
	return PLUGIN_CONTINUE;
	
}
public lead_entergame (HLCommand,HLData,HLUserName,UserIndex) {
	
	new Index;
	new WONID;
	new Data[MAX_DATA_LENGTH];
	new Name[MAX_NAME_LENGTH];
	convert_string(HLData, Data, MAX_DATA_LENGTH);
	Index = strtonum(Data);
	if (Index >= 1 && Index <= MAX_PLAYERS) {
		playerinfo(Index, Name, MAX_NAME_LENGTH,_,WONID,_,_);
		if (WONID != 0) {
			FragCount[UserIndex] = CLEAN_SLATE;
		}
		CheckOutputLead(Index, CONNECT);
		
	}
	return PLUGIN_CONTINUE;
}
public plugin_disconnect(HLUserName, UserIndex) {
	new Name[MAX_NAME_LENGTH];
	new WONID;
	if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS) {
		playerinfo(UserIndex, Name, MAX_NAME_LENGTH,_,WONID,_,_);
		CheckOutputLead(UserIndex, DISCONNECT);
		
		if (WONID != 0) {
			FragCount[UserIndex] = CLEAN_SLATE;
		}
	}
	return PLUGIN_CONTINUE;
	
}
public plugin_init() {
	plugin_registerinfo("Taken the lead",".",STRING_VERSION);
	plugin_registercmd("lead_kill","lead_kill", ACCESS_CONSOLE, "");
	plugin_registercmd("lead_suicide","lead_suicide", ACCESS_CONSOLE, "");
	plugin_registercmd("lead_newround","lead_newround", ACCESS_CONSOLE, "");
	plugin_registercmd("lead_entergame","lead_entergame", ACCESS_CONSOLE, "");	
	plugin_registercmd("say","HandleSay",ACCESS_ALL);
		
	exec( "logd_reg 53 admin_command lead_suicide");
	exec( "logd_reg 62 admin_command lead_newround");
	exec( "logd_reg	57 admin_command lead_kill");
	exec( "logd_reg 51 admin_command lead_entergame");
	return PLUGIN_CONTINUE;
	
}