Autoassign
-
Is there anyway / script available that when a player chooses a team it just auto assigns that player?
I know in cod4x you can change code in the _menu.gsx fileif( menu == game["menu_team"] ) { switch(response) { case "allies": self [[level.autoassign]](); // changed from [[level.allies]] break; case "axis": self [[level.autoassign]](); // changed from [[level.axis]] break; case "autoassign": self [[level.autoassign]](); break; case "spectator": self [[level.spectator]](); break; }
Is there anything similar that can be done for MW3?
-
Wouldn't you prefer to not give the user choice at all and simply auto assign him when he joins?
This can be done with a few lines that restrict team choice and the line that you gave that is correct[[level.autoassign]]();
If you want to do that this script does just that
Init() { InitTest(); } InitTest() { replacefunc(maps\mp\_utility::allowTeamChoice, ::ReplaceAllowTeamChoice); level thread OnPlayerConnect(); } OnPlayerConnect() { for(;;) { level waittill("connected", player); player [[level.autoassign]](); } } ReplaceAllowTeamChoice() { return false; }
-
Thanks Resxt
-
Just one more thing....
How once a player is autoassigned into the game can the player be stopped from changing team?
Cheers
MAD_DAD
*** Done see post below ***
-
Ok did some tinkering and decided to set up a server players against bots.
Your autoassign script works great on first joining.
Now with the code I did(yours really helped me along). I now can stop a player from joining the bots team and gets put back to join the "Human" team.
Here's the code:Init() { level thread OnPlayerConnect(); } OnPlayerConnect() { for(;;) { level waittill("connected", player); player thread OnPlayerSpawn(); } } OnPlayerSpawn() { self endon ( "disconnect" ); while( 1 ) { self waittill( "spawned_player" ); if(IsDefined( self.pers[ "isBot" ] ) && self.pers[ "isBot" ] ) return; else self thread ChangeTeam(); } } ChangeTeam() { self endon ( "disconnect" ); if ( self.pers["team"] != "axis" ) return; else self iprintlnbold("^3>> ^2Do Not Join The BOTS! ^3<<"); wait 2; self [[level.allies]](); }
Please feel free to scrutinise the code and point out where I could improve it
Cheers
MAD_DAD -
@MAD_DAD You need to override the _menus.gsc file and with that you will be able to prevent people from joining one team and force auto-assign real players to one team and keep bots to a separate team.
The next Pluto release will have a built-in method "IsTestClient" you can use to differentiate between real players and bots.