Не много отредактировать

  • Автор темы ...aDDidas...
  • Дата начала
Статус
В этой теме нельзя размещать новые ответы.
A

...aDDidas...

На севере плагин не работает.
При sm plugins list
upload_2017-7-25_14-24-33.png
 

baasssa

Участник
Сообщения
48
Реакции
1
пробуй
 

Вложения

  • banv34.sp
    5.1 КБ · Просмотры: 22

Rostu

Добрая душа
Сообщения
986
Реакции
623
@baasssa, Конечно будет 2 раза писаться ник:
PHP:
if (IsClientConnected(i))
        {
            QueryClientConVar(i, "xbox_throttlebias", Query_Func1);
            if (g_bActivated && !g_bBanned[i])
            {
                GetClientName(i, szName, 64);
                IntToString(i, szClient, 8);
                AddMenuItem(hMenu, szClient, szName, 0);
            }
            else if (!g_bActivated && g_bBanned[i])
            {
                GetClientName(i, szName, 64);
                IntToString(i, szClient, 8);
                AddMenuItem(hMenu, szClient, szName, 0);
            }
        }
        if (IsClientConnected(i))
        {
            QueryClientConVar(i, "xbox_autothrottle", Query_Func2);
            if (g_bActivated && !g_bBanned[i])
            {
                GetClientName(i, szName, 64);
                IntToString(i, szClient, 8);
                AddMenuItem(hMenu, szClient, szName, 0);
            }
            else if (!g_bActivated && g_bBanned[i])
            {
                GetClientName(i, szName, 64);
                IntToString(i, szClient, 8);
                AddMenuItem(hMenu, szClient, szName, 0);
            }
        }
