Raised This Month: $89 Target: $400
 22% 

[ReQ] teams switch after round 10


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ahmad111
Junior Member
Join Date: Jul 2019
Old 08-12-2019 , 12:10   [ReQ] teams switch after round 10
Reply With Quote #1

AL SALAM ALYKOM
Hi guys
so i need a plugin that switch team (ct go tt and t come ct) with out rest the score for bought team
and i want this when any team (ct or t) reach the round 10
i mean if t reach round 10 switch teams
if the ct reach round 10 switch teams
with cvars : how limit rounds reach to switch/ and on or off plugin
Thanks guys <3

Last edited by Ahmad111; 08-12-2019 at 13:51.
Ahmad111 is offline
DON KHAN 1
Senior Member
Join Date: Mar 2019
Location: Pakistan
Old 08-14-2019 , 06:43   Re: [ReQ] teams switch after round 10
Reply With Quote #2

Walaikum Asalam

use this plugin by nikhilgupta345

aafter 10 rounds team will be switch
Attached Files
File Type: sma Get Plugin or Get Source (autoteamswitch.sma - 8 views - 4.5 KB)
__________________
Hosting Servers: Angel Of Games
Link 1: 213.32.7.40

Facebook
My YouTube
Join My Forum
Ro{Y}aL WarLanD CommuniTy
DON KHAN 1 is offline
Ahmad111
Junior Member
Join Date: Jul 2019
Old 08-14-2019 , 11:00   Re: [ReQ] teams switch after round 10
Reply With Quote #3

Quote:
Originally Posted by DON KHAN 1 View Post
Walaikum Asalam

use this plugin by nikhilgupta345

aafter 10 rounds team will be switch
i dont need it after 10 round to swith
i need to switch teams if ct or t reach 10 rounds
Ahmad111 is offline
DON KHAN 1
Senior Member
Join Date: Mar 2019
Location: Pakistan
Old 08-14-2019 , 11:49   Re: [ReQ] teams switch after round 10
Reply With Quote #4

bro what u want to say means can u explain deeply? maybe my mistake to understand
__________________
Hosting Servers: Angel Of Games
Link 1: 213.32.7.40

Facebook
My YouTube
Join My Forum
Ro{Y}aL WarLanD CommuniTy
DON KHAN 1 is offline
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 08-14-2019 , 11:55   Re: [ReQ] teams switch after round 10
Reply With Quote #5

Quote:
Originally Posted by DON KHAN 1 View Post
bro what u want to say means can u explain deeply? maybe my mistake to understand
After any team (CT or T) wins 10 rounds - swap teams.
__________________
Airkish is offline
Ahmad111
Junior Member
Join Date: Jul 2019
Old 08-14-2019 , 23:10   Re: [ReQ] teams switch after round 10
Reply With Quote #6

Quote:
Originally Posted by Airkish View Post
After any team (CT or T) wins 10 rounds - swap teams.
yep



Last edited by Ahmad111; 08-14-2019 at 23:10.
Ahmad111 is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 08-15-2019 , 01:01   Re: [ReQ] teams switch after round 10
Reply With Quote #7

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "Auto Team Switcher"
#define VERSION "1.0"
#define AUTHOR "nikhilgupta345"

#define ADMIN ADMIN_CVAR

new ctrounds
new trrounds
new Atsround
new bool:paused

new g_arPlugins[][] =
{       
    
"teamswitcher.amxx"
}

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_clcmd"say /roundnumber""sayRound" );
    
register_concmd"amx_roundrestart""restartnumber"ADMIN_KICK );
    
    
register_logevent"roundend"2"1=Round_End" );
    
register_event("SendAudio""EventTRWin","a""2&%!MRAD_terwin")
    
register_event("SendAudio""EventCTWin","a""2&%!MRAD_ctwin")
    
register_event"TextMsg","restart","a","2&#Game_C""2&#Game_W" ); // Event for "Game Commencing" TextMsg and "Game Will Restart in X Seconds" TextMsg
    
register_clcmd("say /switch""Controller")
    
    
Atsround register_cvar"amx_atsrounds""10" );
    
paused false

}

public 
EventTRWin()
{
    
trrounds++
}

public 
EventCTWin()
{
    
ctrounds++
}

public 
sayRoundid )
{
    
client_printidprint_chat"The current round is CT %i - TR %i."ctroundstrrounds );
    return 
PLUGIN_HANDLED;
}

public 
roundend()
{
    if( 
trrounds >= get_pcvar_numAtsround ) || ctrounds >= get_pcvar_numAtsround ))
    {
        new 
players[32], num;
        
get_playersplayersnum );
    
        for( new 
inumi++ )
            
