SA-MP Forums Archive
[HELP]TeamKills Counter - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP]TeamKills Counter (/showthread.php?tid=491892)



[HELP]TeamKills Counter - Sky96 - 01.02.2014

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 ******


Re: [HELP]TeamKills Counter - Vanter - 01.02.2014

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



Re: [HELP]TeamKills Counter - Konstantinos - 01.02.2014

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;



Re: [HELP]TeamKills Counter - Vanter - 01.02.2014

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