20.07.2012, 01:55
@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.
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.
See, it's not too hard, you'll just have to think a little bit.
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++;
}
}
}
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.
}
}