SA-MP Forums Archive
Team with most kill wins! How to make? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Team with most kill wins! How to make? (/showthread.php?tid=111876)



Team with most kill wins! How to make? - Tigerbeast11 - 04.12.2009

Hi!

I have 3 teams, and i have a function which ends the gamemode after 8 mins, how can i make a check to check which team has the most kills?

Would i need

pawn Код:
new team1kills[MAX_PLAYERS];
new team2kills[MAX_PLAYERS];
new team3kills[MAX_PLAYERS];



Re: Team with most kill wins! How to make? - DeathOnaStick - 04.12.2009

Quote:
Originally Posted by Tigerbeast11
pawn Код:
new team1kills[MAX_PLAYERS];
new team2kills[MAX_PLAYERS];
new team3kills[MAX_PLAYERS];
What do you want to do with those arrays? Why don't you use a usual number-variable? This confuses me a bit, because you use MAX_PLAYERS !?


Re: Team with most kill wins! How to make? - RyDeR` - 04.12.2009

Код:
new KillCount[MAX_PLAYERS];
OnPlayerDeath:

Код:
KillCount[playerid]++;
KillCount[killerid]--;
Like this?

And at the end you must use a loop trough all players to see who the most counts have.


Re: Team with most kill wins! How to make? - Tigerbeast11 - 04.12.2009

Quote:
Originally Posted by [WsR
RyDeR ]
Код:
new KillCount[MAX_PLAYERS];
OnPlayerDeath:

Код:
KillCount[playerid]++;
KillCount[killerid]--;
Like this?

And at the end you must use a loop trough all players to see who the most counts have.
No, i have 3 teams! I wanna see which team gets the most kills at the end!


Re: Team with most kill wins! How to make? - DeathOnaStick - 04.12.2009

Quote:
Originally Posted by [WsR
RyDeR ]
Код:
new KillCount[MAX_PLAYERS];
OnPlayerDeath:

Код:
KillCount[playerid]++;
KillCount[killerid]--;
Like this?

And at the end you must use a loop trough all players to see who the most counts have.
For me it seems more effecient to make a variable just for the team kills.

Like this:

pawn Код:
new Team1Killz, Team2Killz, Team3Killz;
then OnPlayerDeath:

pawn Код:
if(GetPlayerTeam(killerid)==TEAM_BLABLUBB1)Team1Killz++;
if(GetPlayerTeam(killerid)==TEAM_BLABLUBB2)Team2Killz++;
if(GetPlayerTeam(killerid)==TEAM_BLABLUBB3)Team3Killz++;
#EDIT#: You can decimate the teamkill of the dying player, too, if you want to.


Cheers.


Re: Team with most kill wins! How to make? - Tigerbeast11 - 04.12.2009

Quote:
Originally Posted by ∈ⅹitus
Quote:
Originally Posted by [WsR
RyDeR ]
Код:
new KillCount[MAX_PLAYERS];
OnPlayerDeath:

Код:
KillCount[playerid]++;
KillCount[killerid]--;
Like this?

And at the end you must use a loop trough all players to see who the most counts have.
For me it seems more effecient to make a variable just for the team kills.

Like this:

pawn Код:
new Team1Killz, Team2Killz, Team3Killz;
then OnPlayerDeath:

pawn Код:
if(GetPlayerTeam(killerid)==TEAM_BLABLUBB1)Team1Killz++;
if(GetPlayerTeam(killerid)==TEAM_BLABLUBB2)Team2Killz++;
if(GetPlayerTeam(killerid)==TEAM_BLABLUBB3)Team3Killz++;
#EDIT#: You can decimate the teamkill of the dying player, too, if you want to.


Cheers.
How can i check which team has the highest?


Re: Team with most kill wins! How to make? - RyDeR` - 04.12.2009

Yeah that's right, my bad ^^

Quote:
Originally Posted by Tigerbeast11
How can i check which team has the highest?
Use a loop..


Re: Team with most kill wins! How to make? - DeathOnaStick - 04.12.2009

Quote:
Originally Posted by Tigerbeast11
Quote:
Originally Posted by ∈ⅹitus
Quote:
Originally Posted by [WsR
RyDeR ]
Код:
new KillCount[MAX_PLAYERS];
OnPlayerDeath:

Код:
KillCount[playerid]++;
KillCount[killerid]--;
Like this?

And at the end you must use a loop trough all players to see who the most counts have.
For me it seems more effecient to make a variable just for the team kills.

Like this:

pawn Код:
new Team1Killz, Team2Killz, Team3Killz;
then OnPlayerDeath:

pawn Код:
if(GetPlayerTeam(killerid)==TEAM_BLABLUBB1)Team1Killz++;
if(GetPlayerTeam(killerid)==TEAM_BLABLUBB2)Team2Killz++;
if(GetPlayerTeam(killerid)==TEAM_BLABLUBB3)Team3Killz++;
#EDIT#: You can decimate the teamkill of the dying player, too, if you want to.


Cheers.
How can i check which team has the highest?
pawn Код:
if(Team1Killz>Team2Killz && Team1Killz>Team3Killz)
{
//do smth.
}
if(Team2Killz>Team1Killz && Team2Killz>Team3Killz)
{
//do smth.
}
if(Team3Killz>Team1Killz && Team3Killz>Team2Killz)
{
//do smth.
}
That's how it works.


Re: Team with most kill wins! How to make? - Tigerbeast11 - 04.12.2009

thnx

Edit: What would you recommend for this?
http://forum.sa-mp.com/index.php?topic=136991.0