Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Autoteam #410

Merged
merged 2 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sourcemod/scripting/gbans.sp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <system2> // system2 extension

#include "gbans/auth.sp"
#include "gbans/balance.sp"
#include "gbans/ban.sp"
#include "gbans/commands.sp"
#include "gbans/common.sp"
Expand Down Expand Up @@ -55,6 +56,7 @@ public void onPluginStartCore()
gServerKey = CreateConVar("gb_core_server_key", "", "GBans server key used to authenticate with the service");

gHideConnections = CreateConVar("gb_hide_connections", "1", "Dont show the disconnect message to users", _, true, 0.0, true, 1.0);
gDisableAutoTeam = CreateConVar("gb_disable_autoteam", "1", "Dont allow the use of autoteam command", _, true, 0.0, true, 1.0);

AutoExecConfig(true, "gbans");

Expand All @@ -63,6 +65,7 @@ public void onPluginStartCore()
RegConsoleCmd("gb_mod", onCmdMod, "Ping a moderator");
RegConsoleCmd("mod", onCmdMod, "Ping a moderator");
RegConsoleCmd("report", onCmdReport, "Report a player");
RegConsoleCmd("autoteam", onCmdAutoTeamAction);

RegAdminCmd("gb_ban", onAdminCmdBan, ADMFLAG_BAN);
RegAdminCmd("gb_reauth", onAdminCmdReauth, ADMFLAG_ROOT);
Expand Down
29 changes: 29 additions & 0 deletions sourcemod/scripting/gbans/balance.sp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#pragma semicolon 1
#pragma tabsize 4
#pragma newdecls required

public Action onCmdAutoTeamAction(int clientId, int argc)
{
if (gDisableAutoTeam.BoolValue) {
KickClient(clientId, "Please stop trying to stack :(");

char auth_id[50];
if(!GetClientAuthId(clientId, AuthId_Steam3, auth_id, sizeof auth_id, true))
{
ReplyToCommand(clientId, "Failed to get auth_id of user: %d", clientId);
return Plugin_Continue;
}

char name[64];
if(!GetClientName(clientId, name, sizeof name))
{
gbLog("Failed to get user name?");
return Plugin_Continue;
}

gbLog("Autoteam blocked: %s [%s]", name, auth_id);
return Plugin_Handled;
}

return Plugin_Continue;
}
3 changes: 3 additions & 0 deletions sourcemod/scripting/gbans/globals.sp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ ConVar gHost = null;
ConVar gServerName = null;
ConVar gServerKey = null;

// Balancing options
ConVar gDisableAutoTeam = null;

// STV options
ConVar gTvEnabled = null;
ConVar gAutoRecord = null;
Expand Down