PrivateMessage v1.0 by CrAsH

Shadowless

Пользователь
Регистрация
24 Фев 2019
Сообщения
193
Симпатии
4
Пол
Мужской
#1
Hello...
please help it does not work :(

C++:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#define PLUGIN    "PrivateMessage"
#define VERSION    "1.0"
#define AUTHOR    "CrAsH"
new szPlayerPM[33]
new szPlayerPMBlockAll[33]
new szPlayerPMBlock[33][33]
static const g_Sound[] = "pm/sms.wav"
public plugin_init() 
{
   register_plugin(PLUGIN, VERSION, AUTHOR)
   register_clcmd("say /pm", "MainMenu")
   register_clcmd("say_team /pm", "MainMenu")
   register_clcmd("pm", "PMessage")
   register_dictionary("pm.txt")
}
public plugin_precache() 
{
   precache_sound( g_Sound )
}
public MainMenu(id)
{
   new szTitle[512]
   new szItem[512]
   formatex(szTitle, charsmax( szTitle ), "%L", id, "PM_MAINMENU_TITLE")
   new szMenu = menu_create(szTitle, "MainMenu_handler" )
   formatex(szItem, charsmax( szItem ), "%L", id, "PM_MAINMENU_ITEM_1")
   menu_additem(szMenu, szItem, "1", 0 )
   formatex(szItem, charsmax( szItem ), "%L", id, "PM_MAINMENU_ITEM_2")
   menu_additem(szMenu, szItem, "2", 0 )
   menu_setprop(szMenu, MPROP_EXIT, MEXIT_ALL )
   menu_setprop(szMenu, MPROP_NEXTNAME, "Далее")
   menu_setprop(szMenu, MPROP_BACKNAME, "Назад")
   menu_setprop(szMenu, MPROP_EXITNAME, "Выход")
   menu_display(id, szMenu, 0)
   return PLUGIN_HANDLED
}
public MainMenu_handler(id, szMenu, szItem)
{
   if(szItem == MENU_EXIT)
   {
      menu_destroy( szMenu )
      return PLUGIN_HANDLED
   }
   new szData[6], szName[64], szAccess, szCallback
   menu_item_getinfo(szMenu, szItem, szAccess, szData, charsmax( szData ), szName, charsmax( szName ), szCallback)
   new szKey = str_to_num( szData )
   switch( szKey )
   {
      case 1:
      {
         PlayerMenu(id)
      }
      case 2:
      {
         BlockMenu(id)
      }
   }
   menu_destroy( szMenu )
   return PLUGIN_HANDLED
}
public PlayerMenu(id)
{
   new szTitle[512]
   new szItem[512]
   formatex(szTitle, charsmax( szTitle ), "%L", id, "PM_PLAYERMENU_TITLE")
   new szMenu = menu_create(szTitle, "PlayerMenu_handler")
   new szPlayers[32]
   new szPlayer, szNum
   new szName[32], szPlayerNum[10]
   get_players(szPlayers, szNum)
        for(new i; i < szNum; i++)
        {
      szPlayer = szPlayers[i]
      if(szPlayer == id || is_user_bot(szPlayer) || !is_user_connected(szPlayer) || is_user_hltv(szPlayer))
         continue
                get_user_name(szPlayer, szName, charsmax( szName ))
                num_to_str(szPlayer, szPlayerNum, charsmax( szPlayerNum ))
      if(szPlayerPMBlock[szPlayer][id])
      {
         formatex(szItem, charsmax( szItem ), "%L", id, "PM_PLAYERMENU_BLOCKED", szName)
         menu_additem(szMenu, szItem, szPlayerNum, ADMIN_ADMIN)
      }else
      if(szPlayerPMBlockAll[szPlayer])
      {
         formatex(szItem, charsmax( szItem ), "%L", id, "PM_PLAYERMENU_BLOCKED", szName)
         menu_additem(szMenu, szItem, szPlayerNum, ADMIN_ADMIN)
      }else{
         menu_additem(szMenu, szName, szPlayerNum, 0)
      }
        }
   menu_setprop(szMenu, MPROP_EXIT, MEXIT_ALL )
   menu_setprop(szMenu, MPROP_NEXTNAME, "Далее")
   menu_setprop(szMenu, MPROP_BACKNAME, "Назад")
   menu_setprop(szMenu, MPROP_EXITNAME, "Выход")
   menu_display(id, szMenu, 0)
   return PLUGIN_HANDLED
}
public PlayerMenu_handler(id, szMenu, szItem)
{
   if(szItem == MENU_EXIT)
   {
      menu_destroy( szMenu )
      return PLUGIN_HANDLED
   }
   new szData[6], szName[64], szAccess, szCallback
   menu_item_getinfo(szMenu, szItem, szAccess, szData, charsmax( szData ), szName, charsmax( szName ), szCallback)
   new szPlayer = str_to_num( szData )
   szPlayerPM[id] = szPlayer
   client_cmd(id, "messagemode pm")
   ChatColor(id, "%L", id, "PM_SEND_INFO")
   menu_destroy( szMenu )
   return PLUGIN_HANDLED
}
public BlockMenu(id)
{
   new szTitle[512]
   new szItem[512]
   formatex(szTitle, charsmax( szTitle ), "%L", id, "PM_BLOCKMENU_TITLE")
   new szMenu = menu_create(szTitle, "BlockMenu_handler")
   if(!szPlayerPMBlockAll[id])
   {
      formatex(szItem, charsmax( szItem ), "%L", id, "PM_BLOCKMENU_ITEM_1")
      menu_additem(szMenu, szItem, "1", 0 )
   }else{
      formatex(szItem, charsmax( szItem ), "%L", id, "PM_BLOCKMENU_ITEM_1_1")
      menu_additem(szMenu, szItem, "1", 0 )
   }
   new szPlayers[32]
        new szPlayer, szNum
        new szName[32], szPlayerNum[10]
        get_players(szPlayers, szNum)
        for(new i; i < szNum; i++)
        {
                szPlayer = szPlayers[i]
      if(szPlayer == id || is_user_bot(szPlayer) || !is_user_connected(szPlayer) || is_user_hltv(szPlayer))
         continue
                get_user_name(szPlayer, szName, charsmax( szName ))
                num_to_str(szPlayer + 1, szPlayerNum, charsmax( szPlayerNum ))
      if(szPlayerPMBlock[id][szPlayer])
      {
         formatex(szItem, charsmax( szItem ), "%L", id, "PM_PLAYERMENU_BLOCKED", szName)
         menu_additem(szMenu, szItem, szPlayerNum, 0)
      }else
      if(szPlayerPMBlockAll[id])
      {
         menu_additem(szMenu, szName, szPlayerNum, ADMIN_ADMIN)
      }else{
         menu_additem(szMenu, szName, szPlayerNum, 0)
      }
        }
        menu_setprop(szMenu, MPROP_EXIT, MEXIT_ALL )
        menu_setprop(szMenu, MPROP_NEXTNAME, "Далее")
        menu_setprop(szMenu, MPROP_BACKNAME, "Назад")
        menu_setprop(szMenu, MPROP_EXITNAME, "Выход")
        menu_display(id, szMenu, 0)
        return PLUGIN_HANDLED
}
public BlockMenu_handler(id, szMenu, szItem)
{
        if(szItem == MENU_EXIT)
        {
                menu_destroy( szMenu )
                return PLUGIN_HANDLED
        }
        new szData[6], szName[64], szAccess, szCallback
        menu_item_getinfo(szMenu, szItem, szAccess, szData, charsmax( szData ), szName, charsmax( szName ), szCallback)
        new szItemID = str_to_num( szData )
        if(szItemID == 1)
        {
      if(!szPlayerPMBlockAll[id])
      {
         szPlayerPMBlockAll[id] = true
         ChatColor(id, "%L", id, "PM_BLOCK_ALL")
      }else{
         szPlayerPMBlockAll[id] = false
         ChatColor(id, "%L", id, "PM_UNBLOCK_ALL")
      }
        }else{
                new szPlayer = szItemID - 1
      new szNameBlock[32]
      get_user_name(szPlayer, szNameBlock, charsmax( szNameBlock ))
      if(!szPlayerPMBlock[id][szPlayer])
      {
         szPlayerPMBlock[id][szPlayer] = true
         ChatColor(id, "%L", id, "PM_BLOCK_PLAYER", szNameBlock)
      }else{
         szPlayerPMBlock[id][szPlayer] = false
         ChatColor(id, "%L", id, "PM_UNBLOCK_PLAYER", szNameBlock)
      }
        }
        menu_destroy( szMenu )
        return PLUGIN_HANDLED
}
public PMessage(id)
{
   if(!szPlayerPM[id])
   {
      ChatColor(id, "%L", id, "PM_NOPLAYER")
      return PLUGIN_HANDLED
   }
   if(!is_user_connected(szPlayerPM[id]))
   {
      ChatColor(id, "%L", id, "PM_NOPLAYER_CONNECT")
      return PLUGIN_HANDLED
   }
   new szMessage[192]
   read_args(szMessage, charsmax( szMessage ))
   remove_quotes( szMessage )
   new szNamePlayer[32], szNamePlayerPM[32]
   get_user_name(id, szNamePlayer, charsmax( szNamePlayer ))
   get_user_name(szPlayerPM[id], szNamePlayerPM, charsmax( szNamePlayerPM ))
   ChatColor(id, "%L", id, "PM_SEND", szNamePlayerPM, szMessage)
   ChatColor(szPlayerPM[id], "%L", id, "PM_SEND", szNamePlayer, szMessage)
   client_cmd(szPlayerPM[id], "spk %s", g_Sound)
   szPlayerPM[id] = 0
   return PLUGIN_HANDLED
}
stock ChatColor(const id, const input[], any:...)
{
   new count = 1, players[32]
   static msg[191] 
   vformat(msg, 190, input, 3)
   replace_all(msg, 190, "!g", "^4")
   replace_all(msg, 190, "!y", "^1")
   replace_all(msg, 190, "!t", "^3")
   if (id) players[0] = id; else get_players(players, count, "ch") 
   {
      for (new i = 0; i < count; i++)
      {
         if (is_user_connected(players[i]))
         {
            message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
            write_byte(players[i]);
            write_string(msg);
            message_end();
         }
      }
   }
}
 
Последнее редактирование: Shadowless

present

Пользователь
Регистрация
27 Сен 2017
Сообщения
16
Симпатии
2
#3
try this
Код:
#include <amxmodx>

#pragma semicolon 1

#define PLUGIN_NAME "Private Message"
#define PLUGIN_VERSION "0.8"
#define PLUGIN_AUTHOR "Denzer"

// EN: Prefix in chat
// RU: Префикс в чат
new const PREFIX[] = "[^4PM^1]";

// EN: List of commands to cancel
// RU: Список команд для отмены
new const BLOCK_CMD[] =
{
    "cancel",
    "otmena",
    "отмена"
};

new const g_szLogFile[] = "private_message";

new g_iType;
new bool: g_bBlock;
new Float: g_fDelay;
new g_sAccess[24];
new bool: g_bLogging;
new g_iPlayer[MAX_PLAYERS + 1];
new bool: g_bChatBlocked;
new bool: g_bHookSay[MAX_PLAYERS + 1];
new bool: g_bType[MAX_PLAYERS + 1];
new bool: g_bPlayerBlocked[MAX_PLAYERS + 1][MAX_PLAYERS + 1];
new Float: g_fChattingDelay[MAX_PLAYERS + 1];
new Array: g_aIndex[MAX_PLAYERS + 1];

public plugin_init()
{
    register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);

    new pCvar;
    pCvar = create_cvar("pm_type", "1", FCVAR_NONE, "All can write messages each other, 2 - messages can write only: alive to alive, deat for dead, 3 - only to teammates", true, 1.0, true, 3.0);
    bind_pcvar_num(pCvar, g_iType);

    pCvar = create_cvar("pm_delay", "2.5", FCVAR_NONE, "Time between messages", true, 0.0, true, 10.0);
    bind_pcvar_float(pCvar, g_fDelay);

    pCvar = create_cvar("pm_access", "m", FCVAR_NONE, "Access flag to function of chat blocking");
    bind_pcvar_string(pCvar, g_sAccess, charsmax(g_sAccess));

    AutoExecConfig(true, "private_message");

    pCvar = create_cvar("pm_block", "1", FCVAR_NONE, "Allows admin to block PM-system", true, 0.0, true, 1.0);
    g_bBlock = bool:get_pcvar_num(pCvar);

    pCvar = create_cvar("pm_logging", "1", FCVAR_NONE, "Message logging", true, 0.0, true, 1.0);
    g_bLogging = bool:get_pcvar_num(pCvar);

    register_clcmd("pm", "CmdSay");
    register_clcmd("say /pm", "CmdMain");

    for(new i = 0; i < sizeof(BLOCK_CMD); i++)
        register_saycmd(BLOCK_CMD[i], "CmdHookSay");

    register_clcmd("say", "CmdSayChat");
    register_clcmd("say_team", "CmdSayChat");

    if(g_bBlock)
    {
        register_clcmd("say /pmblock", "CmdChatBlocked");
        register_clcmd("pmblock", "CmdChatBlocked");\
    }

    register_dictionary("private_message.txt");
}

