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

auto swap teams


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
razaR
Member
Join Date: Feb 2008
Old 05-09-2008 , 06:48   auto swap teams
Reply With Quote #1

hi, i checked something like 3 differents plugins of teams swapper, but none of them is doing what i need.
i want that after 15 round (end or first half in mr15 match), the teams will swap automaticlly and the server will do restart round.
and if it possible to do that the players won't be able to "chooseteam" for a clean teams switching.

10x, raz.
razaR is offline
NestleMilo
BANNED
Join Date: May 2008
Location: http://zombieplague.org
Old 05-09-2008 , 07:42   Re: auto swap teams
Reply With Quote #2

I used this for my "Zombie Swarm" server.

PHP Code:
#include <amxmodx>
#include <cstrike>
 
new round_countcvar_maxrounds
 
public plugin_init()
{
register_plugin("Auto Team Switcher""0.1""RazaR")
 
register_logevent("event_round_end"2"1=Round_End")
 
// hoy many rounds to be played before switching teams
cvar_maxrounds register_cvar("amx_maxrounds""15")
}
 
public 
event_round_end()
{
round_count++
 
if ( 
round_count >= get_pcvar_num(cvar_maxrounds) )
{
round_count 0
 
client_print
(0print_chat"[Zombie Swarm] Round limit reached, switching teams...")
 
for (new 
i=1i<=32i++)
{
if (!
is_user_connected(i))
continue;
 
if (
cs_get_user_team(i) == CS_TEAM_UNASSIGNED || cs_get_user_team(i) == CS_TEAM_SPECTATOR)
continue;
 
if (
cs_get_user_team(i) == CS_TEAM_T)
cs_set_user_team(iCS_TEAM_CT)
else
cs_set_user_team(iCS_TEAM_T)
 
}
}

Cvars
PHP Code:
amx_maxrounds 15 15 is default //# of rounds it takes to switch a team 
Changing the prefix of the mod goes as following:

PHP Code:
client_print(0print_chat"[Zombie Swarm] Round limit reached, switching teams..."
to

PHP Code:
client_print(0print_chat"[WHAT EVER YOU WANT] Round limit reached, switching teams..."

Last edited by NestleMilo; 05-09-2008 at 07:48.
NestleMilo is offline
razaR
Member
Join Date: Feb 2008
Old 05-09-2008 , 07:50   Re: auto swap teams
Reply With Quote #3

10q very much, i will check it later today, but one question:
who is the developer of this script? im sure it isn't me lol
Code:
register_plugin("Auto Team Switcher", "0.1", "RazaR")
edit: it's work almost perfectlly, the only thing is missing is RR right after the swapping.
please tell me what lines to add to the code and i'll do it myself.
10x again.

Last edited by razaR; 05-09-2008 at 08:32.
razaR is offline
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 05-09-2008 , 09:22   Re: auto swap teams
Reply With Quote #4

server_cmd("sv_restartround 1") ?
__________________
atomen is offline
Send a message via MSN to atomen
Sn!ff3r
Veteran Member
Join Date: Aug 2007
Location: Poland
Old 05-09-2008 , 09:45   Re: auto swap teams
Reply With Quote #5

Quote:
server_cmd("sv_restartround 1") ?
better than this is
PHP Code:
set_cvar_num("sv_restartround",1
Sn!ff3r is offline
Send a message via Skype™ to Sn!ff3r
razaR
Member
Join Date: Feb 2008
Old 05-09-2008 , 10:41   Re: auto swap teams
Reply With Quote #6

sorry, i know almost nothing about coding.
where i put that command? :S
razaR is offline
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 05-09-2008 , 10:57   Re: auto swap teams
Reply With Quote #7

Quote:
Originally Posted by Sn!ff3r View Post
better than this is
PHP Code:
set_cvar_num("sv_restartround",1
It is better with pcvar if you use that way.
Here is the script :
PHP Code:
#include <amxmodx>
#include <cstrike>

new round_countsv_restartround
new cvar_maxrounds

public plugin_init()
{
    
register_plugin("Auto Team Switcher""0.1""RazaR")
    
register_logevent("event_round_end"2"1=Round_End")

    
cvar_maxrounds    =    register_cvar("amx_maxrounds""15")
    
sv_restartround    =    get_cvar_pointer("sv_restartround")
}

public 
event_round_end()
{
    
round_count++
 
    if ( 
round_count >= get_pcvar_num(cvar_maxrounds) )
    {
        
round_count 0
        client_print
(0print_chat"[Zombie Swarm] Round limit reached, switching teams...")

        new 
numplayers[32]
        
get_players(playersnum"h")

        for (new 
0<= numi++)
        {
            if (!
is_user_connected(players[i]))
                continue

            if (
cs_get_user_team(players[i]) == CS_TEAM_UNASSIGNED || cs_get_user_team(players[i]) == CS_TEAM_SPECTATOR)
                continue

            if (
cs_get_user_team(players[i]) == CS_TEAM_T)
                
cs_set_user_team(players[i], CS_TEAM_CT)

            else
                
cs_set_user_team(players[i], CS_TEAM_T)

        }
        
set_pcvar_string(sv_restartround"1")
    }

__________________
atomen is offline
Send a message via MSN to atomen
razaR
Member
Join Date: Feb 2008
Old 05-09-2008 , 11:19   Re: auto swap teams
Reply With Quote #8

10x man!
edit: i have a problem.. i edited the .sma file and compiled and and uploaded it to the FTP and in the plugin list in server it tells me "bad load" and i dont know why..
please help me, i want that the plugin will the exactly what it do one, but with RR.

Last edited by razaR; 05-09-2008 at 14:34.
razaR is offline
NestleMilo
BANNED
Join Date: May 2008
Location: http://zombieplague.org
Old 05-09-2008 , 15:35   Re: auto swap teams
Reply With Quote #9

Quote:
Originally Posted by razaR View Post
10q very much, i will check it later today, but one question:
who is the developer of this script? im sure it isn't me lol
Code:
register_plugin("Auto Team Switcher", "0.1", "RazaR")
edit: it's work almost perfectlly, the only thing is missing is RR right after the swapping.
please tell me what lines to add to the code and i'll do it myself.
10x again.
I just made it with your name, don't be suprised.

Quote:
Originally Posted by razaR View Post
10x man!
edit: i have a problem.. i edited the .sma file and compiled and and uploaded it to the FTP and in the plugin list in server it tells me "bad load" and i dont know why..
please help me, i want that the plugin will the exactly what it do one, but with RR.
Are the correct moduals enabled? Check your server start up console or the error log and copy and paste it here. Make sure your cstrike modual is enabled in your moduals.ini file.

Last edited by NestleMilo; 05-09-2008 at 15:38.
NestleMilo is offline
razaR
Member
Join Date: Feb 2008
Old 05-10-2008 , 02:19   Re: auto swap teams
Reply With Quote #10

the plugin is bad load just when i change it to atomen script (he did some changes..), and the error is:
Code:
L 05/09/2008 - 17:28:21: [AMXX] Plugin "swap_teams.amxx" failed to load: Plugin uses an unknown function (name "set_pcvar_string") - check your modules.ini.
here is my modules list:
Code:
fun
;engine
;fakemeta
;geoip
;sockets
regex
;nvault
cstrike
csx
(sql are disabled..).

but your script (NestleMilo) work great, but without RR that i asked..
razaR 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 10:07.


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