Запрет команд: ping,kill,status и тд  [На сервере]

Плагины и дополнения / Plugins and add-ons

Модераторы: Dame-danners, Longipongeoos

Аватар пользователя
Longipongeoos
Сообщений: 191
Зарегистрирован: 12 апр 2017, 16:50

Запрет команд: ping,kill,status и тд

Сообщение Longipongeoos » 10 ноя 2021, 15:45

Плагин,который возможно кому то пригодиться: запрещает игрокам использовать следующие команды в консоли:

Код: Выбрать все

kill
killvector
explode
explodevector
ping
status

При попытке использовать эти команды - игрок получит сообщение, о том что они запрещены
CVARS

Код: Выбрать все

z_join_message  1/0 - оповещать игроков,при подключении к серверу, о том что плагин активен
Вложения
Block kill explode ping status.zip
(43.1 KiB) Загружено 94 раз

Аватар пользователя
Longipongeoos
Сообщений: 191
Зарегистрирован: 12 апр 2017, 16:50

Re: Запрет команд: ping,kill,status и тд  [На сервере]

Сообщение Longipongeoos » 29 ноя 2021, 15:31

Версия 07.09.2021 (v1.3)
Настройки:

Код: Выбрать все

• sm_blockkillexplode_chat_prefix - чат Приставка
• sm_blockkillexplode_join_message - включить / отключить сообщениекогда Игрок Join (1 - Включить | 0 - Отключить)
• sm_blockkillexplodepingstatus_kill_message - Включить / Выключить Сообщение при присоединении игрока (1 - включить | 0 - отключить)
• sm_blockkillexplodepingstatus_explode_message - Включение / отключение сообщения при присоединении игрока (1 - включить | 0 - отключить)

Исходный код

Код: Выбрать все

#include <sourcemod>
#include <multicolors>
#include <autoexecconfig>

#pragma newdecls required
#pragma semicolon 1

char g_ChatPrefix[256];
ConVar gConVar_Chat_Prefix;

ConVar gConVar_JoinMsg;

ConVar gConVar_Explode_Message;
ConVar gConVar_Kill_Message;

public Plugin myinfo =
{
   name = "Block Kill, Explode, Ping and Status",
   author = "LanteJoula",
   description = "Block kill and explode commands on console",
   version = "1.3",
   url = "http://steamcommunity.com/id/lantejoula"
};

public void OnPluginStart()
{
   LoadTranslations("blockkillexplodepingstatus.phrases");
   
   RegConsoleCmd("kill", Cmd_Kill);
   RegConsoleCmd("killvector", Cmd_Kill);
   
   RegConsoleCmd("explode", Cmd_Explode);
   RegConsoleCmd("explodevector", Cmd_Explode);
   
   RegConsoleCmd("status", block);
   RegConsoleCmd("ping", block);
   
   AutoExecConfig_SetFile("plugin.blockkillexplodepingstatus");
   
   gConVar_Chat_Prefix = AutoExecConfig_CreateConVar("sm_blockkillexplodepingstatus_chat_prefix", "[{green}TAG{default}]", "Chat Prefix");
   
   gConVar_JoinMsg = AutoExecConfig_CreateConVar("sm_blockkillexplodepingstatus_join_message", "1", "Enable/Disable the Message when Player Join (1 - Enable | 0 - Disable)", 0, true, 0.0, true, 1.0);
   
   gConVar_Kill_Message = AutoExecConfig_CreateConVar("sm_blockkillexplodepingstatus_kill_message", "1", "Enable/Disable the Message when Player Join (1 - Enable | 0 - Disable)", 0, true, 0.0, true, 1.0);
   gConVar_Explode_Message = AutoExecConfig_CreateConVar("sm_blockkillexplodepingstatus_explode_message", "1", "Enable/Disable the Message when Player Join (1 - Enable | 0 - Disable)", 0, true, 0.0, true, 1.0);
   
   AutoExecConfig_ExecuteFile();
   AutoExecConfig_CleanFile();
   
   gConVar_Chat_Prefix.AddChangeHook(OnPrefixChange);
}