public client_putinserver(id)
{
    g_bHookSay[id] = false;
    g_bType[id] = false;
    g_aIndex[id] = ArrayCreate();
}

public client_disconnected(id)
{
    ArrayDestroy(g_aIndex[id]);
    g_aIndex[id] = Invalid_Array;
    for(new i = 0 ; i < MAX_PLAYERS; i++)
    {
        if(!g_aIndex[i])
            continue;

        new found = ArrayFindValue(g_aIndex[i], id);
        if(found != -1)
        {
            ArrayDeleteItem(g_aIndex[i], found);
        }
    }
}

public CmdSay(id)
{
    new iPlayer = g_iPlayer[id];
    if(!is_user_connected(iPlayer))
       return PLUGIN_HANDLED;

    new sMsg[140];
    read_args(sMsg, charsmax(sMsg));
    remove_quotes(sMsg);
    replace_wrong_simbols(sMsg);

    client_print_color(id, print_team_default, "%L", LANG_SERVER, "PM_MESSAGE_TO", iPlayer, sMsg);
    client_print_color(iPlayer, print_team_default, "%L", LANG_SERVER, "PM_MESSAGE_FROM", id, sMsg);

    if(g_bLogging)
        log_to_file(g_szLogFile, "%L", LANG_SERVER, "PM_WROTE_PLAYER", id, iPlayer, sMsg);

    g_fChattingDelay[id] = get_gametime() + g_fDelay;
    return PLUGIN_HANDLED;
}

