-
-
Save Technoblazed/a506dedce01d188a1dced5fcd0d2866a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sourcemod> | |
bool bChatDisabled; | |
public Plugin myinfo = | |
{ | |
name = "toggle chat", | |
author = "91346706501435897134", | |
description = "allows admins to disable/enable the chat", | |
version = "1.0", | |
} | |
public void OnPluginStart() | |
{ | |
RegAdminCmd("sm_togglechat", Command_ToggleChat, ADMFLAG_CHAT, "disable/enable the chat"); | |
} | |
public Action Command_ToggleChat(int client, int args) | |
{ | |
if (bChatDisabled) | |
{ | |
bChatDisabled = false; | |
ReplyToCommand(client, ">> Chat is now disabled."); | |
PrintToChatAll(">> %N disabled the chat!", client); | |
} | |
else | |
{ | |
bChatDisabled = true; | |
ReplyToCommand(client, ">> Chat is now enabled."); | |
PrintToChatAll(">> %N enabled the chat!", client); | |
} | |
return Plugin_Handled; | |
} | |
public Action OnClientSayCommand(int client, const char[] command, const char[] args) | |
{ | |
if (client != 0 && (StrEqual(command, "say") || StrEqual(command, "say_team")) && bChatDisabled) | |
{ | |
PrintToChat(client, ">> Chat is currently disabled!"); | |
return Plugin_Handled; | |
} | |
return Plugin_Continue; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment