Need help with TDM
#1

Hello, I am working on my TDM server, and I wanted to make, that team members can't kill each other. is it possible?

P.s. can somebody explain this:
pawn Код:
stock team()
{
    new count;

    for(new i; i < MAX_PLAYERS; i++)
    {
        if(team[i] == 1) count ++;
    }
    return count;
}
My friend told me, that this is player count... e.g. If in Team 1 are 2 players, in Team 2 is 1 player, in Team 1 can't play 3rd player, he gets an message which sayies that he must play in other team, to make Team balanced... Please help me with these things.
Reply
#2

Use on OnPlayerSpawn: SetPlayerTeam(playerid,TEAMID);


Код:
if(Team[playerid] == Team1)
{
SetPlayerTeam(playerid,Team1);
}
else if(Team[playerid] == Team2)
{
SetPlayerTeam(playerid,Team2)
}
Reply
#3

Quote:
Originally Posted by BlackBank3
Use on OnPlayerSpawn: SetPlayerTeam(playerid,TEAMID);


Код:
if(Team[playerid] == Team1)
{
SetPlayerTeam(playerid,Team1);
}
else if(Team[playerid] == Team2)
{
SetPlayerTeam(playerid,Team2)
}
That won't prevent players who are in the same team from killing each other.
Reply
#4

Each other killing fixed... but how do I do with the other thing?
Reply
#5

Balancing teams? In the bit where you assign them, just do something like..

pawn Код:
if(team1 > team2) // put player on team2
else //put player on team1
team1 and team2 are variables containing the number of players on each team, that's what your little code thing does I think..
Reply
#6

thanks! it works!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)