Team with most kill wins! How to make?
#1

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];
Reply
#2

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 !?
Reply
#3

Код:
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.
Reply
#4

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!
Reply
#5

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.
Reply
#6

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?
Reply
#7

Yeah that's right, my bad ^^

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

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.
Reply
#9

thnx

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


Forum Jump:


Users browsing this thread: 3 Guest(s)