Участник
Пользователь
- Сообщения
- 371
- Реакции
- 5
- Помог
- 1 раз(а)
Код, который включает/отключает чат
#include <amxmodx>
new bool:chat_blocked[33]; // Array for chat status (1-32 players)
// Define Admin Check
#define is_user_admin(%1) ((get_user_flags(%1) & ADMIN_IMMUNITY) != 0)
// Plugin Initialization
public plugin_init()
{
register_plugin("Chat Control", "1.0", "test");
// Commands for chat control
register_clcmd("say /chatoff", "cmd_chat_off");
register_clcmd("say /chaton", "cmd_chat_on");
}
// Command: /chatoff (Admin Only)
public cmd_chat_off(id)
{
if (!is_user_admin(id)) // Check if the user is an admin
{
client_print(id, print_chat, "[Chat Control] You are not authorized to block the chat.");
return PLUGIN_HANDLED;
}
for (new i = 1; i <= 32; i++)
{
chat_blocked = true; // Block chat for all players
}
client_print(0, print_chat, "[Chat Control] Chat has been BLOCKED by an admin.");
return PLUGIN_HANDLED;
}
// Command: /chaton (Admin Only)
public cmd_chat_on(id)
{
if (!is_user_admin(id)) // Check if the user is an admin
{
client_print(id, print_chat, "[Chat Control] You are not authorized to unblock the chat.");
return PLUGIN_HANDLED;
}
for (new i = 1; i <= 32; i++)
{
chat_blocked = false; // Unblock chat for all players
}
client_print(0, print_chat, "[Chat Control] Chat has been UNBLOCKED by an admin.");
return PLUGIN_HANDLED;
}
// Hook Say Command to Block Chat
public client_command(id)
{
// Check if chat is blocked for this player
if (chat_blocked[id])
{
client_print(id, print_chat, "[Chat Control] Chat is currently disabled!");
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE; // Allow chat if not blocked
}
#include <amxmodx>
new bool:chat_blocked[33]; // Array for chat status (1-32 players)
// Define Admin Check
#define is_user_admin(%1) ((get_user_flags(%1) & ADMIN_IMMUNITY) != 0)
// Plugin Initialization
public plugin_init()
{
register_plugin("Chat Control", "1.0", "test");
// Commands for chat control
register_clcmd("say /chatoff", "cmd_chat_off");
register_clcmd("say /chaton", "cmd_chat_on");
}
// Command: /chatoff (Admin Only)
public cmd_chat_off(id)
{
if (!is_user_admin(id)) // Check if the user is an admin
{
client_print(id, print_chat, "[Chat Control] You are not authorized to block the chat.");
return PLUGIN_HANDLED;
}
for (new i = 1; i <= 32; i++)
{
chat_blocked = true; // Block chat for all players
}
client_print(0, print_chat, "[Chat Control] Chat has been BLOCKED by an admin.");
return PLUGIN_HANDLED;
}
// Command: /chaton (Admin Only)
public cmd_chat_on(id)
{
if (!is_user_admin(id)) // Check if the user is an admin
{
client_print(id, print_chat, "[Chat Control] You are not authorized to unblock the chat.");
return PLUGIN_HANDLED;
}
for (new i = 1; i <= 32; i++)
{
chat_blocked = false; // Unblock chat for all players
}
client_print(0, print_chat, "[Chat Control] Chat has been UNBLOCKED by an admin.");
return PLUGIN_HANDLED;
}
// Hook Say Command to Block Chat
public client_command(id)
{
// Check if chat is blocked for this player
if (chat_blocked[id])
{
client_print(id, print_chat, "[Chat Control] Chat is currently disabled!");
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE; // Allow chat if not blocked
}