Thread: Auto Swap Team
View Single Post
Author Message
Experto
Member
Join Date: Jan 2008
Location: Brasil
Old 01-22-2011 , 23:23   Auto Swap Team
Reply With Quote #1

:: Description ::

This plugin does the automatic swap of teams according to the options selected.
While most of the plugins to exchange only works with teams setting number of rounds, with the Auto Swap Team is
can configure the automatic swap of five different ways. It also allows the restart of money, restart of deaths, restart of points
and restart the weapons according to the team. Furthermore it is possible to make admins immune, and play sounds and messages
warning to the players. Auto Swap Team also allows to add a normal player to the list of immunity. You can also choose the color of the messages.



:: Types of Swap ::

TIME (sm_autoswapteam_type = 1)
Half the time set in mp_timelimit.
Example:
mp_timelimit 40
The swap will take place after 20 minutes

NUMBER OF ROUNDS (sm_autoswapteam_type = 2)
In half of the value set in mp_maxrounds.
Example:
mp_maxrounds 30
The swap will take place after 15 rounds

NUMBER OF WINS (sm_autoswapteam_type = 3)
In half of the value set in mp_winlimit.
Example:
mp_winlimit 16
The swap will take place after one of the teams win 8 rounds

NUMBER OF FRAG (sm_autoswapteam_type = 4)
In half of the value set in mp_fraglimit.
Example:
mp_fraglimit 100
The swap will take place after a player reaches 50 frags

NO LIMIT (sm_autoswapteam_type = 5)
For servers type dust2 forever. You can use the Auto Swap Team to make unlimited swaps, without changing the map.
You must set how many rounds the swap should happen by the CVAR "sm_autoswapteam_maxround".
Example:
sm_autoswapteam_maxround 10
The swap will take always every 10 rounds



:: Commands ::

// Includes steam player to the list of immunity
//
// Values for <immunity>:
// 16 - SWAP
// 8 - WEAPON
// 4 - DEAD
// 2 - FRAG
// 1 - CASH
//
// To add immunity to more than one option sum their values
sm_autoswapteam_immunity_add <steamId> <immunity>

Example:
SWAP
sm_autoswapteam_immunity_add STEAM_0:12345 16
SWAP + DEAD = 16 + 4 = 20
sm_autoswapteam_immunity_add STEAM_0:12345 20
WEAPON + CASH = 8 + 1 = 9
sm_autoswapteam_immunity_add STEAM_0:12345 9


// Remove steam player from list of immunity
sm_autoswapteam_immunity_del <steamId>


// List steam player of the list of immunity
// If no STEAM is given, list all
sm_autoswapteam_immunity_list [steamId]



:: Options / CVar's ::

Config file created automatically: cfg/sourcemod/autoswapteam.cfg

OBS: The file autoswapteam.cfg is generated in Portuguese-BR. If you need the English version replace the contents of the file "cfg/sourcemod/autoswapteam.cfg" for the content of autoswapteamEN.txt available for download.

Code:
// This file was auto-generated by SourceMod (v1.3.7-dev)
// ConVars for plugin "autoswapteam.smx"
 
// Warning message before the swap? [0 = NO 1 = YES] 
// - 
// Default: "1" 
// Minimum: "0.000000" 
// Maximum: "1.000000" 
sm_autoswapteam_advert_alert "1" 
 
// Warning message in round? [0 = NO 1 = YES] 
// - 
// Default: "1" 
// Minimum: "0.000000" 
// Maximum: "1.000000" 
sm_autoswapteam_advert_round "1" 
 
// Warning message after the swap? [0 = NAO, 1 = SIM]
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
sm_autoswapteam_advert_swap "1"
 
// On / Off Auto Swap Team. [0 = OFF, 1 = On] 
// - 
// Default: "1" 
// Minimum: "0.000000" 
// Maximum: "1.000000" 
sm_autoswapteam_enable "1" 
 
// Reset the money of admins after swap? [0 = NO 1 = YES] 
// - 
// Default: "0" 
// Minimum: "0.000000" 
// Maximum: "1.000000" 
sm_autoswapteam_immune_cash "0" 
 
// Reset the Deaths of admins after the swap? [0 = NO 1 = YES] 
// - 
// Default: "0" 
// Minimum: "0.000000" 
// Maximum: "1.000000" 
sm_autoswapteam_immune_dead "0" 
 
// Reset the score of admins after the swap? [0 = NO 1 = YES] 
// - 
// Default: "0" 
// Minimum: "0.000000" 
// Maximum: "1.000000" 
sm_autoswapteam_immune_frag "0" 
 