add_delayplayers[i] ); // Prevent Server Crash with a lot of people.
    
}
}

public 
restartnumberidlevelcid )
{
    if( !
cmd_accessidlevelcid) )
        return 
PLUGIN_HANDLED;
    
    
trrounds ctrounds 0
    
return PLUGIN_HANDLED;
}

public 
restartid )
{
    
trrounds ctrounds 0
    
return PLUGIN_HANDLED;
}

public 
changeTeamid )
{
    switch( 
cs_get_user_teamid ) )
    {
        case 
CS_TEAM_CTcs_set_user_teamidCS_TEAM_T );
            
        case 
CS_TEAM_Tcs_set_user_teamidCS_TEAM_CT );
    }
    
    
trrounds ctrounds 0
}

add_delayid )
{
    switch( 
id )
    {
        case 
1..7set_task0.1"changeTeam"id );
        case 
8..15set_task0.2"changeTeam"id );
        case 
16..23set_task0.3"changeTeam"id );
        case 
24..32set_task0.4"changeTeam"id );
    }
}

stock PluginController(stop)
{
    for(new 
isizeof g_arPluginsi++)
    {
        if(
stop)
        {
            
pause  ("ac"g_arPlugins[i])
            
paused true
        
}
        else
        {
            
unpause("ac"g_arPlugins[i])
            
paused false
        
}
    }   
}

public 
Controller(id)
{
    if(~
get_user_flags(id) & ADMIN)
    {
        
client_print(idprint_chat"You don't have access to this command!")
        return 
PLUGIN_HANDLED
    
}
    
    if(
paused)
        
PluginController(0)
    
    else
        
PluginController(1)
    
    
client_print(idprint_chat"%sctivated"paused "a" "dea")
        return 
PLUGIN_HANDLED

__________________

Last edited by iceeedr; 08-15-2019 at 23:42.
iceeedr is offline
Send a message via Skype™ to iceeedr
Ahmad111
Junior Member
Join Date: Jul 2019
Old 08-15-2019 , 07:44   Re: [ReQ] teams switch after round 10
Reply With Quote #8

Quote:
Originally Posted by iceeedr View Post
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "Auto Team Switcher"
#define VERSION "1.0"
#define AUTHOR "nikhilgupta345"

new ctrounds
new trrounds
new Atsround;

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_clcmd"say /roundnumber""sayRound" );
    
register_concmd"amx_roundrestart""restartnumber"ADMIN_KICK );
    
    
register_logevent"roundend"2"1=Round_End" );
    
register_event("SendAudio""EventTRWin","a""2&%!MRAD_terwin")
    
register_event("SendAudio""EventCTWin","a""2&%!MRAD_ctwin")
    
register_event"TextMsg","restart","a","2&#Game_C""2&#Game_W" ); // Event for "Game Commencing" TextMsg and "Game Will Restart in X Seconds" TextMsg
    
    
Atsround register_cvar"amx_atsrounds""10" );
    
}

public 
EventTRWin()
{
    
trrounds++
}

public 
EventCTWin()
{
    
ctrounds++
}

public 
sayRoundid )
{
    
client_printidprint_chat"The current round is CT %i - TR %i."ctroundstrrounds );
    return 
PLUGIN_HANDLED;
}

public 
roundend()
{
    if( 
trrounds >= get_pcvar_numAtsround ) || ctrounds >= get_pcvar_numAtsround ))
    {
        new 
players[32], num;
        
get_playersplayersnum );
        
        for( new 
inumi++ )
            
add_delayplayers[i] ); // Prevent Server Crash with a lot of people.
            
    
}
}


public 
restartnumberidlevelcid )
{
    if( !
cmd_accessidlevelcid) )
        return 
PLUGIN_HANDLED;
    
    
trrounds ctrounds 0
    
return PLUGIN_HANDLED;
}

public 
restartid )
{
    
trrounds ctrounds 0
    
return PLUGIN_HANDLED;
}

public 
changeTeamid )
{
    switch( 
cs_get_user_teamid ) )
    {
        case 
CS_TEAM_CTcs_set_user_teamidCS_TEAM_T );
        
        case 
CS_TEAM_Tcs_set_user_teamidCS_TEAM_CT );
    }

    
trrounds ctrounds 0
}

add_delayid )
{
    switch( 
id )
    {
        case 
1..7set_task0.1"changeTeam"id );
        case 
8..15set_task0.2"changeTeam"id );
        case 
16..23set_task0.3"changeTeam"id );
        case 
24..32set_task0.4"changeTeam"id );
    }

can you make a cvar for on/off the plugin ?
Ahmad111 is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 08-15-2019 , 09:10   Re: [ReQ] teams switch after round 10
Reply With Quote #9

