team wins
#6

@HellSphinX:
There's no reason to add a break and what's the point to decrease the counter when a player die and disconnect?

you must make four vars to do it right, you'll count how many players are in the same by creating 2 new vars and making 2 new ones to increase the kills/deaths which means the point earned / point lost.

pawn Code:
new
blueplayers= 0,
redplayers = 0,
bluepoints = 0,
redpoints = 0;

// it should be onplayerrequestclass, cause onplayerspawn is called every time you spawn, so it would give //you wrong values, since onplayerrequestclass is called once, is the best choise.
public OnPlayerRequestClass(playerid,classid)
{
    if(gTeam[playerid] == TEAM_BLUE) {
        blueplayers++;
    }
    else if(gTeam[playerid] == TEAM_RED) {
        redplayers++;
    }
    return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
    if(killerid != INVALID_PLAYER_ID) {
        if(gTeam[killerid] == TEAM_BLUE) {
            bluepoints++;
        }
        else if(gTeam[killerid] == TEAM_RED) {
            redpoints++;
        }
    }
}
With this, you can start with your business, you'll just have to make some value's and use some logic, i'll give you a tip.

pawn Code:
checkp()
{
     if(bluepoints > redpoints)
     {
      // here means the blue team is the winner.
     }
     else if(redpoints > bluepoints)
     {
     // here mean the red team is the winner
     }
     else if(redpoints == bluepoints)
     {
     // here we got a draw.
     }
}
See, it's not too hard, you'll just have to think a little bit.
Reply


Messages In This Thread
team wins - by (_AcE_) - 19.07.2012, 23:24
Re: team wins - by (_AcE_) - 19.07.2012, 23:44
Re: team wins - by nepstep - 19.07.2012, 23:47
Re: team wins - by (_AcE_) - 20.07.2012, 01:21
Re: team wins - by [KHK]Khalid - 20.07.2012, 01:26
Re: team wins - by leonardo1434 - 20.07.2012, 01:55
Re: team wins - by [KHK]Khalid - 20.07.2012, 02:15
Re: team wins - by nepstep - 20.07.2012, 05:04
Re: team wins - by cessil - 21.07.2012, 09:19

Forum Jump:


Users browsing this thread: 1 Guest(s)