// Admins are immune to Auto Swap? [0 = NO 1 = YES] 
// - 
// Default: "0" 
// Minimum: "0.000000" 
// Maximum: "1.000000" 
sm_autoswapteam_immune_swap "0" 
 
// Reset the Weapons of admins after the swap? [0 = NO 1 = YES] 
// - 
// Default: "0" 
// Minimum: "0.000000" 
// Maximum: "1.000000" 
sm_autoswapteam_immune_weapon "0"
 
// When sm_autoswapteam_type = 5. 
// Maximum number of rounds before the switch?
// -
// Default: "10"
// Minimum: "1.000000"
sm_autoswapteam_maxround "10"
 
// Play sound alert? [0 = NO 1 = YES] 
// - 
// Default: "1" 
// Minimum: "0.000000" 
// Maximum: "1.000000" 
sm_autoswapteam_playsound "1"
 
// Reset the money after swap? [0 = NO 1 = YES] 
// - 
// Default: "1" 
// Minimum: "0.000000" 
// Maximum: "1.000000" 
sm_autoswapteam_resetcash "0" 
 
// Reset the Deaths after swap? [0 = NO 1 = YES] 
// - 
// Default: "1" 
// Minimum: "0.000000" 
// Maximum: "1.000000" 
sm_autoswapteam_resetdead "0" 
 
// Reset Frag after swap? [0 = NO 1 = YES] 
// - 
// Default: "1" 
// Minimum: "0.000000" 
// Maximum: "1.000000" 
sm_autoswapteam_resetfrag "0" 
 
// Reset Weapons after swap? [0 = NO 1 = YES] 
// - 
// Default: "1" 
// Minimum: "0.000000" 
// Maximum: "1.000000" 
sm_autoswapteam_resetweapon "0" 
 
// Play sound alert before the swap? [0 = NAO, 1 = SIM]
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
sm_autoswapteam_salert "1"
 
// Define action for the score. [0 = KEEP, 1 = RESET, 2 = SWAP] 
// - 
// Default: "2" 
// Minimum: "0.000000" 
// Maximum: "1.000000" 
sm_autoswapteam_scoretype "2" 
 
// Address of the sound file - Alert
// -
// Default: "buttons/bell1.wav"
sm_autoswapteam_sfile_alert "buttons/bell1.wav"
 
// Address of the sound file - Round
// -
// Default: "hostage/huse/okletsgo.wav"
sm_autoswapteam_sfile_round "hostage/huse/okletsgo.wav"
 
// Address of the sound file - Swap
// -
// Default: "ambient/misc/brass_bell_C.wav"
sm_autoswapteam_sfile_swap "ambient/misc/brass_bell_C.wav"
 
// Play sound round? [0 = NAO, 1 = SIM]
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
sm_autoswapteam_sround "1"
 
// Play sound after swap? [0 = NAO, 1 = SIM]
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
sm_autoswapteam_sswap "1"
 
// Sets the type of Auto Swap. [1 = TIME, 2 = NUMBER OF ROUNDS, 3 = NUMBER OF WINS, 4 = NUMBER OF FRAG, 5 = NO LIMITS] 
// - 
// Default: "1" 
// Minimum: "1.000000" 
// Maximum: "5.000000" 
sm_autoswapteam_type "1"


:: Languages ::

Languages included in the file autoswapteam.phrases.txt:

-Português-BR (PT)
-English (EN)

To translate the messages into your language, simply add them to file "addons/SourceMod/translations/autoswapteam.phrases.txt".

For example, adding messages in Spanish:

Quote:
"advert_time"
{
"#format" "{1:d}"
"pt" "ATENCAO: Os times serao trocados apos {1} min!"
"en" "WARNING: The teams will be exchanged after {1} minutes!"
"es" "ADVERTENCIA: Los equipos se intercambiaron después de {1} min!"
}

"advert_will_swap"
{
"pt" "ATENCAO: Os Times serao trocados ao final desta rodada!"
"en" "WARNING: The teams will be exchanged at the end of this round!"
"es" "ADVERTENCIA: El Times se intercambiaron al final de esta ronda!"
}
But beware, do not delete words in brackets - {1} - or lines of formatting - "#format" "{1:d}" - , because the plugin may not work.

Quote:
"advert_time"
{
"#format" "{1:d}"
"pt" "ATENCAO: Os times serao trocados apos {1} min!"
"en" "WARNING: The teams will be exchanged after {1} minutes!"
"es" "ADVERTENCIA: Los equipos se intercambiaron después de {1} min!"
}
To find out the possible languages open the file "addons/SourceMod/configs/languages.cfg".
The active language is defined in the file "addons/SourceMod/configs/core.cfg" on "ServerLang" "en"



