cleveridiot.com » the clever bit » the games we play
 Print Thread
Team stacking
Clever Idiot

Quote

jem58 wrote:
Yeah it's been working well, apart from when you start with like 15 on one team and 5 on the other Pfft


yeah was hoping to have a end of waiting time = restartgame 1 which sould then balance teams. But sadly it seems you cant hook to a event from valve as it does nt always fire correctly. Which is a real pain as the current script is only a few lines code Smile so its not great but its better than half the spec team pressing the key for side thats going to win...

Quote

public OnClientPutInServer(client)
{
ChangeClientTeam (client, GetRandomInt(2,3));
FakeClientCommand(client, "joinclass %s", "random");
return true;
}


so if someone wants to see if they can add some maths to code as im not coder and took me a week to get this out of a coder Smile but sadly we have seen what happens before so its a choice of 2 evils.
 
Megalomania
Try changing this line:


ChangeClientTeam (client, GetRandomInt(2,3));


To this:


   new iBluTeam = GetTeamClientCount(2);
   new iRedTeam = GetTeamClientCount(3);
   
   if(iBluTeam > iRedTeam) {
      ChangeClientTeam(client, 3);
   }
   else if(iRedTeam > iBluTeam) {
      ChangeClientTeam(client, 2);
   }
   else if(iBluTeam == iRedTeam) {
      ChangeClientTeam(client, GetRandomInt(2, 3));
   }

img401.imageshack.us/img401/9208/tf2sigtz5.png
 
Clever Idiot
ta mega for looking i get

2 errors 017 undifend "geteamclientcount"

Edited by Clever Idiot on 25-02-2008 21:20

 
sick-lizard
if waiting for players event is floored could use spawn plus 60 second delay
event or even map start?
 
Clever Idiot
code?
 
sick-lizard
in es yes rofl



nearly did it in es earlier but thought it may just confuse issue
 
Clever Idiot

Quote

#include
#include

#define PLUGIN_VERSION "0.6"

public Plugin:myinfo =
{
name = "CI forceteam",
author = "SMM forums_mega_MrG",
description = "Force player into a team as soon as they connect.",
version = PLUGIN_VERSION,
url = "http://www.cleveridiot.com"
}

public OnClientPutInServer(client)
{
new iBluTeam = GetTeamClientCount(2);
new iRedTeam = GetTeamClientCount(3);

if(iBluTeam > iRedTeam)
{
ChangeClientTeam(client, 3);
FakeClientCommand(client, "joinclass %s", "random");
}
else if (iRedTeam > iBluTeam)
{
ChangeClientTeam(client, 2);
FakeClientCommand(client, "joinclass %s", "random");
}
else if (iBluTeam == iRedTeam)
{
ChangeClientTeam(client, GetRandomInt(2, 3));
FakeClientCommand(client, "joinclass %s", "random");
}
}


forceteam code.

Edited by Clever Idiot on 28-02-2008 13:51

 
sick-lizard
Looking good..is it not possible to use team 2 & team 3 etc instead of red/blue to make it compatible with other HL2 mods?

Also why do we need the random class I'm guessing if you don't do it users are able to click cancel & jump back to the team selector?
 
Jump to Forum