If you want to lock spectators for EVERYONE (including admins) see if your game has a cvar already made for that. (mp_spectators_max, mp_allowspectators, etc.)
ABOUT:
Basically, I formed this plugin based off of a request that I saw in the "Plugin Requests" section of this forum. After looking around I saw that there wasn't a publicly available plugin that does this (possibly because its so simple), but not everyone knows how to make SourceMod plugins so this is for them!
INSTALLATION:
To install, simply download the newest version of the .smx file and place it into your /plugins/ folder.
SOURCE CODE:
Spoiler
PHP Code:
#include <sourcemod>
#define PLUGIN_VERSION "1.1"
#pragma semicolon 1 #pragma newdecls required
ConVar g_cvAllowAdmins;
public Plugin myinfo = { name = "[ANY] Block Specatator", author = "Headline", description = "Makes the spectator team unjoinable.", version = PLUGIN_VERSION, url = "http://www.michaelwflaherty.com" };
AddCommandListener(Command_JoinTeam, "jointeam"); // Hook Join Team }
public Action Command_JoinTeam(int client, char[] command, int args) { char sTeamName[8]; GetCmdArg(1, sTeamName, sizeof(sTeamName)) ;// Get Team Name int iTeam = StringToInt(sTeamName); if (iTeam == 1) // Spectator { if (CheckCommandAccess(client, "sm_fake_command", ADMFLAG_GENERIC, true) && g_cvAllowAdmins.BoolValue) { return Plugin_Continue; } else { PrintToChat(client, "[SM] The server operator has blocked this team!"); return Plugin_Handled; // Block it. } } else // If not spectator { return Plugin_Continue; // Allow } }
CVARS:
Code:
hl_blockspec_allow_admins - "1" - Allow admins to pass the spectator block?
DONATE:
If you feel that I have done a good job, please consider supporting me.
If you want to lock spectators for EVERYONE (including admins) see if your game has a cvar already made for that. (mp_spectators_max, mp_allowspectators, etc.)
ABOUT:
Basically, I formed this plugin based off of a request that I saw in the "Plugin Requests" section of this forum. After looking around I saw that there wasn't a publicly available plugin that does this (possibly because its so simple), but not everyone knows how to make SourceMod plugins so this is for them!
INSTALLATION:
To install, simply download the newest version of the .smx file and place it into your /plugins/ folder.
SOURCE CODE:
Spoiler
PHP Code:
#include <sourcemod>
#define PLUGIN_VERSION "1.1"
#pragma semicolon 1 #pragma newdecls required
ConVar g_cvAllowAdmins;
public Plugin myinfo = { name = "[ANY] Block Specatator", author = "Headline", description = "Makes the spectator team unjoinable.", version = PLUGIN_VERSION, url = "http://www.michaelwflaherty.com" };
AddCommandListener(Command_JoinTeam, "jointeam"); // Hook Join Team }
public Action Command_JoinTeam(int client, char[] command, int args) { char sTeamName[8]; GetCmdArg(1, sTeamName, sizeof(sTeamName)) ;// Get Team Name int iTeam = StringToInt(sTeamName); if (iTeam == 1) // Spectator { if (CheckCommandAccess(client, "sm_fake_command", ADMFLAG_GENERIC, true) && g_cvAllowAdmins.BoolValue) { return Plugin_Continue; } else { PrintToChat(client, "[SM] The server operator has blocked this team!"); return Plugin_Handled; // Block it. } } else // If not spectator { return Plugin_Continue; // Allow } }
CVARS:
Code:
hl_blockspec_allow_admins - "1" - Allow admins to pass the spectator block?
DONATE:
If you feel that I have done a good job, please consider supporting me.
Thanks!
Excelent Plugin!!!!!But,i have a request,can you incorporate to this plugin,a funcionallity to redirect specters to SourceTv please?