AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   [ReQ] teams switch after round 10 (https://forums.alliedmods.net/showthread.php?t=318065)

Ahmad111 08-12-2019 12:10

[ReQ] teams switch after round 10
 
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

DON KHAN 1 08-14-2019 06:43

Re: [ReQ] teams switch after round 10
 
1 Attachment(s)
Walaikum Asalam

use this plugin by nikhilgupta345

aafter 10 rounds team will be switch

Ahmad111 08-14-2019 11:00

Re: [ReQ] teams switch after round 10
 
Quote:

Originally Posted by DON KHAN 1 (Post 2663167)
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

DON KHAN 1 08-14-2019 11:49

Re: [ReQ] teams switch after round 10
 
bro what u want to say means can u explain deeply? maybe my mistake to understand

Airkish 08-14-2019 11:55

Re: [ReQ] teams switch after round 10
 
Quote:

Originally Posted by DON KHAN 1 (Post 2663215)
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.

Ahmad111 08-14-2019 23:10

Re: [ReQ] teams switch after round 10
 
Quote:

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

yep


https://5.top4top.net/p_1322z8ey51.png

iceeedr 08-15-2019 01:01

Re: [ReQ] teams switch after round 10
 
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



Ahmad111 08-15-2019 07:44

Re: [ReQ] teams switch after round 10
 
Quote:

Originally Posted by iceeedr (Post 2663317)
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 ?

iceeedr 08-15-2019 09:10

Re: [ReQ] teams switch after round 10
 
Code edited, not tested.

EFFx 08-15-2019 22:11

Re: [ReQ] teams switch after round 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")




All times are GMT -4. The time now is 21:51.

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