01.02.2010, 02:38
Basically you need to keep a variable for a teams score:
new TeamScore[2];
I assume you have a team system, so just as an example
new Team[MAX_PLAYERS];
When a player is killed you get the callback
new TeamScore[2];
I assume you have a team system, so just as an example
new Team[MAX_PLAYERS];
When a player is killed you get the callback
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
//So here we check that it wasn't a team kill
if(Team[playerid]==Team[killerid])
{
//They are the same team, punish the killer how you will, example:
SetPlayerHealth(killerid, 0);
SendClientMessage(killerid, 0xAA0000AA, "No Team Killing");
}else
{
//killerid has killed playerid, increase his teams score
TeamScorePlus(Team[killerid]); //calls the function below
}
}
//This is called when someone scores a kill
stock TeamScorePlus(team)
{
//Increase the teams score
TeamScore[team]++;
//Here you reset your textdraw string to have the new scores
TextDrawSetString(yourtextid, "Team1 : [%d] || Team2: [%d]", TeamScore[0], TeamScore[1]);
//Now show all the players this updated textdraw
TextDrawShowForAll(yourtextid);
//Here we check to see if a score has reached 10 and send your command
if(TeamScore[team] >= 10) SendRconCommand("gmx");
}