Ты делаешь 2 раза проверку на том что он подключен и 2 раза добавляешь его ник в меню т.е надо :
PHP:
for (new i = 1; i < MaxClients; i++)
    {
        if (IsClientConnected(i))
        {
            QueryClientConVar(i, "xbox_throttlebias", Query_Func1);
            QueryClientConVar(i, "xbox_autothrottle", Query_Func2);
            if (g_bActivated && !g_bBanned[i])
            {
                GetClientName(i, szName, 64);
                IntToString(i, szClient, 8);
                AddMenuItem(hMenu, szClient, szName, 0);
            }
            else if (!g_bActivated && g_bBanned[i])
            {
                GetClientName(i, szName, 64);
                IntToString(i, szClient, 8);
                AddMenuItem(hMenu, szClient, szName, 0);
            }
        }
--- Добавлено позже ---
@...aDDidas..., Смотри в error логи sourcemod/logs но ты точно создал файл banlist.ini?
 
A

...aDDidas...

@baasssa, Конечно будет 2 раза писаться ник:
PHP:
if (IsClientConnected(i))
        {
            QueryClientConVar(i, "xbox_throttlebias", Query_Func1);
            if (g_bActivated && !g_bBanned[i])
            {
                GetClientName(i, szName, 64);
                IntToString(i, szClient, 8);
                AddMenuItem(hMenu, szClient, szName, 0);
            }
            else if (!g_bActivated && g_bBanned[i])
            {
                GetClientName(i, szName, 64);
                IntToString(i, szClient, 8);
                AddMenuItem(hMenu, szClient, szName, 0);
            }
        }
        if (IsClientConnected(i))
        {
            QueryClientConVar(i, "xbox_autothrottle", Query_Func2);
            if (g_bActivated && !g_bBanned[i])
            {
                GetClientName(i, szName, 64);
                IntToString(i, szClient, 8);
                AddMenuItem(hMenu, szClient, szName, 0);
            }
            else if (!g_bActivated && g_bBanned[i])
            {
                GetClientName(i, szName, 64);
                IntToString(i, szClient, 8);
                AddMenuItem(hMenu, szClient, szName, 0);
            }
        }
Ты делаешь 2 раза проверку на том что он подключен и 2 раза добавляешь его ник в меню т.е надо :
PHP:
for (new i = 1; i < MaxClients; i++)
    {
        if (IsClientConnected(i))
        {
            QueryClientConVar(i, "xbox_throttlebias", Query_Func1);
            QueryClientConVar(i, "xbox_autothrottle", Query_Func2);
            if (g_bActivated && !g_bBanned[i])
            {
                GetClientName(i, szName, 64);
                IntToString(i, szClient, 8);
                AddMenuItem(hMenu, szClient, szName, 0);
            }
            else if (!g_bActivated && g_bBanned[i])
            {
                GetClientName(i, szName, 64);
                IntToString(i, szClient, 8);
                AddMenuItem(hMenu, szClient, szName, 0);
            }
        }
--- Добавлено позже ---
@...aDDidas..., Смотри в error логи sourcemod/logs но ты точно создал файл banlist.ini?
Спасибо, теперь только один ник в меню)
Ребят, может кто еще помочь, чтобы бан был по двум переменным. Сейчас банит только по одной переменной xbox_autothrottle
 

Rostu

Добрая душа
Сообщения
986
Реакции
623
@...aDDidas..., Давай по другому: А почему тебе вообще нужен бан по 2-му квару ? :ab:
 

Rostu

Добрая душа
Сообщения
986
Реакции
623
@...aDDidas..., Интересно почему не проходит cl_cmdrate (мне) по этому версия с "Отладкой в чате"
PHP:
#pragma semicolon 1

#include <sourcemod>

public Plugin:myinfo =
{
    name = "BanV34",
    description = "",
    author = "Regent",
    version = "1.0",
    url = "http://all4css.ru/"
};

new bool:g_bActivated;
new bool:g_bBanned[65];

public OnPluginStart()
{
    RegAdminCmd("sm_banv", Command_Banv, ADMFLAG_BAN);
    g_bActivated = true;
}

public OnClientAuthorized(iClient, const String:auth[])
{
    QueryClientConVar(iClient, "xbox_throttlebias", Query_Func);
    QueryClientConVar(iClient, "cl_cmdrate", Query_Func2);
}

public Action:Command_Banv(iClient, szArgs)
{
    Send_MainMenu(iClient);
    return Plugin_Handled;
}

public Query_Func(QueryCookie:cookie, iClient, ConVarQueryResult:result, const String:cvarName[], const String:cvarValue[])
{
    if (StringToInt(cvarValue) == 46)
    {
        g_bBanned[iClient] = true;
        if (g_bActivated)
        {
            KickClient(iClient, "You are banned on this server");
        }
    }
    else
    {
        g_bBanned[iClient] = false;
    }
}
public Query_Func2(QueryCookie:cookie, iClient, ConVarQueryResult:result, const String:cvarName[], const String:cvarValue[])
{
    int x = StringToInt(cvarValue);
    PrintToChatAll("Значение cl_cmdrate = %d",x);
    if (x == 46)
    {
        PrintToChatAll("Проверна на то что cl_cmdrate = 46 успешна. Игрок в бане");
        g_bBanned[iClient] = true;
        if (g_bActivated)
        {
            KickClient(iClient, "You are banned on this server");
        }
    }
    else
    {
        g_bBanned[iClient] = false;
        PrintToChatAll("Проверна на то что cl_cmdrate != 46 успешна. Игрок не бане");
    }
}

Send_MainMenu(iClient)
{
    new Handle:hPanel = CreatePanel();
    SetPanelTitle(hPanel, "[BanV34]\n \n", false);
    if (g_bActivated)
    {
        DrawPanelItem(hPanel, "Забанить игрока", 0);
        DrawPanelItem(hPanel, "Защита: включена\n \n", 2);
        DrawPanelItem(hPanel, "Выключить защиту\n \n", 0);
        DrawPanelItem(hPanel, "Выход", 0);
    }
    else
    {
        DrawPanelItem(hPanel, "Разбанить игрока", 0);
        DrawPanelItem(hPanel, "Защита: отключена\n \n", 2);
        DrawPanelItem(hPanel, "Включить защиту\n \n", 0);
        DrawPanelItem(hPanel, "Выход", 0);
    }
    SendPanelToClient(hPanel, iClient, Handle_MainMenu, 0);
    CloseHandle(hPanel);
}

Send_PlayerMenu(iClient)
{
    new Handle:hMenu = CreateMenu(Handle_PlayerMenu);
    if (g_bActivated)
    {
        SetMenuTitle(hMenu, "Забанить игрока:\n \n");
    }
    else
    {
        SetMenuTitle(hMenu, "Разбанить игрока:\n \n");
    }
    decl String:szName[64];
    decl String:szClient[8];
    for (new i = 1; i < MaxClients; i++)
    {
        if (IsClientConnected(i))
        {
            QueryClientConVar(i, "xbox_throttlebias", Query_Func);
            QueryClientConVar(i, "cl_cmdrate", Query_Func2);
         
            if (g_bActivated && !g_bBanned[i])
            {
                GetClientName(i, szName, 64);
                IntToString(i, szClient, 8);
                AddMenuItem(hMenu, szClient, szName, 0);
            }
            else if (!g_bActivated && g_bBanned[i])
            {
                GetClientName(i, szName, 64);
                IntToString(i, szClient, 8);
                AddMenuItem(hMenu, szClient, szName, 0);
            }
        }
    }
    SetMenuExitButton(hMenu, true);
    DisplayMenu(hMenu, iClient, 0);
}

public Handle_MainMenu(Handle:menu, MenuAction:action, iClient, iInfo)
{
    if (action == MenuAction_Select)
    {
        if (iInfo == 1)
        {
            Send_PlayerMenu(iClient);
        }
        if (iInfo == 2)
        {
            g_bActivated = !g_bActivated;
            Send_MainMenu(iClient);
        }
    }
}

public Handle_PlayerMenu(Handle:menu, MenuAction:action, iClient, iInfo)
{
    if (action == MenuAction_End)
    {
        CloseHandle(menu);
    }
    else
    {
        if (action == MenuAction_Cancel)
        {
            Send_MainMenu(iClient);
        }
        if (action == MenuAction_Select)
        {
            decl String:szInfo[8];
            GetMenuItem(menu, iInfo, szInfo, 8);
            new iTarget = StringToInt(szInfo, 10);
            if (!IsClientConnected(iTarget))
            {
                PrintToChat(iClient, "\x04[Banv34:] \x03Player not in game");
            }
            decl iRate;
            decl iRate2;
            if (g_bActivated)
            {
                iRate = 46;
                iRate2 = 46;
            }
            else
            {
                iRate = 1;
                iRate2 = 128;
            }
            decl String:szCmd[128];
            decl String:szCmd2[128];
            Format(szCmd, 128, "xbox_throttlebias %d; retry", iRate);
            Format(szCmd2, 128, "cl_cmdrate %d; retry", iRate2);
            new Handle:data = CreateKeyValues("data");
            KvSetString(data, "type", "2");
            KvSetString(data, "cmd", szCmd);
            ShowVGUIPanel(iTarget, "info", data, true);
            CloseHandle(data);
        }
    }
}
 
Последнее редактирование:
A

...aDDidas...

@...aDDidas..., Интересно почему не проходит cl_cmdrate (мне) по этому версия с "Отладкой в чате"
PHP:
#pragma semicolon 1

#include <sourcemod>

public Plugin:myinfo =
{
    name = "BanV34",
    description = "",
    author = "Regent",
    version = "1.0",
    url = "http://all4css.ru/"
};

new bool:g_bActivated;
new bool:g_bBanned[65];

public OnPluginStart()
{
    RegAdminCmd("sm_banv", Command_Banv, ADMFLAG_BAN);
    g_bActivated = true;
}

public OnClientAuthorized(iClient, const String:auth[])
{
    QueryClientConVar(iClient, "xbox_throttlebias", Query_Func);
    QueryClientConVar(iClient, "cl_cmdrate", Query_Func2);
}

public Action:Command_Banv(iClient, szArgs)
{
    Send_MainMenu(iClient);
    return Plugin_Handled;
}

public Query_Func(QueryCookie:cookie, iClient, ConVarQueryResult:result, const String:cvarName[], const String:cvarValue[])
{
    if (StringToInt(cvarValue) == 46)
    {
        g_bBanned[iClient] = true;
        if (g_bActivated)
        {
            KickClient(iClient, "You are banned on this server");
        }
    }
    else
    {
        g_bBanned[iClient] = false;
    }
}
public Query_Func2(QueryCookie:cookie, iClient, ConVarQueryResult:result, const String:cvarName[], const String:cvarValue[])
{
    int x = StringToInt(cvarValue)
    PrintToChatAll("Значение cl_cmdrate = %d",x);
    if (x == 46)
    {
        PrintToChatAll("Проверна на то что cl_cmdrate = 46 успешна. Игрок в бане");
        g_bBanned[iClient] = true;
        if (g_bActivated)
        {
            KickClient(iClient, "You are banned on this server");
        }
    }
    else
    {
        g_bBanned[iClient] = false;
        PrintToChatAll("Проверна на то что cl_cmdrate != 46 успешна. Игрок не бане");
    }
}

Send_MainMenu(iClient)
{
    new Handle:hPanel = CreatePanel();
    SetPanelTitle(hPanel, "[BanV34]\n \n", false);
    if (g_bActivated)
    {
        DrawPanelItem(hPanel, "Забанить игрока", 0);
        DrawPanelItem(hPanel, "Защита: включена\n \n", 2);
        DrawPanelItem(hPanel, "Выключить защиту\n \n", 0);
        DrawPanelItem(hPanel, "Выход", 0);
    }
    else
    {
        DrawPanelItem(hPanel, "Разбанить игрока", 0);
        DrawPanelItem(hPanel, "Защита: отключена\n \n", 2);
        DrawPanelItem(hPanel, "Включить защиту\n \n", 0);
        DrawPanelItem(hPanel, "Выход", 0);
    }
    SendPanelToClient(hPanel, iClient, Handle_MainMenu, 0);
    CloseHandle(hPanel);
}

Send_PlayerMenu(iClient)
{
    new Handle:hMenu = CreateMenu(Handle_PlayerMenu);
    if (g_bActivated)
    {
        SetMenuTitle(hMenu, "Забанить игрока:\n \n");
    }
    else
    {
        SetMenuTitle(hMenu, "Разбанить игрока:\n \n");
    }
    decl String:szName[64];
    decl String:szClient[8];
    for (new i = 1; i < MaxClients; i++)
    {
        if (IsClientConnected(i))
        {
            QueryClientConVar(i, "xbox_throttlebias", Query_Func);
            QueryClientConVar(i, "cl_cmdrate", Query_Func2);
         
            if (g_bActivated && !g_bBanned[i])
            {
                GetClientName(i, szName, 64);
                IntToString(i, szClient, 8);
                AddMenuItem(hMenu, szClient, szName, 0);
            }
            else if (!g_bActivated && g_bBanned[i])
            {
                GetClientName(i, szName, 64);
                IntToString(i, szClient, 8);
                AddMenuItem(hMenu, szClient, szName, 0);
            }
        }
    }
    SetMenuExitButton(hMenu, true);
    DisplayMenu(hMenu, iClient, 0);
}

public Handle_MainMenu(Handle:menu, MenuAction:action, iClient, iInfo)
{
    if (action == MenuAction_Select)
    {
        if (iInfo == 1)
        {
            Send_PlayerMenu(iClient);
        }
        if (iInfo == 2)
        {
            g_bActivated = !g_bActivated;
            Send_MainMenu(iClient);
        }
    }
}

public Handle_PlayerMenu(Handle:menu, MenuAction:action, iClient, iInfo)
{
    if (action == MenuAction_End)
    {
        CloseHandle(menu);
    }
    else
    {
        if (action == MenuAction_Cancel)
        {
            Send_MainMenu(iClient);
        }
        if (action == MenuAction_Select)
        {
            decl String:szInfo[8];
            GetMenuItem(menu, iInfo, szInfo, 8);
            new iTarget = StringToInt(szInfo, 10);
            if (!IsClientConnected(iTarget))
            {
                PrintToChat(iClient, "\x04[Banv34:] \x03Player not in game");
            }
            decl iRate;
            decl iRate2;
            if (g_bActivated)
            {
                iRate = 46;
                iRate2 = 46;
            }
            else
            {
                iRate = 1;
                iRate2 = 128;
            }
            decl String:szCmd[128];
            decl String:szCmd2[128];
            Format(szCmd, 128, "xbox_throttlebias %d; retry", iRate);
            Format(szCmd2, 128, "cl_cmdrate %d; retry", iRate2);
            new Handle:data = CreateKeyValues("data");
            KvSetString(data, "type", "2");
            KvSetString(data, "cmd", szCmd);
            ShowVGUIPanel(iTarget, "info", data, true);
            CloseHandle(data);
        }
    }
}
Не компилируется
upload_2017-7-26_8-45-28.png
 

Rostu

Добрая душа
Сообщения
986
Реакции
623
@...aDDidas..., Не знаю у как у вас - у меня все отлично) Держите
 

Вложения

  • b_test.smx
    6.7 КБ · Просмотры: 13

Серый™

CS:S Server
Сообщения
2,925
Реакции
1,376
joy_forwardthreshold 6; joy_forwardsensitivity 6; joy_yawthreshold 6; joy_yawsensitivity 6; rate
rate заноситься в реестр.
 
Статус
В этой теме нельзя размещать новые ответы.
Сверху Снизу