public CmdHookSay(id)
{
    if(!g_bHookSay[id])
        return PLUGIN_HANDLED;
    
    g_bHookSay[id] = false;
    client_print_color(id, print_team_default, "%s %L", PREFIX, LANG_SERVER, "PM_CANCEL");
    return PLUGIN_HANDLED;
}

public CmdSayChat(id)
{   
    new sMsg[140];
    new iPlayer = g_iPlayer[id];
    read_args(sMsg, charsmax(sMsg));
    remove_quotes(sMsg);
    replace_wrong_simbols(sMsg);

    if(!is_user_connected(iPlayer))
        return PLUGIN_CONTINUE;

    if(g_bType[id] && g_bHookSay[id])
    {
        g_bHookSay[id] = false;
        g_fChattingDelay[id] = get_gametime() + g_fDelay;
        client_print_color(id, print_team_default, "%L", LANG_SERVER, "PM_MESSAGE_TO", iPlayer, sMsg);
        client_print_color(iPlayer, print_team_default, "%L", LANG_SERVER, "PM_MESSAGE_FROM", id, sMsg);

        if(g_bLogging)
            log_to_file(g_szLogFile, "%L", LANG_SERVER, "PM_WROTE_PLAYER", id, iPlayer, sMsg);
        
        return PLUGIN_HANDLED;
    }
    
    return PLUGIN_CONTINUE;
}

