team balancing?
#1

Hi,

I'm busy with my gamemode and I wonder if there's something that can check if the team is uneven and then it tells you when you want to spawn that the team is full. E.g:
Team 1 has 3 members playing
Team 2 has 4 members playing
You want to join team 2 but that is 'full'. How to make the client show you a message that team 2 is full when you want to spawn?
Reply
#2

Use Search

But for now look at this TOPIC
Reply
#3

Quote:
Originally Posted by |)ЂΩ†{−}ЂR™ – Dare To Die
Use Search

But for now look at this TOPIC
If you look at the latest post is says that it isn't solved yet.
Reply
#4

You can simply add global arrays to the top of the script:

Код:
new Team1Players;
new Team2Players;
And if someone wants to join, you can:

Код:
...


if(!strcmp(cmdtext,"/team1",6,true)){
if(Team1Players==5)return SendClientMessage(playerid,WHITE,"Team 1 has enough players.");
if(Team1Players !=5){
Team1Players++;
SetPlayerColor(playerid,BLUE);
GivePlayerWeapon(playerid,24,500);
}
return 1;
}

...
You can try with the samples i gave you. I guess you cought my drift

If you want the textdraw to show how many players each team has, you can:

In the top of the script:

Код:
new Text:Teams;
forward TeamText;
On the callback, OnPlayerConnect:

Код:

new string[30]; format(string,sizeof(string),"Team1: %d ~n~Team2:%d",Team1Players,Team2Players);
Teams = TextDrawCreate(150,200,string);
TextDrawShowForPlayer(playerid,Teams);
SetTimer("TeamText",2000,true);
Now, at the end of the script:

Код:
public TeamText()
{
new string[30]; format(string,sizeof(string),"Team1: %d ~n~Team2:%d",Team1Players,Team2Players);
TextDrawSetString(Teams,string);
}
Reply
#5

Change your team defines

pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    new Team1, Team2;
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && i != playerid)
        {
            if(gTeam[i] == TEAM1) Team1++;
            else if(gTeam[i] == TEAM2) Team2++;
        }
    }
    if(gTeam[playerid] == TEAM1 && Team1 > Team2)
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "This team is full!");
        return 0;
    }
    else if(gTeam[playerid] == TEAM2 && Team2 > Team1)
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "This team is full!");
        return 0;
    }
    return 1;
}
Reply
#6

Made, yours doesn't work
Reply
#7

Quote:
Originally Posted by Rubennnnn
Made, yours doesn't work
You are supposed to change that.
Reply
#8

Quote:
Originally Posted by MadeMan
Quote:
Originally Posted by Rubennnnn
Made, yours doesn't work
You are supposed to change that.
Into what?
Reply
#9

Quote:
Originally Posted by Rubennnnn
Quote:
Originally Posted by MadeMan
Quote:
Originally Posted by Rubennnnn
Made, yours doesn't work
You are supposed to change that.
Into what?
Edit team names into your own. I.e.: Team1 to TEAM_COPS and Team2 to TEAM_GANG
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)