Raised This Month: $12 Target: $400
 3% 

[DODS] Swap Teams at Round End v1.0.200


Post New Thread Reply   
 
Thread Tools Display Modes
strontiumdog
Veteran Member
Join Date: Jan 2007
Location: BC, Canada
Old 05-04-2009 , 20:32   Re: [DODS] Swap Teams at Round End v1.0.101
Reply With Quote #11

Yup. In fact it is for DoDS OB.
BTW, updated it a while ago, Mos, so that it didn't kill people when swapping teams.
__________________
Plugins | TheVille
Zombie Mod for DoD:S - l4dod.theville.org
strontiumdog is offline
Cain
SourceMod Donor
Join Date: May 2005
Location: South Carolina, USA
Old 05-04-2009 , 20:58   Re: [DODS] Swap Teams at Round End v1.0.101
Reply With Quote #12

SWEET!! Many thanks .. I'll load this tomorrow morning when my server is empty....

This is a terrific solution for the players who always pick the best side on certain maps (Avalanche for example)..

Thank you !!
Cain is offline
psychocoder
Member
Join Date: Jan 2009
Location: Germany
Old 05-20-2009 , 06:39   Re: [DODS] Swap Teams at Round End v1.0.101
Reply With Quote #13

I thing have found a little bug.

in function ChangeTeams()

Code:
new maxplayers = GetClientCount(true)
must change in
Code:
new maxplayers = MaxClients
because if a player have a higher clientnumber as player online than he will not be swaped.

also I had add a new thing, you can choose after how many rounds the plugin swap the team.

add this points and change one function
Code:
new g_rounds
.
.
.
public PlayerRoundWinEvent(Handle:event, const String:name[], bool:dontBroadcast) 
{
    g_rounds+=1;
    new plugin_rounds=GetConVarInt(g_Cvar_Swapteams); 
    if(plugin_rounds != 0)
    { 
        if (plugin_rounds==g_rounds) 
        { 
            new Float:delay = float(GetConVarInt(g_Cvar_BonusRound)) 
            PrintToChatAll("\x01\x04[SM] Teams will be swapped in %i seconds", GetConVarInt(g_Cvar_BonusRound)) 
            g_rounds=0; 
            if (delay > 0) 
            { 
                CreateTimer(delay, DelayedSwitch, 0, 0) 
            } 
            else 
            { 
                ChangeTeams() 
            } 
        }
        else
        {
            PrintToChatAll("\x01\x04[SM] Teams will be swapped in %i round(s)", plugin_rounds-g_rounds)
        }
    } 
}


public OnMapStart () 
{ 
    g_rounds=0; 
}

And now you can set round over the cvar sv_dod_swapteams.
sv_dod_swapteams 0 // no swap
sv_dod_swapteams X // swap after X rounds - > X is a Integer

Last edited by psychocoder; 05-20-2009 at 06:42.
psychocoder is offline
strontiumdog
Veteran Member
Join Date: Jan 2007
Location: BC, Canada
Old 05-20-2009 , 09:41   Re: [DODS] Swap Teams at Round End v1.0.200
Reply With Quote #14

As ever, a good bit of coding!
Thanks!
__________________
Plugins | TheVille
Zombie Mod for DoD:S - l4dod.theville.org
strontiumdog is offline
psychocoder
Member
Join Date: Jan 2009
Location: Germany
Old 05-20-2009 , 09:46   Re: [DODS] Swap Teams at Round End v1.0.200
Reply With Quote #15

Ohh very fast edit.

I think you forgot the initialisation of g_round. Or were all declaratet variables 0 ?

Code:
public OnMapStart () 
{ 
    g_rounds=0; 
}
psychocoder is offline
matrix007
Junior Member
Join Date: Oct 2009
Location: australia
Old 10-28-2009 , 20:02   Re: [DODS] Swap Teams at Round End v1.0.200
Reply With Quote #16

I need a plugin like this that changes teams on map start , i need it to save teams then on map change it swaps.I need this for a dods pug server.also need it to lock teams on readyrestart.is this possible?
matrix007 is offline
Regor Tejmar
New Member
Join Date: Sep 2011
Location: Frisco, TX
Old 09-11-2011 , 12:20   Re: [DODS] Swap Teams at Round End v1.0.200
Reply With Quote #17

I've found a problem with this plugin. the g_round variable get incremented even for the rounds and maps that the plugin is not enabled. On our servers, we only enable this pluging for dod_jagd and dod_strand. We would get messages that the teams will be swapped in -4 rounds, because g_round had been incremented above the value of sm_dod_swapteam.

I've modified one function to fix this:
Code:
public PlayerRoundWinEvent(Handle:event, const String:name[], bool:dontBroadcast) 
{
    new plugin_rounds=GetConVarInt(g_Cvar_Swapteams); 
    if(plugin_rounds != 0)
    { 
        //Added by Regor Tejmar -- Only increment g_rounds if plugin is enabled.
    g_rounds+=1;
        //Added by psychocoder
        if (plugin_rounds<=g_rounds) // If g_rounds is too high change too RT
        { 
            new Float:delay = float(GetConVarInt(g_Cvar_BonusRound)); 
            PrintToChatAll("\x01\x04[SM] Teams will be swapped in %i seconds", GetConVarInt(g_Cvar_BonusRound));
            g_rounds=0; 
            if (delay > 0) 
            { 
                CreateTimer(delay, DelayedSwitch, 0, 0); 
            } 
            else 
            { 
                ChangeTeams(); 
            } 
        }
        else
        {
            PrintToChatAll("\x01\x04[SM] Teams will be swapped in %i round(s)", plugin_rounds-g_rounds);
        }
    }
    else
    //Added by Regor Tejmar -- Reset round count if plugin is disabled.
    {
    g_rounds=0;
    }
}
Also, it looks like pschocoders last suggestion was never added.

Quote:
Originally Posted by psychocoder View Post
Ohh very fast edit.

I think you forgot the initialisation of g_round. Or were all declaratet variables 0 ?

Code:
public OnMapStart () 
{ 
    g_rounds=0; 
}
This is a good change that resets the round count on a map change. without it, it may swap teams one or more rounds early.

I've attached a new source code with these changes.
Attached Files
File Type: sp Get Plugin or Get Source (sm_dod_swapteams.sp - 528 views - 3.6 KB)
Regor Tejmar is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:43.


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