PDA

View Full Version : limit of commanders at map.



Rocky
23rd January 2014, 15:50
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?

IzNoGoD
23rd January 2014, 15:54
Just call it once?

Rocky
23rd January 2014, 17:41
where i can call it once? i tried at some places.. :]

Can u say where?

kung foo man
23rd January 2014, 17:51
It depends on your mod, it should be in some RoundRestart function

Rocky
23rd January 2014, 17:53
i want put it for 1 map = 1 commander,same person not every round other.

IzNoGoD
23rd January 2014, 21:54
ah round-based.

Save it in player.pers array, its persistent.

Check all players for iscommander