All pastes #339305 Raw Edit

Untitled

public text v1 · immutable
·published 2007-02-04 00:13 UTC
rendered paste body
public OnPlayerDeath(playerid, killerid, reason)
{
	new string[256], string2[256], string3[256], gtstring[256];
	DeathCount[playerid]++;

	if(killerid == INVALID_PLAYER_ID) {
	SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
	SetPlayerScore(playerid, GetPlayerScore(playerid)-1);
	}
	
	if(IsPlayerConnected(killerid))
	{
	if(gTeam[killerid] == TEAM_1)
	{
		sCount1++;
		format(string2, sizeof(string2), "%s Score: %d", TEAM1, sCount1);
		SendClientMessageToAll(COLOR_YELLOW, string2);
		for(new z=0;z<MAX_PLAYERS;z++)
		{
		if(gTeam[z] == 0)
		{
		format(gtstring, sizeof(gtstring), "~b~%s Score: ~r~%d", TEAM1, sCount1);
		GameTextForPlayer(z,gtstring,3500,3);
	}
	}
	}
	if(gTeam[killerid] == TEAM_2)
	{
	    sCount2++;
		format(string3, sizeof(string3), "%s Score: %d", TEAM2, sCount2);
		SendClientMessageToAll(COLOR_YELLOW, string3);
		for(new y=0;y<MAX_PLAYERS;y++)
		{
		if(gTeam[y] == 1)
		{
		format(gtstring, sizeof(gtstring), "~b~%s Score: ~r~%d", TEAM2, sCount2);
		GameTextForPlayer(y,gtstring,3500,3);
	}
	}
	}
	}
	if(sCount1 == MAXKILLS)
	{
	    format(string, sizeof(string), "%s has WON the CLAN WAR!", TEAM1);
	    strins(winner,TEAM1,0,sizeof(winner));
	    iStats();
		sStats();
  		iFreeze();
		TogglePlayerControllable(playerid,0);
	    SendClientMessageToAll(COLOR_YELLOW, string);
	}
	else if(sCount2 == MAXKILLS)
	{
	    format(string, sizeof(string), "%s has WON the CLAN WAR!", TEAM2);
	    strins(winner,TEAM2,0,sizeof(winner));
	    iStats();
		sStats();
		iFreeze();
		TogglePlayerControllable(playerid,0);
	    SendClientMessageToAll(COLOR_YELLOW, string);
	}

if(gTeam[killerid] != gTeam[playerid])
{
	SendDeathMessage(killerid,playerid,reason);
	SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
}
else {
	new warning[256];
  format(warning, sizeof(warning), "Be careful! Do Not Team-Kill");
  SendClientMessage(killerid, 0xFFFF00AA, warning);
  SendDeathMessage(killerid,playerid,reason);
  SetPlayerHealth(killerid, 20);
  SetPlayerScore(killerid, GetPlayerScore(killerid) - 1);
  tkscore[playerid]++;
  }
 return 1;
}