public CmdChatBlocked(id)
{       
    if(~get_user_flags(id) & read_flags(g_sAccess))
        return PLUGIN_HANDLED;

    g_bChatBlocked = !g_bChatBlocked;
    client_print_color(0, print_team_default, "%s %L", PREFIX, LANG_SERVER, "PM_BLOCKED_ADMIN", id, LANG_SERVER, g_bChatBlocked ? "PM_BLOCKED_FOR" : "PM_BLOCKED_COUNT");
    return PLUGIN_CONTINUE;
}

public CmdMain(id)
{
    new szBuff[64], lang[64], chat[64], messagemode[64], recipient[64], recipient_none[64];
    formatex(lang, charsmax(lang), "%L", LANG_SERVER, "PM_TITLE_MESSAGES");
    new menu = menu_create(lang, "MainHandler");

    formatex(lang, charsmax(lang), "%L", LANG_SERVER, "PM_WRITE");
    menu_additem(menu, lang);

    formatex(lang, charsmax(lang), "%L", LANG_SERVER, "PM_BLOCK");
    menu_additem(menu, lang);

    formatex(chat, charsmax(chat), "%L", LANG_SERVER, "PM_CHAT");
    formatex(messagemode, charsmax(messagemode), "%L", LANG_SERVER, "PM_MESSAGEMODE");
    menu_additem(menu, g_bType[id] ? chat : messagemode);

    formatex(recipient, charsmax(recipient), "%L", LANG_SERVER, "PM_RECIPIENT");
    formatex(recipient_none, charsmax(recipient_none), "%L", LANG_SERVER, "PM_RECIPIENT_NONE");
    menu_addtext2(menu, ArraySize(g_aIndex[id]) ? recipient : recipient_none);

    if(ArraySize(g_aIndex[id]))
    {
        new save_index[MAX_PLAYERS + 1][MAX_PLAYERS + 1];
        new szPlayer[10];
        for(new i = 0; i < ArraySize(g_aIndex[id]); i++)
        {
            new get = ArrayGetCell(g_aIndex[id], i);
            /*server_print(">>> ArrayGetCell(g_aIndex[id], i): %d", get);
            server_print(">>> save_index[id][get]: %d", save_index[id][get]);*/
            if(save_index[id][get] == get || !is_user_connected(get))
                continue;
            
            formatex(szBuff, charsmax(szBuff), "%n", get);
            num_to_str(get, szPlayer, charsmax(szPlayer));
            menu_additem(menu, szBuff, szPlayer);
            save_index[id][get] = get;
        }
    }

    formatex(lang, charsmax(lang), "%L", LANG_SERVER, "PM_NEXT");
    menu_setprop(menu, MPROP_NEXTNAME, lang);
    formatex(lang, charsmax(lang), "%L", LANG_SERVER, "PM_BACK");
    menu_setprop(menu, MPROP_BACKNAME, lang);
    formatex(lang, charsmax(lang), "%L", LANG_SERVER, "PM_EXIT");
    menu_setprop(menu, MPROP_EXITNAME, lang);
    menu_display(id, menu, 0);
 
    return PLUGIN_HANDLED;
}

