AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=109)
-   -   [Nuclear Dawn] Swap Teams at Round End (https://forums.alliedmods.net/showthread.php?t=166035)

senseit 08-30-2011 00:41

[Nuclear Dawn] Swap Teams at Round End
 
1 Attachment(s)
The 2 nuclear dawn maps released with the beta were both kind of one sided. Due to benefits/downside of each class. Using a swap team plugin the players might be able to recover their honor after the slaughter they just experienced.

As an example empire is better on downtown as only a few relay towers are needed for those long stretches to get to forward points. On the flip side due to consortium's non-LOS nature of their power propagation they only need 2 relay towers to get to mid on metro.

This will work on any game that uses round_win as the event name and uses team id # 2 and 3 as the 2 team IDs. However, I may add subclass memory (where it will automatically assign the subclass to the last subclass the user was using). When that happens the plugin will only work for nuclear dawn.

As of posting this there is a bug with nuclear dawn where the round_win event only fires after the first round end and not on any successive round ends. So your server should be set to max rounds of 2 (default).

Installation:
Drop the plugin file into your sourcemod's plugin directory and change the map.

Update: cleaned up some of the code

Update: Fixed a possible bug

Update: Fixed a bug that happens in conjunction with [Nuclear Dawn] Team Balancer plugin.

tcviper 12-17-2011 07:59

Re: [Nuclear Dawn] Swap Teams at Round End
 
I think this needs an update:

L 12/16/2011 - 00:47:15: [SM] Native "SetConVarInt" reported: Invalid convar handle 0 (error 4)
L 12/16/2011 - 00:47:15: [SM] Displaying call stack trace for plugin "nd-round-teamswap.smx":
L 12/16/2011 - 00:47:15: [SM] [0] Line 23, /home/groups/alliedmodders/forums/files/5/8/2/6/8/91704.attach::event_RoundEnd()

Calystos 12-29-2011 19:05

Re: [Nuclear Dawn] Swap Teams at Round End
 
1 Attachment(s)
Simple enough fix, just had to add some if statements to check if the variable exists or not. (Same fix can be applied to nd-warmup-round too)

I've attached the same file from above just with the two if lines added to error check for that variable. Probably a better way to do it but its after midnight an am exhausted, so its a quick an dirty fix, lol, ;)

EG:
Code:

if (FindConVar("sm_nd_balancer_enable")) { SetConVarInt(FindConVar("sm_nd_balancer_enable"), 0, false, false); }
An at the end:
Code:

if (FindConVar("sm_nd_balancer_enable")) { SetConVarInt(FindConVar("sm_nd_balancer_enable"), 1, false, false); }
Have just changed a few other bits, not sure if its better or not but seems to work quite well on my server now, :)

Code:

        for(new i=1; i <= MaxClients; i++) {
                if(IsClientInGame(i) && !IsFakeClient(i)) {
                        new team = GetClientTeam(i);
                        if (team == 2) {
                                ChangeClientTeam(i, 3);
                        }
                        if (team == 3) {
                                ChangeClientTeam(i, 2);
                        }
                }
        }

Changed to:
Code:

        // Swap the teams
        for (new i=1; i <= MaxClients; i++) {
                if (IsClientInGame(i) && !IsFakeClient(i)) switch (GetClientTeam(i))
                {
                        case TEAM1: ChangeClientTeam(i, TEAM2);
                        case TEAM2: ChangeClientTeam(i, TEAM1);
                }
        }

Got that code from advcommands.sp (also two defines at the top for TEAM1/TEAM2 of course) but added the fakeclient bit from this addon. Seems to work okay.

Also added a little alert to let players know its happening.
Code:

PrintToChatAll("\x01\x04[SM]\x01 Round Ended: Swapping Teams");

Ultrix Prime 01-06-2012 23:13

Re: [Nuclear Dawn] Swap Teams at Round End
 
Good plugin - running it on 4 servers.

One small issue - when the players get swapped after the end of the first map round, everyone gets a death and another at the next end of map when the map is actually going to change and no swap is necessary.

I've used a different sourcemod plugin in the past for switching players (teamswitch I think it's called) and it didn't kill them to do it (use mani for that now on CSS, but a manual teamswitch plugin for ND would be good along with a teambalance based upon rank).

For servers that keep ranks through Gameme, etc, the extra deaths are relevant and even without additional stats, some players find the unearned death annoying.

All in all, I'm very satisfied with the plugin as are most players that come to our servers and would like to thank you for having contributed it.


thank you again,


Ultrix

Calystos 02-16-2012 01:40

Re: [Nuclear Dawn] Swap Teams at Round End
 
3 Attachment(s)
Ultrix, try this version.

Not sure if it'll tell the stats systems to update right or not, but it does update the TAB->Scores info anyways so should update things like gameme & hlstatsx:ce I think.

EDIT: Oopsy, forgot something. Fixed & working version upped. :)
Also added "sm_swapteams" command, so you may now manually swap (handy for testing an stuff).

EDIT: Changed a few things, updated force anytime swap system to also backup & restore not only deaths but also kills/frags & who was a Commander (if anyone was). NOTE: This includes some functionality from ND Commander Management plugin.

Okay, here's my alternate version of the plugin. (hope its okay posting this, if not lemme know an will remove it or start new thread or something) I've added a load of things to this one including force swapping which not only remembers commanders, but also soon will do squads too. I've also added a nucleardawn.inc include file which can be used by other plugins to gain access to various functions that myself and others have come up with (such as the commander stuff aforementioned here) and will get more stuff added as an when more is uncovered, :)

This build adds a console command. "sm_swapteams" can be ran by an admin (plus you can add it to the adminmenu_custom.txt file if wished) which will force-swap all players immediately (normally waits til a round end). The difference between a normal swap and a force swap is that a force swap will remember who was commander, and put them back to commander as well as other things.

Got a few more things going to be added to this but figured release for everyone to enjoy, :)


All times are GMT -4. The time now is 05:25.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.