How do i get the score of everybody in one team?
#1

I am trying to make it so after the rounds over the team with the most points wins. How do i get the score of all the players in one team and then sum them up, and them compare them to the other teams scores? thanks guys! hope you can help!
Reply
#2

im a little rusty but i think its like this:

Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(isplayerconnected(i))
{
if(team[i] == team)
{
sendclientmessage(i,color,"You're teams' score is %d",getplayerscore(i));
}
}
}
Reply
#3

Quote:
Originally Posted by [TPG
Coole210 ]
im a little rusty but i think its like this:

Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(isplayerconnected(i))
{
if(team[i] == team)
{
sendclientmessage(i,color,"You're teams' score is %s",getplayerscore(i));
}
}
}
this has nothing to do with his question that looks like a a send team message function or something, also you would have to make something like

pawn Код:
new
team1,
team2;

public OnPlayerConnect(playerid)
{
SetPVarInt(playerid, "Team", 1); // this is were you can set there team
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
if(Killerid != 255 && GetPVarInt(killerid,"Team") == 1) team1 ++, team2 --;
if(Killerid != 255 && GetPVarInt(killerid,"Team") == 2) team2 ++, team1 --;
return 1;
}

// then make a function to check the highest team

forward CheckTeams()
public CheckTeams()
{
if(team1 > team2) SendClientMessageToAll(color, "Team 1 Wins!");
if(team2 > team1) SendClientMessageToAll(color, "Team 2 Wins!!");
return 1;
}

// it can be as simple as this took me about 1 minutes to write this.
Reply
#4

GREAT! Thanks for the help guys. =)
Reply
#5

Quote:
Originally Posted by Typical_Cat
GREAT! Thanks for the help guys. =)
No problem.
Reply
#6

im just trying to help him with

Код:
How do i get the score of all the players in one team and then sum them up
so get off my back woman :P
Reply
#7

Quote:
Originally Posted by [TPG
Coole210 ]
im just trying to help him with

Код:
How do i get the score of all the players in one team and then sum them up
so get off my back woman :P
lol sounds like what I say to my girl, but what you posted was wrong.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)