Code edited, not tested.
__________________
iceeedr is offline
Send a message via Skype™ to iceeedr
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 08-15-2019 , 22:11   Re: [ReQ] teams switch after round 10
Reply With Quote #10

It'll work only if the plugin is named as 'teamswitcher', otherwise the code you provided will do nothing, check this:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "Unknown yet"
#define VERSION "1.0"
#define AUTHOR "EFFEX"

new g_iRoundsWon[CsTeams], CsTeams:g_csTeamWon
new bool:g_bPluginOnbool:g_bTeamsSwitchedpCvarMinRoundsToSwitch

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
pCvarMinRoundsToSwitch register_cvar("minrounds_to_switch""10")
    
register_concmd("amx_switch""cmdStopSwitch"ADMIN_KICK"<1|0> - turn the switch plugin on/off")
    
    
register_event("TextMsg""event_roundRestarted","a""2&#Game_C""2&#Game_w")
    
register_event("SendAudio""event_TerroristsWin","a""2&%!MRAD_terwin"
    
register_event("SendAudio""event_CTerroristsWin","a""2&%!MRAD_ctwin")
    
    
g_bPluginOn true
}

public 
cmdStopSwitch(idiLeveliCid)
{
    if(!
cmd_access(idiLeveliCid2))
        return 
PLUGIN_HANDLED
        
    
new szMode[3]
    
read_argv(1szModecharsmax(szMode))
    
    
g_bPluginOn bool:str_to_num(szMode)
    
console_print(id"[AMXX]: The switch teams is now %sativated!"g_bPluginOn "" "de")
    return 
PLUGIN_HANDLED
}

public 
event_roundRestarted()
{
    if(!
g_bTeamsSwitched)
    {
        
g_iRoundsWon[CS_TEAM_T] = g_iRoundsWon[CS_TEAM_CT] = 0
    
}
    else 
g_bTeamsSwitched false

public event_TerroristsWin()
{
    if(!
g_bPluginOn)
        return
        
    if(++
g_iRoundsWon[CS_TEAM_T] >= get_pcvar_num(pCvarMinRoundsToSwitch))
    {
        
g_csTeamWon CS_TEAM_T
        set_task
(0.1"printColoredHudMessage", .flags "a", .repeat 30)
        
        
set_task(3.5"switchTeams")
    }
}

public 
event_CTerroristsWin()
{
    if(!
g_bPluginOn)
        return
    
    if(++
g_iRoundsWon[CS_TEAM_CT] >= get_pcvar_num(pCvarMinRoundsToSwitch))
    {
        
g_csTeamWon CS_TEAM_CT
        set_task
(0.1"printColoredHudMessage", .flags "a", .repeat 30)
        
        
set_task(3.5"switchTeams")
    }
}

public 
printColoredHudMessage()
{
    static 
bool:bTemp
    
    
new iRGB[3], bool:bTerrorWon bool:(g_csTeamWon == CS_TEAM_T)
    switch(
bTemp)
    {
        case 
true:
        {
            if(
bTerrorWon)
            {
                
iRGB = {25500}
            }
            else 
iRGB = {0100255}
            
            
bTemp false
        
}
        case 
false:
        {
            
iRGB = {255255255}
            
bTemp true
        
}
    }
    
set_hudmessage(iRGB[0], iRGB[1], iRGB[2], -1.00.301.00.1)
    
show_hudmessage(0"The %sTerrorist team has won %d rounds!^nSwitching teams..."bTerrorWon "" "Counter-"get_pcvar_num(pCvarMinRoundsToSwitch))
}

public 
switchTeams()
{
    new 
iPlayers[32], iNum
    get_players
(iPlayersiNum)
    for(new 
iid;iNumi++) 
    {
        if(
<= get_user_team((id iPlayers[i])) <= 2)
        {
            
cs_set_user_team(id cs_get_user_team(id) == CS_TEAM_T CS_TEAM_CT CS_TEAM_T)
        }
    }
    
g_bTeamsSwitched true

    
new iTemp g_iRoundsWon[CS_TEAM_T]
    
g_iRoundsWon[CS_TEAM_T] = g_iRoundsWon[CS_TEAM_CT]
    
g_iRoundsWon[CS_TEAM_CT] = iTemp
    
    client_print
(0print_center"Teams successfully swiched!")
    
server_cmd("sv_restart 1")

__________________
• BattleRoyale Mod
• Public PugMod
• Furien Mod

-

Currently working on Thanos vs. Avengers: 15%

Last edited by EFFx; 08-18-2019 at 02:26.
EFFx is offline
Send a message via Skype™ to EFFx
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 14:52.


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