SA-MP Forums Archive
How do i get the score of everybody in one team? - 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: How do i get the score of everybody in one team? (/showthread.php?tid=144177)



How do i get the score of everybody in one team? - Typical_Cat - 25.04.2010

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!


Re: How do i get the score of everybody in one team? - coole210 - 26.04.2010

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



Re: How do i get the score of everybody in one team? - shady91 - 26.04.2010

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.



Re: How do i get the score of everybody in one team? - Typical_Cat - 26.04.2010

GREAT! Thanks for the help guys. =)


Re: How do i get the score of everybody in one team? - shady91 - 26.04.2010

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


Re: How do i get the score of everybody in one team? - coole210 - 26.04.2010

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


Re: How do i get the score of everybody in one team? - shady91 - 26.04.2010

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.