score help
#4

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
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");
}

Reply


Messages In This Thread
score help - by hvampire - 01.02.2010, 01:25
Re: score help - by mansonh - 01.02.2010, 02:15
Re: score help - by hvampire - 01.02.2010, 02:29
Re: score help - by mansonh - 01.02.2010, 02:38
Re: score help - by hvampire - 01.02.2010, 02:54
Re: score help - by mansonh - 01.02.2010, 03:05
Re: score help - by hvampire - 01.02.2010, 03:51
Re: score help - by mansonh - 01.02.2010, 04:02

Forum Jump:


Users browsing this thread: 1 Guest(s)