Raised This Month: $32 Target: $400
 8% 

[ReQ] teams switch after round 10


Post New Thread Reply   
 
Thread Tools Display Modes
Ahmad111
Member
Join Date: Jul 2019
Old 08-15-2019 , 23:03   Re: [ReQ] teams switch after round 10
Reply With Quote #11

Quote:
Originally Posted by iceeedr View Post
Code edited, not tested.
there is no cvar to on/off the plugin in plugin cvar menu/autoteamswitcher

Quote:
Originally Posted by EFFx View Post
It'll work only if the plugin is named as 'teamswitcher', otherwise the code you provided will do nothing, check this:
iceeedr code work good alhamdulellah
but no cvar for on/off the plugin

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

Command is /switch.

I just edited the code that was already there and so it's not very good, use the one from EFFx that is better coded.
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 08-16-2019 , 00:55   Re: [ReQ] teams switch after round 10
Reply With Quote #13

Quote:
Originally Posted by Ahmad111 View Post
iceeedr code work good alhamdulellah
but no cvar for on/off the plugin

Thats exactly what I meant, he uses a format that pauses the plugin by its name, mine you just need to use a command, simple as that. Also as he said, mine is better coded, so you can use it if you want to, it's up to you.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
Old 08-16-2019, 06:13
thEsp
This message has been deleted by thEsp.
Ahmad111
Member
Join Date: Jul 2019
Old 08-16-2019 , 07:16   Re: [ReQ] teams switch after round 10
Reply With Quote #14

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"

#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

when team switched the score of rounds doesn't switched too

i mean t have 10 round ct have 8 rounds , when team switched, the t have 8 round and ct 10 round

Last edited by Ahmad111; 08-16-2019 at 07:17.
Ahmad111 is offline
Godofwar
AlliedModders Donor
Join Date: Dec 2015
Location: Germany
Old 08-17-2019 , 12:09   Re: [ReQ] teams switch after round 10
Reply With Quote #15

not sure but when u are using REHLDS + REAPI Module then use this here:
change g_pCvar_SwapRound = register_cvar("swap_team_rounds", "3") to g_pCvar_SwapRound = register_cvar("swap_team_rounds", "10")

PHP Code:
#include <amxmodx>

/* Common include libraries */
#include <amxmisc>
#include <cromchat>
#include <reapi>

#define PLUGIN  "Swap Teams in X Rounds"
#define VERSION "1.0"
#define AUTHOR  "Huehue @ AMXX-BG.INFO"
#define ADMIN_ACCESS     ADMIN_MAP

new g_pCvar_SwapRound
new g_iRound 0

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
RegisterHookChain(RG_RoundEnd"RG__RoundEnd", .post false)
    
RegisterHookChain(RG_CSGameRules_RestartRound"RG__CSGameRules_RestartRound", .post false)

    
g_pCvar_SwapRound register_cvar("swap_team_rounds""3")

    
register_clcmd("say /rounds""CheckRounds")
    
register_clcmd("amx_restart_rounds""Command_RestartRounds"ADMIN_ACCESS)

    
CC_SetPrefix("&x03[Switch Teams]&x01")
}

public 
Command_RestartRounds(idlevelcid)
{
    if (!
cmd_access(idlevelcid1))
        return 
PLUGIN_HANDLED
    
    g_iRound 
0
    CC_SendMessage
(id"You have reset the round counter..")
    
CC_SendMessage(id"Current round is &x04%d."g_iRound)
    return 
PLUGIN_HANDLED
}

public 
CheckRounds(id)
{
    
CC_SendMessage(id"Current round is &x04%d."g_iRound)
    return 
PLUGIN_HANDLED
}

public 
RG__RoundEnd(WinStatus:statusScenarioEventEndRound:eventFloat:tmDelay)
{
    if(
event != ROUND_GAME_COMMENCE && event != ROUND_GAME_RESTART)
    {
        
g_iRound++

        if (
g_iRound >= get_pcvar_num(g_pCvar_SwapRound))
        {
            
CC_SendMessage(0"&x04%d Rounds &x01reached. &x04Switching Teams now.."g_iRound)
            
rg_swap_all_players()
            
g_iRound 0
        
}
    }
}

public 
RG__CSGameRules_RestartRound()
{
    new 
bool:bIsNewGame bool:get_member_game(m_bCompleteReset)
    if (
bIsNewGame)
        
g_iRound 0


Last edited by Godofwar; 08-17-2019 at 12:12.
Godofwar is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 08-17-2019 , 15:43   Re: [ReQ] teams switch after round 10
Reply With Quote #16

Quote:
Originally Posted by Ahmad111 View Post
when team switched the score of rounds doesn't switched too

i mean t have 10 round ct have 8 rounds , when team switched, the t have 8 round and ct 10 round
Dude, mine already does everything you asked before.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
Alber9091
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
Old 08-17-2019 , 21:48   Re: [ReQ] teams switch after round 10
Reply With Quote #17

@EFFx, in your code
Code:
server_cmd("sv_restart 1")
I doubt, won't it turns score to zero for both teams, instead of switching scores with teams?
Alber9091 is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 08-18-2019 , 02:22   Re: [ReQ] teams switch after round 10
Reply With Quote #18

Yes, the code switches both scores but after the sv_restary it'll be reseted again, I've fixed it.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
Ahmad111
Member
Join Date: Jul 2019
Old 04-05-2020 , 01:32   Re: [ReQ] teams switch after round 10
Reply With Quote #19

Quote:
Originally Posted by EFFx View Post
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")

/tmp/texteh7ltM.sma(1) : error 010: invalid function or declaration
/tmp/texteh7ltM.sma(47) : warning 217: loose indentation
/tmp/texteh7ltM.sma(47) : error 029: invalid expression, assumed zero
/tmp/texteh7ltM.sma(47) : error 017: undefined symbol "event_TerroristsWin"
/tmp/texteh7ltM.sma(61) : error 029: invalid expression, assumed zero
/tmp/texteh7ltM.sma(61) : error 017: undefined symbol "event_CTerroristsWin"
/tmp/texteh7ltM.sma(75) : error 029: invalid expression, assumed zero
/tmp/texteh7ltM.sma(75) : error 017: undefined symbol "printColoredHudMessage"
/tmp/texteh7ltM.sma(102) : error 029: invalid expression, assumed zero
/tmp/texteh7ltM.sma(102) : error 017: undefined symbol "switchTeams"
/tmp/texteh7ltM.sma(121) : error 001: expected token: "}", but found "-end of file-"

10 Errors.
Could not locate output file /home/groups/amxmodx/public_html/websc3/texteh7ltM.amx (compile failed).

when compile i have this
Ahmad111 is offline
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 04-05-2020 , 03:55   Re: [ReQ] teams switch after round 10
Reply With Quote #20

For the next few hours, I'll put the Metch mode in the plugins section
My mod solves your problem
alferd is offline
Reply



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 00:53.


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