:: Colored messages ::


You can also choose the color of the messages. The colors available are:

Regular colors: default, green, olive.
Team colors: lightgreen, red, blue.

Coloring the messages simply add the tags before of message in the file autoswapteam.phrases.txt

Tags: {default}, {green}, {lightgreen}, {red}, {blue}, {olive}

For example, messages in light green:

ATENCAO: Os times serao trocados apos 10 min!
WARNING: The teams will be exchanged after 10 minutes!
Quote:
"advert_time"
{
"#format" "{1:d}"
"pt" "{lightgreen}ATENCAO: Os times serao trocados apos {1} min!"
"en" "{lightgreen}WARNING: The teams will be exchanged after {1} minutes!"
}
Mixed colors:

ATENCAO: Os times serao trocados apos 10 min!
WARNING: The teams will be exchanged after 10 minutes!
Quote:
"advert_time"
{
"#format" "{1:d}"
"pt" "{green}ATENCAO: {lightgreen}Os times serao trocados apos {green}{1} min!"
"en" "{green}WARNING: {lightgreen}The teams will be exchanged after {green}{1} minutes!"
}


:: Change log ::

>> 2.2.1 - 09-04-2011
- Resolved problem precache of sounds that are not standard game

>> 2.2.0 - 07-09-2011
- Add options to turn sounds on or off individually
- Add options to turn adverts on or off individually

>> 2.1.3 - 06-25-2011
- Add swap the bots
- Add three different sounds:
(1) Sound alert on how many rounds are left
(2) Sound to warn it will be exchanged at the end of the round
(3) Sound warning that the teams were switched

>> 2.1.2 - 04-17-2011
- Correction of the score when the score is zero (sm_autoswapteam_scoretype "1")

>> 2.1.1 - 03-28-2011
- Added color library to be used in the translation file
- Fixed wrong count

>> 2.1.0 - 03-12-2011
- New option (sm_autoswapteam_type = 5). For servers type dust2 forever, never change the map. Now you can use the Auto Swap Team to make unlimited swaps.
- Fix small bug, that caused the swap to be performed in the round wrong.

>> 2.0.3 - 02-14-2011
- Reimplement the code that resets the weapons.

>> 2.0.2 - 02-13-2011
- Fix a small bug. In the first round after the swap, the c4 disappeared, when sm_autoswapteam_resetweapon = "1".

>> 2.0.1 - 02-05-2011
- Fix a small bug. The bug was causing the reset the data of the admins, even though the options were turned off.

>> 2.0.0 - 02-02-2011
- Creation of the list of immunity for normal players

>> 1.0.1 - 01-26-2011
- Fixed the scoreboard after the exchange of teams
- Added more configuration options of immunity to the admins

>> 1.0.0 - 01-22-2011
- Release of the plugin

-This plugin was based on plugins "Swap Team" (see 1.0.0) and "CSS Auto Swap Teams" (see 2.3.1).
-Colors Details on http://forums.alliedmods.net/showthread.php?t=96831.



:: Installation ::

- Copy the file "autoswapteam.smx" to the folder "addons/SourceMod/plugins/"
- Copy the file "autoswapteam.phrases.txt" to the folder "addons/SourceMod/translations/"



:: Upgrading ::

- Run the command: sm plugins unload autoswapteam
- Delete the file: "cfg/sourcemod/autoswapteam.cfg"

- Copy the file "autoswapteam.smx" to the folder "addons/SourceMod/plugins/"
- Copy the file "autoswapteam.phrases.txt" to the folder "addons/SourceMod/translations/"
- Run the command: sm plugins load autoswapteam
or restart the server



:: Downloads ::
Attached Files
File Type: txt autoswapteam.phrases.txt (1.8 KB, 1780 views)
File Type: txt autoswapteamEN.txt (3.8 KB, 1478 views)
File Type: zip autoswapteam2.2.1.zip (25.0 KB, 3737 views)
File Type: sp Get Plugin or Get Source (autoswapteam.sp - 1157 views - 25.9 KB)
__________________
My Plugins:
-IP Block: This plugin block the entry in the server of players with same IP. Too is possible to config exceptions for some IPs
-Auto Swap Team: This plugin does the automatic swap of teams according to the options selected
-Welcome Sound: Plays sound of welcome for the players

Last edited by Experto; 09-04-2011 at 21:30. Reason: new version 2.2.1
Experto is offline