#1

Hello.

I need to create something like A/D

Can anyone show me a code, when a player /join a war.

They get automaticly choosed to a team

Example the Attackers got 4 players

and Defenders got 2 players, so the next player who joins gets teleported to the defenders spawn.
Like a balance code

And also, when a player type /join, it makes a straight line with some coords i got?
Reply
#2

Okay, I got this for now.

pawn Код:
new Float:RandomSpawn[][4] =
{
    {2193.1692,-1143.9407,1029.7969,180.0461},
    {2221.2100,-1148.9974,1025.7969,3.0111}
};
pawn Код:
COMMAND:joinbase(playerid, params[])
{
    new rand = random(sizeof(RandomSpawn));
    SetPlayerInterior(playerid, 15);
    SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]);
    SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]);
    return 1;
}
Now it is random, but does anyone has a code like, it will balance the team, by that I mean it will join the team with lowest amount of players?
Reply
#3

pawn Код:
stock GetLowestCountTeam()
{
    new c0, c1;
    for (new i = 0; i < MAX_PLAYERS; i ++)
    {
           if (Team[i] == Team0) { c0 += 1; }
           else if (Team[i] == Team1) { c1 += 1; }
     }
     if (c0 < c1) return Team0;
     else if (c0 > c1) return Team1;
}
^ You mean this?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)