public MainHandler(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
    
    if(g_bChatBlocked)
    {
        client_print_color(id, print_team_default, "%s %L", PREFIX, LANG_SERVER, "PM_BLOCKED");
        return PLUGIN_HANDLED;
    }
    
    new s_Data[6], s_Name[64], i_Access, i_Callback;
    menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback);
    new tempid = str_to_num(s_Data);
    new iPlayer = g_iPlayer[id] = tempid;

    switch(item)
    {
        case 0:
            CmdPM(id);
        case 1:
            CmdBlock(id);
        case 2:
        {
            g_bType[id] = !g_bType[id];
            CmdMain(id);
        }
        default:
        {
            /*server_print(">>> g_fChattingDelay[id]: %1.f", g_fChattingDelay[id]);
            server_print(">>> get_gametime(): %1.f", get_gametime());
            server_print(">>> %d", g_fChattingDelay[id] > get_gametime() ? 1 : 0);*/

            if(!ArraySize(g_aIndex[id]))
                return PLUGIN_HANDLED;

            if(g_fChattingDelay[id] > get_gametime())
            {
                client_print_color(id, print_team_default, "%s %L", PREFIX, LANG_SERVER, "PM_FLOOD");
                return PLUGIN_HANDLED;
            }

            if(g_bPlayerBlocked[iPlayer][id])
            {
                client_print_color(id, print_team_default, "%s %L", PREFIX, LANG_SERVER, "PM_PLAYER_BLOCKED", iPlayer);
                return PLUGIN_HANDLED;
            }

            if(g_bType[id])
            {
                g_bHookSay[id] = true;
                client_print_color(id, print_team_default, "%s %L", PREFIX, LANG_SERVER, "PM_OPEN_CHAT");
            }
            else
            {
                g_bHookSay[id] = false;
                client_cmd(id, "messagemode pm");
            }

            //server_print(">>> otpravlyaem: %n, %d", iPlayer, iPlayer);
        }
    }
    menu_destroy(menu);
    return PLUGIN_HANDLED;
}

