Results 1 to 6 of 6

Thread: limit of commanders at map.

  1. #1
    Private First Class
    Join Date
    Jul 2013
    Posts
    170
    Thanks
    44
    Thanked 16 Times in 11 Posts

    limit of commanders at map.

    Code:
    players = getentarray("player", "classname");
    list = [];
    for(i = 0;i < players.size;i++)
    	if(players[i].pers["team"] != "spectator")
    		list[list.size] = players[i];
    
    num = randomint(list.size);
    commander = list[num];
    iprintlnbold(commander.name + " is chosen to be the commander!");
    commander thread docommander();
    
    
    
    
    
    docommander()
    {
             if(self.pers["team"] == "allies")
    	{
            self.maxhealth = 180;
    	self.health = self.maxhealth;
            //add what you want for commander.
    	}
            if(self.pers["team"] == "axis")
            self.maxhealth = 1200;
            self.health = self.maxhealth
            //add what you want for commander.
            }
    }
    Okey,here is code for commander,and it choose all for commadner,how i can put to just 1 is commander?

  2. #2
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Just call it once?

  3. #3
    Private First Class
    Join Date
    Jul 2013
    Posts
    170
    Thanks
    44
    Thanked 16 Times in 11 Posts
    where i can call it once? i tried at some places.. :]

    Can u say where?

  4. #4
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    It depends on your mod, it should be in some RoundRestart function
    timescale 0.01

  5. #5
    Private First Class
    Join Date
    Jul 2013
    Posts
    170
    Thanks
    44
    Thanked 16 Times in 11 Posts
    i want put it for 1 map = 1 commander,same person not every round other.

  6. #6
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    ah round-based.

    Save it in player.pers array, its persistent.

    Check all players for iscommander

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •