Skip to content
This repository has been archived by the owner on Nov 2, 2018. It is now read-only.

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
Bara committed Aug 29, 2015
0 parents commit 0afdb43
Show file tree
Hide file tree
Showing 19 changed files with 2,671 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# 1.0.0
- Initial release
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

63 changes: 63 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
[CS:S/CS:GO] TeamBans [![build status](http://ci.git.tf/projects/2/status.png?ref=master)](http://ci.git.tf/projects/2?ref=master)
---
[TeamBans on Git.TF](http://git.tf/Bara/TeamBans)

### Short description
With TeamBans you can ban players from a team. CT and T ban aren't supported (but planned)

### Supported Games
* Counter-Strike: Source (partially tested)
* Counter-Strike: Global Offensive (untested)

### Features
* Public player list with banned players with informations about her bans
* Per player is only 1 team ban allowed
* Instant move on/after ban
* No Glitch Bug
* MySQL Support
* Adminmenu Support
* Custom reasons
* Custom lengths

### CVars
* teambans_enable_debug
* Default value: "1"
* More log actions
* If this cvar 1, then I can give more/better support
* teambans_plugin_tag
* (CSS) Default value: "{strange}[TeamBans] {grey}"
* (CSGO) Default value: "{green}[TeamBans] {default}"
* Tag for the most chat messages
* 2 different default values for better css and csgo support
* teambans_log_level
* Default value: "2"
* 0 - Trace, 1 - Debug, 2 - Default, 3 - Info, 4 - Warning, 5 - Error
* Own folders in log directory
* teambans_player_checks
* Default value: "3.0"
* Interval per player check (required for no glitch bug)
* teambans_default_ban_length
* Default value: "30"
* Default ban length for a ban without length
* teambans_default_ban_reason
* Default value: "DefaultReason"
* Default ban reason for a ban without reason

### Player Commands
* sm_teambans

### Admin Commands
* sm_ctban
* sm_ctunban
* sm_tban
* sm_tunban

### Requirement
* SourceMod 1.7.0+
* Multi Colors 2.0.0+ (only for compile)

### Installation
* Upload both config files (configs/teambans/reasons.cfg + configs/teambans/reasons.cfg)
* Upload translation file (CSS: translations/teambans.css.phrases.txt and CSGO: translations/teambans.csgo.phrases.txt)
* Add config entry "teambans" in configs/databases.cfg
* Upload binary file (plugins/teambans.smx) or compile for yourself
10 changes: 10 additions & 0 deletions configs/teambans/length.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"length"
{
"0" "Permanent"
"10" "10 Minutes"
"30" "30 Minutes"
"60" "1 Hour"
"240" "4 Hours"
"1440" "1 Day"
"10080" "1 Week"
}
9 changes: 9 additions & 0 deletions configs/teambans/reasons.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"reasons"
{
"1" "Freekiller"
"2" "Abusing"
"3" "General cheating/exploits"
"4" "Admin disrespect"
"5" "Camping"
"6" "Team killing"
}
Binary file added plugins/teambans.smx
Binary file not shown.
111 changes: 111 additions & 0 deletions scripting/teambans.sp
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#pragma semicolon 1

// Core
#include <sourcemod>
#include <cstrike>
#include <adminmenu>
#include <topmenus>

#pragma newdecls required

// Includes
#include <multicolors>

// Include all .sp-files from teambans-folder
#include "teambans/globals.sp"
#include "teambans/log.sp"
#include "teambans/cvars.sp"
#include "teambans/stocks.sp"
#include "teambans/commands.sp"
#include "teambans/functions.sp"
#include "teambans/timer.sp"
#include "teambans/callbacks.sp"
#include "teambans/sql.sp"
#include "teambans/adminmenu.sp"

public Plugin myinfo =
{
name = PLUGIN_NAME,
author = PLUGIN_AUTHOR,
version = PLUGIN_VERSION,
description = PLUGIN_DESCRIPTION,
url = PLUGIN_URL
};

public void OnPluginStart()
{
if(GetEngineVersion() != Engine_CSS && GetEngineVersion() != Engine_CSGO)
{
TB_LogFile(ERROR, "Only CS:S/CS:GO support");
SetFailState("Only CS:S/CS:GO support");
return;
}

BuildPath(Path_SM, g_sReasonsPath, sizeof(g_sReasonsPath), "configs/teambans/reasons.cfg");
CheckReasonsFile();

BuildPath(Path_SM, g_sLengthPath, sizeof(g_sLengthPath), "configs/teambans/length.cfg");
CheckLengthFile();

SQL_OnPluginStart();
Cvar_OnPluginStart();

RegConsoleCmd("sm_teambans", Command_TeamBans);

RegAdminCmd("sm_ctban", Command_SetCTBan, ADMFLAG_BAN);
RegAdminCmd("sm_tban", Command_SetTBan, ADMFLAG_BAN);

RegAdminCmd("sm_ctunban", Command_DelCTBan, ADMFLAG_BAN);
RegAdminCmd("sm_tunban", Command_DelTBan, ADMFLAG_BAN);

AddCommandListener(Command_JoinTeam, "jointeam");

HookEvent("player_spawn", Event_PlayerSpawn);

if(GetEngineVersion() == Engine_CSGO)
LoadTranslations("teambans.csgo.phrases");
else if(GetEngineVersion() == Engine_CSS)
LoadTranslations("teambans.css.phrases");

LoadTranslations("common.phrases");

CheckAllClients();

}

public void OnMapStart()
{
CheckReasonsFile();
CheckLengthFile();
}

public void OnClientConnected(int client)
{
ResetVars(client);
}

public void OnClientDisconnect(int client)
{
ResetVars(client);
}

public void OnClientAuthorized(int client, const char[] auth)
{
g_iPlayer[client][clientAuth] = true;
g_iPlayer[client][clientID] = client;

if (g_dDB == null)
return;

CheckTeamBans(client);
}

public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));

if (!IsClientValid(client) || !g_iPlayer[client][clientReady])
return;

IsAndMoveClient(client);
}

0 comments on commit 0afdb43

Please sign in to comment.