public CmdPM(id)
{
    new lang[64], iPlayers[MAX_PLAYERS], iNum, szPlayer[10], iPlayer, szName[MAX_NAME_LENGTH];
    formatex(lang, charsmax(lang), "%L", LANG_SERVER, "PM_TITLE_WRITE");
    new menu = menu_create(lang, "PMHandler");

    get_players(iPlayers, iNum, "ch");
    for (new i; i < iNum; i++)
    {
        iPlayer = iPlayers[i];

        if(id == iPlayer)
            continue;

        get_user_name(iPlayer, szName, charsmax(szName));
        num_to_str(iPlayer, szPlayer, charsmax(szPlayer));

        switch(g_iType)
        {
            case 1: menu_additem(menu, szName, szPlayer);
            case 2:
            {
                if(is_user_alive(id) == is_user_alive(iPlayer))
                    menu_additem(menu, szName, szPlayer);
            }
            case 3:
            {
                if(get_user_team(id) == get_user_team(iPlayer))
                    menu_additem(menu, szName, szPlayer);
            }
        }
    }

    formatex(lang, charsmax(lang), "%L", LANG_SERVER, "PM_NEXT");
    menu_setprop(menu, MPROP_NEXTNAME, lang);
    formatex(lang, charsmax(lang), "%L", LANG_SERVER, "PM_BACK");
    menu_setprop(menu, MPROP_BACKNAME, lang);
    formatex(lang, charsmax(lang), "%L", LANG_SERVER, "PM_EXIT");
    menu_setprop(menu, MPROP_EXITNAME, lang);
    menu_display(id, menu, 0);

    return PLUGIN_CONTINUE;
}

