[HELP]TeamKills Counter
#1

Hello samp members i wanna to make this (image from AVT) and when some team lets say terrorist have 150 kills all kills reset and winner team gets 25 score , same for army . can i get code bec i cant find on ******
Reply
#2

first make a global variable
pawn Код:
new ArmyP;
new TerrP;

//under OnPlayerDeath
if(gTeam[playerid][TEAM_ARMY] == 1)
Terrp = +1;

if(gTeam[playerid][TEAM_TERRORIST] == 1)
Armyp = +1;

//then below the OnPlayerUpdate
if(Armyp == 150)
{
   for(new i=0; i<MAX_PLAYERS; i++)
    {
      if(IsPlayerConnected(i))
           {
              if(gTeam[i][TEAM_ARMY)
                {
                    SetPlayerScore(i, GetPlayerScore(i)+25)
                }
          }
    }
}
 
if(Terrp == 150)
{
   for(new i=0; i<MAX_PLAYERS; i++)
    {
      if(IsPlayerConnected(i))
           {
              if(gTeam[i][TEAM_TERRORIST)
                {
                    SetPlayerScore(i, GetPlayerScore(i)+25)
                }
          }
    }
}
Reply
#3

Quote:
Originally Posted by Vanter
Посмотреть сообщение
first make a global variable
pawn Код:
new ArmyP;
new TerrP;

//under OnPlayerDeath
if(gTeam[playerid][TEAM_ARMY] == 1)
Terrp = +1;

if(gTeam[playerid][TEAM_TERRORIST] == 1)
Armyp = +1;

//then below the OnPlayerUpdate
if(Armyp == 150)
{
   for(new i=0; i<MAX_PLAYERS; i++)
    {
      if(IsPlayerConnected(i))
           {
              if(gTeam[i][TEAM_ARMY)
                {
                    SetPlayerScore(i, GetPlayerScore(i)+25)
                }
          }
    }
}
 
if(Terrp == 150)
{
   for(new i=0; i<MAX_PLAYERS; i++)
    {
      if(IsPlayerConnected(i))
           {
              if(gTeam[i][TEAM_TERRORIST)
                {
                    SetPlayerScore(i, GetPlayerScore(i)+25)
                }
          }
    }
}
No offense, but it's bad coded. Killing your own teammates would count as valid kill (abusive) plus using OnPlayerUpdate for something such as this is horrible.

pawn Код:
Terrp = +1;
Not valid either. Use it as:
pawn Код:
++Terrp;
// OR
Terrp++;
// OR
Terrp += 1;
// OR
Terrp = Terrp + 1;
Reply
#4

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
No offense, but it's bad coded. Killing your own teammates would count as valid kill (abusive) plus using OnPlayerUpdate for something such as this is horrible.

pawn Код:
Terrp = +1;
Not valid either. Use it as:
pawn Код:
++Terrp;
// OR
Terrp++;
// OR
Terrp += 1;
// OR
Terrp = Terrp + 1;
positive! sorry I mixed the = with the +
and for the OnPlayerDeath Part

just add a &&
pawn Код:
if(gTeam[playerid][TEAM_TERRORIST] == 1 && gTeam[killerid][TEAM_ARMY])
{
 ..............................

//and so on
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)