//Prefix

public void SavePrefix()
{
   GetConVarString(gConVar_Chat_Prefix, g_ChatPrefix, sizeof(g_ChatPrefix));
}

public void OnConfigsExecuted()
{
   SavePrefix();
}

public void OnPrefixChange(ConVar cvar, char[] oldvalue, char[] newvalue)
{
   SavePrefix();
}

//PLUGIN

public Action Cmd_Kill(int client, int args)
{
   if (gConVar_Kill_Message.BoolValue)
      CPrintToChat(client, "%s %t", g_ChatPrefix, "You dont have access for kill");
   
   return Plugin_Handled;
}

public Action Cmd_Explode(int client, int args)
{
   if (gConVar_Explode_Message.BoolValue)
      CPrintToChat(client, "%s %t", g_ChatPrefix, "You dont have access for explode");
   
   return Plugin_Handled;
}

public Action block(int client, int args)
{
   if (!(0 < client <= MaxClients) || !(GetUserFlagBits(client) & ADMFLAG_GENERIC))
   {
      return Plugin_Stop;
   }
   return Plugin_Continue;
}

///////////////////
//AUTO JOIN MESSAGE
///////////////////

public void OnClientPutInServer(int client)
{
   CreateTimer(5.0, JoinMsg, client);
}

public Action JoinMsg(Handle timer, any client)
{
   if (gConVar_JoinMsg.BoolValue)
      CPrintToChat(client, "%s %t", g_ChatPrefix, "JoinMsg");
}


Отправлено спустя 46 минуты 54 секунды:
Перевод на русский

Код: Выбрать все

// Colors available for use in Chat
// {default}, {red}, {lightred}, {darkred}, {bluegrey}, {blue}, {darkblue}, {purple}, {yellow}, {gold}, {lightgreen}, {green}, {lime}, {grey}, {grey2}

// Cores disponíveis para usar no Chat
// {default}, {red}, {lightred}, {darkred}, {bluegrey}, {blue}, {darkblue}, {purple}, {yellow}, {gold}, {lightgreen}, {green}, {lime}, {grey}, {grey2}
"Phrases"
{
   "You dont have access for kill"
   {
      "en"         "{default}You are not allowed to kill {green}yourself{default}!"
      "pt"         "{default}Não tens Permissão para te {green}Matares{default}!"
      "pt_p"         "{default}Não tens Permissão para te {green}Matares{default}!"
      "ru"            "{default}Вам не разрешено совершать самоубийство {green}yourself{default}!"
   }

   "You dont have access for explode"
   {
      "en"         "{default}You are not allowed to explode {green}yourself{default}!"
      "pt"         "{default}Não tens Permissão para te {green}Explodires{default}!"
      "pt_p"         "{default}Não tens Permissão para te {green}Explodires{default}!"
      "ru"            "{default}Вам не разрешено использовать данную команду {green}yourself{default}!"
   }

   "JoinMsg"
   {
      "en"         "This {green}Server {default}does not Sllow {green}Suicide {default}through the {green}Console{default}!"
      "pt"         "Este {green}Servidor {default}não Permite o {green}Suicídio {default}através da {green}Consola{default}!"
      "pt_p"         "Este {green}Servidor {default}não Permite o {green}Suicídio {default}através da {green}Consola{default}!"
      "ru"            "{green}Сервер {default} блокирует определенные команды в консоле, такие как килл {default}!"
   }
}
Вложения
Block kill explode ping status 1.3.zip
(35.71 KiB) Загружено 120 раз


Вернуться в «SourceMod»

Кто сейчас на форуме

Количество пользователей, которые сейчас просматривают этот форум: нет зарегистрированных пользователей и 1 гость