public PMHandler(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }

    new s_Data[6], s_Name[64], i_Access, i_Callback;
    menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback);

    new tempid = str_to_num(s_Data);
    new iPlayer = g_iPlayer[id] = tempid;

    if(g_fChattingDelay[id] > get_gametime())
    {
        client_print_color(id, print_team_default, "%s %L", PREFIX, LANG_SERVER, "PM_FLOOD");
        return PLUGIN_HANDLED;
    }

    if(g_bPlayerBlocked[iPlayer][id])
    {
        client_print_color(id, print_team_default, "%s %L", PREFIX, LANG_SERVER, "PM_PLAYER_BLOCKED", iPlayer);
        return PLUGIN_HANDLED;
    }
    
    if(g_bType[id])
    {
        client_print_color(id, print_team_default, "%s %L", PREFIX, LANG_SERVER, "PM_OPEN_CHAT");
        g_bHookSay[id] = true;
    }
    else
        client_cmd(id, "messagemode pm");

    ArrayPushCell(g_aIndex[id], iPlayer);
    
    if(ArraySize(g_aIndex[id]) > 3)
    {
        ArrayDeleteItem(g_aIndex[id], 0);
    }

    menu_destroy(menu);
    return PLUGIN_HANDLED;
}

public CmdBlock(id)
{
    new lang[64], iPlayers[MAX_PLAYERS], iNum, szPlayer[10], iPlayer, szBuff[64], szName[MAX_NAME_LENGTH];
    formatex(lang, charsmax(lang), "%L", LANG_SERVER, "PM_TITLE_BLOCK");
    new menu = menu_create(lang, "BlockHandler");

    get_players(iPlayers, iNum, "ch");
    for(new i; i < iNum; i++)
    {
        iPlayer = iPlayers[i];

        if(id == iPlayer)
            continue;

        get_user_name(iPlayer, szName, charsmax(szName));
        formatex(szBuff, charsmax(szBuff), "%s %L", szName, LANG_SERVER, "PM_MENU_BLOCKED");
        num_to_str(iPlayer, szPlayer, charsmax(szPlayer));

        if(g_bPlayerBlocked[id][iPlayer])
            menu_additem(menu, szBuff, szPlayer);
        else
            menu_additem(menu, szName, szPlayer);
    }

    formatex(lang, charsmax(lang), "%L", LANG_SERVER, "PM_NEXT");
    menu_setprop(menu, MPROP_NEXTNAME, lang);
    formatex(lang, charsmax(lang), "%L", LANG_SERVER, "PM_BACK");
    menu_setprop(menu, MPROP_BACKNAME, lang);
    formatex(lang, charsmax(lang), "%L", LANG_SERVER, "PM_EXIT");
    menu_setprop(menu, MPROP_EXITNAME, lang);
    menu_display(id, menu, 0);

    return PLUGIN_CONTINUE;
}

public BlockHandler(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }

    new s_Data[6], s_Name[64], i_Access, i_Callback;
    menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback);

    new tempid = str_to_num(s_Data);
    new iPlayer = g_iPlayer[id] = tempid;

    g_bPlayerBlocked[id][iPlayer] = !g_bPlayerBlocked[id][iPlayer];
    CmdBlock(id);

    menu_destroy(menu);
    return PLUGIN_HANDLED;
}

// mx?!
stock register_saycmd(const szSayCmd[], szFunc[])
{
    new const szPrefix[][] = { "say /", "say_team /", "say .", "say_team ." };
    for(new i; i < sizeof(szPrefix); i++)
        register_clcmd(fmt("%s%s", szPrefix[i], szSayCmd), szFunc);
}

stock replace_wrong_simbols(string[])
{
    new len = 0;
    for(new i; string[i] != EOS; i++)
    {
        if(string[i] == '%' || string[i] == '#' || 0x01 <= string[i] <= 0x04)
            continue;
        string[len++] = string[i];
    }
    string[len] = EOS;
}
 

Вложения