Melodyne добавил(а) новый ресурс:
Hide Slash - Скрытые сообщения со слешем типа say /кы
Нажмите на эту ссылку, чтобы узнать больше
Hide Slash - Скрытые сообщения со слешем типа say /кы
Нажмите на эту ссылку, чтобы узнать больше
#define PLUGIN_HANDLED_MAIN 2 /* to use in client_command(), continue all plugins but stop the command */
/**
* This plugin for AMXMODX is designed to hide commands that start with the character "/" or any other prefix specified.
* It intercepts messages sent to players and checks if the message starts with one of the prefixes defined in the `g_prefixes` array.
* If the message starts with one of these prefixes, the plugin blocks it from being sent.
*
* A key aspect of how this plugin works is that it blocks the final output (sending the message to the player), not the execution of the command on the server.
* As a result, it does not interfere with command handlers, such as plugins with /top15 and other similar commands.
* This means that the plugin can be placed anywhere in the plugins.ini list without causing any problems.
*
* Key features of the plugin:
* 1. Hides commands starting with the "/" character.
* 2. Uses the `g_prefixes` array to define prefixes to be blocked.
* 3. Provides the `amx_blockslashcmds` variable to enable/disable the locking function.
* 4. Intercepts messages using the `UserMsg_SayText` hook.
* 5. Blocks the final output of the message, not the execution of the command on the server.
**/
#include amxmodx
// Settings
static g_prefixes[][] = {
// "/top15",
// "/statsMe",
// "/rs",
"/",
}
static amx_blockslashcmds
public plugin_init() {
register_plugin("Hide `/` cmds", "1.0.0", "Dev-CS.ru")
register_message(get_user_msgid("SayText"), "UserMsg_SayText")
bind_pcvar_num(create_cvar("amx_blockslashcmds", "1"), amx_blockslashcmds)
}
public UserMsg_SayText(msgid, dest, receiver) {
if (amx_blockslashcmds <= 0)
return PLUGIN_CONTINUE
if (get_msg_args() < 4)
return PLUGIN_CONTINUE
static message[256]
get_msg_arg_string(4, message, charsmax(message))
for (new i; i < sizeof (g_prefixes); i++) {
new bool: substringFound = strncmp(
message, g_prefixes[i],
strlen(g_prefixes[i]),
.ignorecase = true
) == 0
if (substringFound)
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}