Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is this Correct?
#1
Hey Guys im new to modding(Just started around 3 weeks after BO)

I'm trying to limit the attacking team to 3 players while the rest on the defending team.

and i'm just wondering is this Correct way

Code:
doPlayerCount()
{
  

    attack = 0;
    defend = 0;
    for(i = 0; i < level.players.size; i++) {
        if(level.players[i].pers["team"] == game["defenders"])
            defend++;
        if(level.players[i].pers["team"] == game["attackers"])
            attack++;        
if (attack <= 3)
{
         defend++ || attack++;
}
else
{
         defend++;


  }
}
Reply

#2
Put this at onJoinedTeam.

Code:
if(self.pers["team"] == game["attackers"])
{
    if(attack >= 3)
    {
        self maps\mp\gametypes\_teams::changeTeam(game["defenders"]);
    }
    else
    {
        attack++;
    }
}

You would also want to call this thread at onPlayerConnect with
level thread DisconnectFix(self);

Code:
DisconnectFix(player)
{
    if(player.pers["team"] == game["attackers"])
    {
        while(isDefined(player))
        {
            wait 0.05;
        }
        new = level.players[RandomInt(level.players.size)];
        while(new.pers["team"] == game["attackers"])
        {
            new = level.players[RandomInt(level.players.size)];
        }
        new maps\mp\gametypes\_teams::changeTeam(game["attackers"]);
    }
}
YouTube 1:Azumikkel- Modding
YouTube 2:DerpShark- Gaming Entertainment
Website:Jensby.me
Contact: im[at]jensby.me
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tutorial] BO Collmaps Correct way :p - Video tut rotceh_dnih 3 3,150 05-27-2012, 15:28
Last Post: rotceh_dnih
  [Release] Correct Silent ADS and Crouch barata 4 3,764 07-13-2011, 17:04
Last Post: koil

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.