[CSGO] Team Swapper

Release your plugins here!
silviogreuel
Junior Member
Posts: 6
Joined: Sat Jun 20, 2015 5:21 pm

[CSGO] Team Swapper

Postby silviogreuel » Wed Dec 28, 2016 11:57 pm

Swaps teams

Usage
Type in chat:
!ct
.ct
!t
.t
!spec
.spec
!swap
.swap

Install

Create a file in:
addons/source-python/plugins/swapper/swapper.py

Copy paste script to swapper.py

Load plugin adding sp plugin load swapper or type manualy on server console

Syntax: Select all

from commands.say import SayCommand

from players.helpers import playerinfo_from_index

from enum import Enum

from cvars.public import PublicConVar
from cvars import ConVarFlags
from plugins.info import PluginInfo

info = PluginInfo()
info.name = "Swapper"
info.author = "Silvio Greuel <silviogreuel@gmail.com>"
info.version = "1.0.0"
info.basename = "swapper"
info.variable = info.basename + "_version"
info.convar = PublicConVar(info.variable, info.version, info.name + " Version", ConVarFlags.NONE)

class TeamEnum(Enum):
un = 0
spec = 1
t = 2
ct = 3

@SayCommand(['.ct', '!ct'])
def swap_ct_cmd(command, playerindex, teamonly):
swap_to(playerindex, TeamEnum.ct)

@SayCommand(['.t', '!t'])
def swap_t_cmd(command, playerindex, teamonly):
swap_to(playerindex, TeamEnum.t)

@SayCommand(['.spec', '!spec'])
def swap_spec_cmd(command, playerindex, teamonly):
swap_to(playerindex, TeamEnum.spec)

@SayCommand(['.swap', '!swap'])
def swap_cmd(command, playerindex, teamonly):
swap(playerindex)

def swap_to(playerindex, team):
player = playerinfo_from_index(playerindex)
player.team = team.value

def swap(playerindex):
player = playerinfo_from_index(playerindex)
if TeamEnum.ct is TeamEnum(player.team):
swap_to(playerindex, TeamEnum.t)
elif TeamEnum.t is TeamEnum(player.team):
swap_to(TeamEnum.ct)

Return to “Plugin Releases”

Who is online

Users browsing this forum: No registered users and 2 guests