Иконка ресурса

VoteBKM (Голосование за бан/кик/мут) 1.0.7

mrdiega

Участник
Сообщения
328
Реакции
47
После того, как ставлю этот плагин, в консоли сервера начинается спам:

RecordSteamInterfaceCreation (PID 31288): SteamGameServer014 / GameServer
Missing interface adapter for SteamGameServer014 GameServer

После перезапуска меняется только число в скобках (PID 31288)
Не понимаю что это за ошибки, в ксго их нет, в логах всё пусто

Игра: Steam CSS
SM: 1.11.6930
[SM] Listing 23 plugins:
01 "Fun Commands" (1.11.0.6930) by AlliedModders LLC
02 "VoteBKM" (1.0.6) by Drumanid ( Пробовал скомпилированную на своём sm + пробовал версию 1.0.7. Тоже самое )
03 "[VIP] Test" (1.0.4) by R1KO (skype: vova.andrienko1)
04 "[VIP] Core" (3.0.4 R) by R1KO
05 "[VIP] HP" (1.2) by R1KO
06 "Material Admin" (0.8.6-ae3f5b9) by Material Admin Dev Team
07 "Sound Commands" (1.11.0.6930) by AlliedModders LLC
08 "Admin Help" (1.11.0.6930) by AlliedModders LLC
09 "Anti-Flood" (1.11.0.6930) by AlliedModders LLC
10 "Basic Votes" (1.11.0.6930) by AlliedModders LLC
11 "Client Preferences" (1.11.0.6930) by AlliedModders LLC
12 "Special Team Balancer" (0.5.0) by AlmazON
13 "Basic Commands" (1.11.0.6930) by AlliedModders LLC
14 "Basic Info Triggers" (1.11.0.6930) by AlliedModders LLC
15 "ArmorGive" (2.0 | Cvars) by inklesspen
16 "Admin Menu" (1.11.0.6930) by AlliedModders LLC
17 "Fun Votes" (1.11.0.6930) by AlliedModders LLC
18 "Reserved Slots" (1.11.0.6930) by AlliedModders LLC
19 "Admin File Reader" (1.11.0.6930) by AlliedModders LLC
20 "Basic Chat" (1.11.0.6930) by AlliedModders LLC
21 "Material Admin Checker" (0.8.6-ae3f5b9) by psychonic, Ca$h Munny, Sarabveer(VEER™), Bloomstorm
22 "Player Commands" (1.11.0.6930) by AlliedModders LLC
23 "Nextmap" (1.11.0.6930) by AlliedModders LLC
Listing 4 plugins:
[01] SourceMod (1.11.0.6930) by AlliedModders LLC
[02] CS Tools (1.11.0.6930) by AlliedModders LLC
[03] SDK Tools (1.11.0.6930) by AlliedModders LLC
[04] SteamWorks Extension (1.2.5) by Kyle Sanderson
[SM] Displaying 11 extensions:
[01] Automatic Updater (1.11.0.6930): Updates SourceMod gamedata files
[02] Webternet (1.11.0.6930): Extension for interacting with URLs
[03] CS Tools (1.11.0.6930): CS extended functionality
[04] BinTools (1.11.0.6930): Low-level C/C++ Calling API
[05] SDK Tools (1.11.0.6930): Source SDK Tools
[06] Top Menus (1.11.0.6930): Creates sorted nested menus
[07] SteamWorks Extension (1.2.5): Exposes SteamWorks functions to Developers
[08] Client Preferences (1.11.0.6930): Saves client preference settings
[09] SQLite (1.11.0.6930): SQLite Driver
[10] Regex (1.11.0.6930): Provides regex natives for plugins
[11] MySQL-DBI (1.11.0.6930): MySQL driver implementation for DBI

upd. Позже выяснилось, что этот спам может вызвать не только этот плагин, но и ядро шопа, и, скорее всего, множество других плагинов. От чего это зависит по-прежнему непонятно. Какая-то особенность css 🤨
upd2. Проблема решилась после обновления SteamWorks до последней версии. До этого стояла версия скачанная с tau gg
 
Последнее редактирование:

Crazy667

Участник
Сообщения
72
Реакции
0
Как пишут игроки !voteban !votemute !votekick, в чате выходит:
[SM] У вас нет доступа к этой команде!
 

DOK-26-RUS

Участник
Сообщения
264
Реакции
40
Добрый вечер
SourceMod (1.11.0.6934), при компиляции ошибки
//// VoteBKM.sp
//
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(300) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(300) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(300) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(300) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(380) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(380) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(436) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(436) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(496) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(496) : warning 209: function has explicit 'int' tag but does not return a value
 
Последнее редактирование:

Туник

Участник
Сообщения
1,281
Реакции
263
Добрый вечер
SourceMod (1.11.0.6934), при компиляции ошибки
//// VoteBKM.sp
//
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(300) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(300) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(300) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(300) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(380) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(380) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(436) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(436) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(496) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(496) : warning 209: function has explicit 'int' tag but does not return a value
дай исходник скомпилирую
 

DOK-26-RUS

Участник
Сообщения
264
Реакции
40
дай исходник скомпилирую
Исходник собственно из архива скаченный отсюда, буду благодарен, да признаюсь прилагаемый SteamWorks я не использовал, так как у меня новее и есть multicolors
 

Вложения

  • VoteBKM.sp
    25.9 КБ · Просмотры: 7
Последнее редактирование:

Mr_panica

XenForo one 💖
Сообщения
921
Реакции
435
Добрый вечер
SourceMod (1.11.0.6934), при компиляции ошибки
//// VoteBKM.sp
//
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(300) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(300) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(300) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(300) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(380) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(380) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(436) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(436) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(496) : warning 209: function has explicit 'int' tag but does not return a value
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(496) : warning 209: function has explicit 'int' tag but does not return a value
Это не ошибки, а предупреждения, плагин скомпилируется.

Попробуй так:
C-подобный:
#include <sdktools_gamerules>
#include <colorschat>

#undef REQUIRE_PLUGIN
#include <basecomm>

#undef REQUIRE_EXTENSIONS
#include <steamworks>

#pragma semicolon 1
#pragma newdecls required

public Plugin myinfo =
{
    name = "VoteBKM",
    description = "Голосование за бан, кик и мут игрока",
    author = "Drumanid",
    version = "1.0.7",
    url = "Discord: Drumanid#9108"
};

enum        {BAN, KICK, MUTE};
KeyValues    g_hKeyValues;
Menu        g_hMenu;
Handle        g_hTimer;

int            g_iType,
            g_iTarget,
            g_iPlayers,
            g_iCount,
            g_iTimeTimer,
            g_iTimeLimitAll,
            g_iTimeLimit[MAXPLAYERS +1],
            g_iChat;

float        g_fPercent,
            g_fCount;

char        g_sBuffer[256],
            g_sReason[64],
            g_sLog[128];

bool        g_bExpansion[2],
            g_bUse[MAXPLAYERS +1],
            g_bVote[MAXPLAYERS +1][MAXPLAYERS +1][3],
            g_bNoSteam[MAXPLAYERS +1];

//=================================================================

bool        g_kvbInBan,
            g_kvbInKick,
            g_kvbInMute,
            g_kvbType,
            g_kvbAdmins,
            g_kvbMessage,
            g_kvbMultiplier,
            g_kvbLog,
            g_kvbNoSteam,
            g_kvbMutePlayer;

int            g_kviTimeTimer,
            g_kviPlayersLimit,
            g_kviDisconnectBan,
            g_kviTimeBan,
            g_kviTimeLimitAll,
            g_kviPercent;

char        g_kvsFlag[2][4];

public APLRes AskPluginLoad2(Handle hMySelf, bool bLate, char[] szError, int iErrMax)
{
    if(GetEngineVersion() == Engine_CSGO) g_bGame = true;
    else g_bGame = false;
    
    return APLRes_Success;
}

public void OnAllPluginsLoaded()
{
    g_bExpansion[0] = LibraryExists("basecomm");
    g_bExpansion[1] = LibraryExists("SteamWorks");
}

public void OnLibraryRemoved(const char[] sName)
{
    UsePlugin(sName, false);
}

public void OnLibraryAdded(const char[] sName)
{
    UsePlugin(sName, true);
}

public void OnPluginStart()
{
    BuildPath(Path_SM, g_sLog, sizeof(g_sLog), "logs/VoteBKM.log");
    
    RegConsoleCmd("sm_voteban", BanCmd);
    RegConsoleCmd("sm_votekick", KickCmd);
    RegConsoleCmd("sm_votemute", MuteCmd);
    RegConsoleCmd("sm_rev", RevoteCmd);
    RegConsoleCmd("sm_votecancel", VoteCancelCmd);

    g_hMenu = new Menu(MenuVoteItems);
    g_hMenu.ExitButton = false;

    for(int i; i < 3; i++) g_hMenu.AddItem(NULL_STRING, NULL_STRING, ITEMDRAW_NOTEXT);
    g_hMenu.AddItem(NULL_STRING, "Наказать");
    g_hMenu.AddItem(NULL_STRING, "Не наказывать");
}

public void OnMapStart()
{
    if(g_hKeyValues != null) delete g_hKeyValues;

    char sPath[128];
    BuildPath(Path_SM, sPath, sizeof(sPath), "configs/votebkm.ini");

    g_hKeyValues = new KeyValues("VoteBKM");
    if(!g_hKeyValues.ImportFromFile(sPath)) SetFailState("No found file: '%s'", sPath);

    if(g_bExpansion[0]) g_kvbType = view_as<bool>(g_hKeyValues.GetNum("Type", 0));
    else g_kvbType = true;
    g_kvbInBan = view_as<bool>(g_hKeyValues.GetNum("InBan", 1));
    g_kvbInKick = view_as<bool>(g_hKeyValues.GetNum("InKick", 1));
    g_kvbInMute = view_as<bool>(g_hKeyValues.GetNum("InMute", 1));
    g_kvbAdmins = view_as<bool>(g_hKeyValues.GetNum("Admins", 0));
    g_kvbMessage = view_as<bool>(g_hKeyValues.GetNum("Message", 1));
    g_kvbMultiplier = view_as<bool>(g_hKeyValues.GetNum("Multiplier", 0));
    g_kvbLog = view_as<bool>(g_hKeyValues.GetNum("Log", 1));
    g_kvbNoSteam = view_as<bool>(g_hKeyValues.GetNum("NoSteam", 1));
    g_kvbMutePlayer = view_as<bool>(g_hKeyValues.GetNum("MutePlayer", 1));
    g_kviTimeTimer = g_hKeyValues.GetNum("Time", 20);
    g_kviPlayersLimit = g_hKeyValues.GetNum("PlayersLimit", 4);
    g_kviDisconnectBan = g_hKeyValues.GetNum("DisconnectBan", 60);
    g_kviTimeBan = g_hKeyValues.GetNum("TimeBan", 60);
    g_kviTimeLimitAll = g_hKeyValues.GetNum("TimeLimitAll", 30);
    g_kviPercent = g_hKeyValues.GetNum("VotePercent", 0);
    g_hKeyValues.GetString("FlagImmunity", g_kvsFlag[0], sizeof(g_kvsFlag[]), "t");
    g_hKeyValues.GetString("FlagCancel", g_kvsFlag[1], sizeof(g_kvsFlag[]), "d");

    ClearVeriables(false);
    DeleteTimer();
}

public Action BanCmd(int iClient, int iArgs)
{
    if(g_kvbInBan) Type(iClient, BAN);
    return Plugin_Handled;
}

public Action KickCmd(int iClient, int iArgs)
{
    if(g_kvbInKick) Type(iClient, KICK);
    return Plugin_Handled;
}

public Action MuteCmd(int iClient, int iArgs)
{
    if(g_kvbInMute) Type(iClient, MUTE);
    return Plugin_Handled;
}

public Action RevoteCmd(int iClient, int iArgs)
{
    if(iClient && CheckVote(iClient))
    {
        if(g_bUse[iClient])
        {
            g_bUse[iClient] = false; g_fCount -= g_fPercent; g_iCount--;
            if(g_kvbMessage) CPrintToChatAll("{WHITE}[{GREEN}VoteBKM{WHITE}] {GREEN}%N {WHITE}решил переголосовать!", iClient);
        }
        else CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Сначала проголосуйте, а потом сможете переголосовать!");
    }
    return Plugin_Handled;
}

public Action VoteCancelCmd(int iClient, int iArgs)
{
    if(iClient && CheckVote(iClient))
    {
        if(IsAdminFlag(iClient, g_kvsFlag[1]))
        {
            VoteClosed();
            Log("Администратор %L отменил голосование!\n ", iClient);
            CPrintToChatAll("{WHITE}[{GREEN}VoteBKM{WHITE}] {RED}Администратор {WHITE}отменил голосование!");
        }
        else CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] У вас нет доступа к этой команде!");
    }
    return Plugin_Handled;
}

void Type(int iClient, int iType)
{
    if(iClient < 1) return;

    if(g_kvbNoSteam && g_bExpansion[1] && g_bNoSteam[iClient])
    {
        CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Вы не можете этого сделать играя с пиратской версии игры!");
        return;
    }

    if(!g_kvbMutePlayer && g_bExpansion[0])
    {
        if(BaseComm_IsClientGagged(iClient) || BaseComm_IsClientMuted(iClient))
        {
            CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Вы не можете этого сделать т.к вы имеете блокировку чата или микрофона!");
            return;
        }
    }

    if(!g_bGame || !GameRules_GetProp("m_bWarmupPeriod"))
    {
        if(g_iTarget < 1)
        {
            int iTime = GetTime();
            if(g_iTimeLimitAll <= iTime)
            {
                if(GetPlayers() >= g_kviPlayersLimit)
                {
                    if(!g_kvbAdmins || g_iPlayers == 0)
                    {
                        if(g_iTimeLimit[iClient] <= iTime)
                        {
                            g_fPercent = 100.0 / float((g_iPlayers = GetPlayers()));
                            
                            Menu hMenu = new Menu(PlayerListMenuItems);
                            hMenu.ExitButton = true;

                            char sBuffer[64], sBuffer2[32]; int iCount, i;
                            GetType(iType, sBuffer, sizeof(sBuffer));

                            if(g_kviPercent == 0)
                            {
                                g_iTarget++;
                                hMenu.SetTitle("Выберите игрока которого хотите - '%s'\n ", sBuffer);

                                for(i = 1; i <= MaxClients; i++)
                                {
                                    if(IsClientInGame(i) && !IsFakeClient(i) && i != iClient)
                                    {
                                        GetClientName(i, sBuffer, sizeof(sBuffer));
                                        FormatEx(sBuffer2, sizeof(sBuffer2), "%i %i", GetClientUserId(i), iType);
                                        if(!IsAdminFlag(i, g_kvsFlag[0])) hMenu.AddItem(sBuffer2, sBuffer);
                                        else hMenu.AddItem(sBuffer2, sBuffer, ITEMDRAW_DISABLED);
                                        iCount++;
                                    }
                                }
                            }
                            else
                            {
                                hMenu.SetTitle("Выберите игрока которого хотите - '%s'\nДля того чтобы начать голосование, нужно:\n[n - текущее / n - необходимое] кол-во голосов\n ", sBuffer);

                                int iVotes[2];
                                for(i = 1; i <= MaxClients; i++)
                                {
                                    if(IsClientInGame(i) && !IsFakeClient(i) && i != iClient)
                                    {
                                        if(!IsAdminFlag(i, g_kvsFlag[0]))
                                        {
                                            iVotes[0] = GetAllVotes(float(g_kviPercent)); iVotes[1] = GetVotes(i, iType);
                                            if(!g_bVote[iClient][i][iType])
                                            {
                                                if(iVotes[0] > iVotes[1]) FormatEx(sBuffer, sizeof(sBuffer), "%N [%i/%i]", i, iVotes[1], iVotes[0]);
                                                else FormatEx(sBuffer, sizeof(sBuffer), "%N [Начать голосование]", i);
                                            }
                                            else FormatEx(sBuffer, sizeof(sBuffer), "%N [Забрать голос]", i);
                                            FormatEx(sBuffer2, sizeof(sBuffer2), "%i %i %i %i", GetClientUserId(i), iType, iVotes[0], iVotes[1]);
                                            hMenu.AddItem(sBuffer2, sBuffer);
                                        }
                                        else
                                        {
                                            FormatEx(sBuffer, sizeof(sBuffer), "%N [-/-]", i);
                                            hMenu.AddItem(NULL_STRING, sBuffer, ITEMDRAW_DISABLED);
                                        }
                                        
                                        iCount++;
                                    }
                                }

                                g_iPlayers = 0;
                            }

                            if(iCount == 0) CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] На данный момент нет подходящих игроков!");
                            hMenu.Display(iClient, 0);
                        }
                        else CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Вы недавно создавали голосование! Вы сможете запустить голосование только через {RED}%i{WHITE} секунд(у/ы)!", g_iTimeLimit[iClient] - iTime);
                    }
                    else CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Вы не сможете запустить голосование, т.к на сервере есть администратор!");
                }
                else CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Необходимо {RED}%i{WHITE} игрока, чтобы создать голосование!", g_kviPlayersLimit);
            }
            else CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Недавно было голосование! Игроки смогут запустить голосование только через {RED}%i{WHITE} секунд(у/ы)!", g_iTimeLimitAll - iTime);
        }
        else CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Вы не можете создать голосование, т.к его уже создали(ют)");
    }
    else CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Нельзя запустить голосование во время разминки!");
}

public int PlayerListMenuItems(Menu hMenu, MenuAction action, int iClient, int iItem)
{
    switch(action)
    {
        case MenuAction_End: delete hMenu;
        case MenuAction_Cancel:
        {
            if(g_kviPercent == 0 && (iItem == MenuCancel_Interrupted || iItem == MenuCancel_Timeout || iItem == MenuCancel_Exit)) g_iTarget = 0;
        }
        case MenuAction_Select:
        {
            char sBuffer[24], sExplodeBuffer[4][8]; int iTarget;
            hMenu.GetItem(iItem, sBuffer, sizeof(sBuffer));
            ExplodeString(sBuffer, " ", sExplodeBuffer, sizeof(sExplodeBuffer), sizeof(sExplodeBuffer[]));
            if(!CheckTarget((iTarget = GetClientOfUserId(StringToInt(sExplodeBuffer[0]))), iClient)) return 0;
            
            int iType = StringToInt(sExplodeBuffer[1]);
            if(g_kviPercent != 0)
            {
                if(!g_bVote[iClient][iTarget][iType])
                {
                    g_bVote[iClient][iTarget][iType] = true; int iVotes[2];
                    iVotes[0] = StringToInt(sExplodeBuffer[2]); iVotes[1] = StringToInt(sExplodeBuffer[3]) +1;
                    
                    if(iVotes[1] < iVotes[0])
                    {
                        CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Необходимо еще {RED}%i{WHITE} голос(а), чтобы создать голосование за наказание данного игрока!", iVotes[0] - iVotes[1]);
                        if(g_kvbMessage) CPrintToChatAll("{WHITE}[{GREEN}VoteBKM{WHITE}] {GREEN}%N {WHITE}отдал свой голос за наказание игрока {RED}%N", iClient, iTarget);
                        return 0;
                    }
                }
                else
                {
                    g_bVote[iClient][iTarget][iType] = false;
                    if(g_kvbMessage) CPrintToChatAll("{WHITE}[{GREEN}VoteBKM{WHITE}] {GREEN}%N {WHITE}забрал свой голос с игрока {RED}%N!", iClient, iTarget);
                    return 0;
                }
            }

            g_iType = iType;
            g_iTarget = iTarget;
            ReasonMenu(iClient);
        }
    }
    return 0;
}

void ReasonMenu(int iClient)
{
    if(!CheckTarget(g_iTarget, iClient)) return;

    Menu hMenu = new Menu(ReasonMenuItems);
    hMenu.ExitButton = true;

    hMenu.SetTitle("Выбранный игрок: %N\nВыберите причину наказания:\n ", g_iTarget);

    char sKey[32];
    switch(g_iType)
    {
        case BAN: sKey = "ban_reason";
        case KICK: sKey = "kick_reason";
        case MUTE: sKey = "mute_reason";
    }

    g_hKeyValues.Rewind();
    if(g_hKeyValues.JumpToKey(sKey) && g_hKeyValues.GotoFirstSubKey(false))
    {
        char sReason[2][64];
        do
        {
            g_hKeyValues.GetSectionName(sReason[0], sizeof(sReason[]));
            g_hKeyValues.GetString(NULL_STRING, sReason[1], sizeof(sReason[]));
            hMenu.AddItem(sReason[0], sReason[1]);
        }
        while(g_hKeyValues.GotoNextKey(false));
    }
    else g_iTarget = 0;

    hMenu.Display(iClient, 0);
}

public int ReasonMenuItems(Menu hMenu, MenuAction action, int iClient, int iItem)
{
    switch(action)
    {
        case MenuAction_End: delete hMenu;
        case MenuAction_Cancel:
        {
            if(iItem == MenuCancel_Interrupted || iItem == MenuCancel_Timeout || iItem == MenuCancel_Exit) g_iTarget = 0;
        }
        case MenuAction_Select:
        {
            hMenu.GetItem(iItem, g_sReason, sizeof(g_sReason));
            if(StrContains(g_sReason, "chat", false) == 0)
            {
                g_hTimer = CreateTimer(15.0, TimerChat, GetClientUserId(iClient));
                CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Введите причину в чате, вам дано {GREEN}15 {WHITE}секунд!");
                g_iChat = iClient; return 0;
            }

            ConfirmationMenu(iClient);
        }
    }
    return 0;
}

public Action TimerChat(Handle hTimer, any iClient)
{
    iClient = GetClientOfUserId(iClient);
    if(IsClientInGame(iClient))
    {
        CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Вы не успели ввести причину!");
        g_iChat = -1; g_iTarget = 0; TimeLimit(iClient, GetTime());
    }
    else g_iTarget = 0;

    g_hTimer = null;
    return Plugin_Stop;
}

void ConfirmationMenu(int iClient)
{
    if(!CheckTarget(g_iTarget, iClient)) return;

    Menu hMenu = new Menu(ConfirmationMenuItems);
    hMenu.ExitButton = false;

     char sType[32];
     GetType(g_iType, sType, sizeof(sType));
    hMenu.SetTitle("Вы хотите %s игрока %N?\nПричина: %s\n ", sType, g_iTarget, g_sReason);

    for(int i; i < 3; i++) hMenu.AddItem(NULL_STRING, NULL_STRING, ITEMDRAW_NOTEXT);
    hMenu.AddItem(NULL_STRING, "Да");
    hMenu.AddItem(NULL_STRING, "Нет, изменить причину!");
    hMenu.AddItem(NULL_STRING, "Нет, отменить голосование!");
    hMenu.Display(iClient, 0);
}

public int ConfirmationMenuItems(Menu hMenu, MenuAction action, int iClient, int iItem)
{
    switch(action)
    {
        case MenuAction_End: delete hMenu;
        case MenuAction_Cancel:
        {
            if(iItem == MenuCancel_Interrupted || iItem == MenuCancel_Timeout) g_iTarget = 0;
        }
        case MenuAction_Select:
        {
            switch(iItem)
            {
                case 3:
                {
                    if(!CheckTarget(g_iTarget, iClient)) return 0;
                    g_iPlayers--;

                    int iTime = GetTime();
                    g_iTimeLimitAll = iTime + g_kviTimeLimitAll;
                    TimeLimit(iClient, iTime);

                    g_iTimeTimer = g_kviTimeTimer;
                    g_hTimer = CreateTimer(1.0, TimerReturnMenu, _, TIMER_REPEAT);

                    char sReason[64], sType[32];
                    FormatEx(sReason, sizeof(sReason), "%s", g_sReason);
                    switch(g_iType)
                    {
                        case BAN:
                        {
                            sType = "забанить";
                            FormatEx(g_sReason, sizeof(g_sReason), "[VOTEBAN] Причина: %s", sReason);
                            
                        }
                        case KICK:
                        {
                            sType = "кикнуть";
                            FormatEx(g_sReason, sizeof(g_sReason), "[VOTEKICK] Причина: %s", sReason);
                        }
                        case MUTE:
                        {
                            sType = "замутить";
                            FormatEx(g_sReason, sizeof(g_sReason), "[VOTEMUTE] Причина: %s", sReason);
                        }
                    }

                    FormatEx(g_sBuffer, sizeof(g_sBuffer), "Игрок: %N\nХочет %s игрока: %N\nПричина: %s", iClient, sType, g_iTarget, sReason);
                    Log("Игрок %L хочет %s игрока %L | Причина: %s", iClient, sType, g_iTarget, sReason);
                    CPrintToChatAll("{WHITE}[{GREEN}VoteBKM{WHITE}] {GREEN}%N {WHITE}хочет {RED}%s {WHITE}игрока {RED}%N{WHITE}. Создано голосование! Причина: {RED}%s", iClient, sType, g_iTarget, sReason);

                    Voted(iClient, true);
                }
                case 4: ReasonMenu(iClient);
                case 5: g_iTarget = 0;
            }
        }
    }
    return 0;
}

public int MenuVoteItems(Menu hMenu, MenuAction action, int iClient, int iItem)
{
    if(action == MenuAction_Select)
    {
        if(!CheckTarget(g_iTarget, iClient)) return 0;

        char sMessage[32];
        switch(iItem)
        {
            case 3:
            {
                Voted(iClient, true);
                sMessage = "за наказание";
            }
            case 4:
            {
                Voted(iClient, false);
                sMessage = "не наказывать";
            }
        }

        if(g_kvbMessage) CPrintToChatAll("{WHITE}[{GREEN}VoteBKM{WHITE}] Игрок {GREEN}%N {WHITE}голосует - {GREEN}%s{WHITE} игрока", iClient, sMessage);
        CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Введите в чат {RED}!rev{WHITE}, чтобы переголосовать!");
        if(g_iPlayers == g_iCount) FinishVote();
    }
    return 0;
}

public Action TimerReturnMenu(Handle hTimer)
{
    if(--g_iTimeTimer > 0)
    {
        for(int i = 1; i <= MaxClients; i++)
        {
            if(IsClientInGame(i) && !IsFakeClient(i) && i != g_iTarget && !g_bUse[i])
            {
                g_hMenu.SetTitle("%s\nОсталось время на выбор: %i\n ", g_sBuffer, g_iTimeTimer);
                g_hMenu.Display(i, 1);
            }
        }

        return Plugin_Continue;
    }

    FinishVote();
    g_hTimer = null;
    return Plugin_Stop;
}

void Voted(int iClient, bool bUse)
{
    g_iCount++; g_bUse[iClient] = true;

    if(bUse)
    {
        if(IsAdminFlag(iClient, g_kvsFlag[1]))
        {
            CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Введите {RED}!votecancel{WHITE}, чтобы отменить голсование!");
            if(g_kvbMultiplier)
            {
                g_fCount += g_fPercent * 2;
                return;
            }
        }

        g_fCount += g_fPercent;
    }
}

void FinishVote()
{
    char sBuffers[256]; int iPercent;
    GetKey(sBuffers, sizeof(sBuffers)); g_hKeyValues.Rewind();
    if(g_hKeyValues.JumpToKey(sBuffers))
    {
        g_hKeyValues.GetString("Command", sBuffers, sizeof(sBuffers));
        iPercent = g_hKeyValues.GetNum("Percent");
    }

    if(RoundToCeil(g_fCount) >= iPercent)
    {
        if(!CheckTarget(g_iTarget, _)) return;
        Log("Игрок %L был наказан!\n ", g_iTarget);

        if(g_kvbType)
        {
            char sReplace[40], sBuffer[32];
            if(StrContains(sBuffers, "{UID}", true) != -1)
            {
                IntToString(GetClientUserId(g_iTarget), sBuffer, sizeof(sBuffer));
                FormatEx(sReplace, sizeof(sReplace), "\"#%s\"", sBuffer);
                ReplaceString(sBuffers, sizeof(sBuffers), "{UID}", sReplace, true);
            }
            else if(StrContains(sBuffers, "{NAME}", true) != -1)
            {
                GetClientName(g_iTarget, sBuffer, sizeof(sBuffer));
                FormatEx(sReplace, sizeof(sReplace), "\"%s\"", sBuffer);
                ReplaceString(sBuffers, sizeof(sBuffers), "{NAME}", sReplace, true);
            }
            else if(StrContains(sBuffers, "{STEAMID}", true) != -1)
            {
                GetClientAuthId(g_iTarget, AuthId_Steam2, sBuffer, sizeof(sBuffer));
                FormatEx(sReplace, sizeof(sReplace), "\"%s\"", sBuffer);
                ReplaceString(sBuffers, sizeof(sBuffers), "{STEAMID}", sReplace, true);
            }

            if(StrContains(sBuffers, "{REASON}", true) != -1) ReplaceString(sBuffers, sizeof(sBuffers), "{REASON}", g_sReason, true);
            ServerCommand(sBuffers);
        }
        else
        {
            switch(g_iType)
            {
                case BAN: BanClient(g_iTarget, g_kviTimeBan, BANFLAG_AUTO, g_sReason);
                case KICK: KickClient(g_iTarget, g_sReason);
                case MUTE:
                {
                    BaseComm_SetClientGag(g_iTarget, true); BaseComm_SetClientMute(g_iTarget, true);
                    CPrintToChat(g_iTarget, "{WHITE}[{GREEN}VoteBKM{WHITE}] Вы получили мут! {WHITE}Причина: {RED}%s", g_sReason);
                }
            }
        }
                
        sBuffers = "Голосование завершено, игрок был наказан!";
    }
    else
    {
        Log("Игрок %L не был наказан, недостаточно голосов!\n ", g_iTarget);
        sBuffers = "Недостаточно голосов, голосование завершено!";
    }

    if(g_iPlayers == -1)
    {
        CPrintToChatAll("{WHITE}[{GREEN}VoteBKM{WHITE}] Проголосовало {GREEN}%i {WHITE}игрок(а/ов) из {RED}%i{WHITE} игроков. %s", g_iCount, sBuffers);
        Log("-1? - g_iCount: %i | g_iPlayers: %i | g_iTarget: %i | g_fCount: %f | g_fPercent: %f | g_sBuffer[0]: %s | g_sReason[0]: %s | g_iTimeTimer: %i | g_iChat: %i",
        g_iCount, g_iPlayers, g_iTarget, g_fCount, g_fPercent, g_sBuffer[0], g_sReason[0], g_iTimeTimer, g_iChat);
    }
    else
        CPrintToChatAll("{WHITE}[{GREEN}VoteBKM{WHITE}] Проголосовало {GREEN}%i {WHITE}игрок(а/ов) из {RED}%i{WHITE} игроков. %s", g_iCount, g_iPlayers, sBuffers);
        
    VoteClosed();
}

public void OnClientPostAdminCheck(int iClient)
{
    if(g_kvbNoSteam && g_bExpansion[1] && !IsFakeClient(iClient))
    {
        if(g_bGame && SteamWorks_HasLicenseForApp(iClient, 730) == k_EUserHasLicenseResultDoesNotHaveLicense) g_bNoSteam[iClient] = true;
        else if(!g_bGame && SteamWorks_HasLicenseForApp(iClient, 240) == k_EUserHasLicenseResultDoesNotHaveLicense) g_bNoSteam[iClient] = true;
    }
}

public void OnClientDisconnect(int iClient)
{
    g_bUse[iClient] = false;
    g_bNoSteam[iClient] = false;
    g_iTimeLimit[iClient] = 0;
    if(g_iChat == iClient) g_iChat = -1;

    int a, b;
    for(a = 1; a <= MaxClients; a++)
    {   
        for(b = 0; b < 3; b++) g_bVote[iClient][a][b] = false;
    }

    if(g_fPercent > 0.0 && g_iTarget == iClient && !IsFakeClient(iClient))
    {
        Log("Игрок %L вышел во время голосования!\n ", iClient);
        BanClient(iClient, g_kviDisconnectBan, BANFLAG_AUTO, "Покинул сервер во время голосования");
        CPrintToChatAll("{WHITE}[{GREEN}VoteBKM{WHITE}] {RED}Игрок вышел с сервера, голсоование завершено!");
        VoteClosed();
    }
}

public Action OnClientSayCommand(int iClient, const char[] sCommand, const char[] sArgs)
{
    if(g_kvbInBan && StrContains(sArgs, "voteban", false) == 0)
    {
        Type(iClient, BAN);
        return Plugin_Handled;
    }
    else if(g_kvbInKick && StrContains(sArgs, "votekick", false) == 0)
    {
        Type(iClient, KICK);
        return Plugin_Handled;
    }
    else if(g_kvbInMute && StrContains(sArgs, "votemute", false) == 0)
    {
        Type(iClient, MUTE);
        return Plugin_Handled;
    }
    else if(g_iChat == iClient)
    {
        FormatEx(g_sReason, sizeof(g_sReason), "%s", sArgs);
        g_iChat = -1; DeleteTimer();

        ConfirmationMenu(iClient);
        return Plugin_Handled;
    }

    return Plugin_Continue;
}

void ClearVeriables(bool bUse)
{
    if(bUse)
    {
        for(int i = 1; i <= MaxClients; i++)
        {
            g_bUse[i] = false;
            g_bVote[i][g_iTarget][g_iType] = false;
        }
    }
    else
    {
        for(int a = 1, b, c; a <= MaxClients; a++)
        {
            g_bUse[a] = false;
            for(b = 1; b <= MaxClients; b++) for(c = 0; c < 3; c++) g_bVote[a][b][c] = false;
        }
    }

    g_iType = 0;
    g_iTarget = 0;
    g_iPlayers = 0;
    g_iCount = 0;
    g_fCount = 0.0;
    g_fPercent = 0.0;
    g_sBuffer[0] = 0;
    g_sReason[0] = 0;
    g_iTimeTimer = 0;
    g_iChat = -1;
}

void GetType(int iType, char[] sType, int iSize)
{
    switch(iType)
    {
        case BAN: strcopy(sType, iSize, "ЗАБАНИТЬ");
        case KICK: strcopy(sType, iSize, "КИКНУТЬ");
        case MUTE: strcopy(sType, iSize, "ЗАМУТИТЬ");
    }
}

void GetKey(char[] sKey, int iSize)
{
    switch(g_iType)
    {
        case BAN: strcopy(sKey, iSize, "ban_settings");
        case KICK: strcopy(sKey, iSize, "kick_settings");
        case MUTE: strcopy(sKey, iSize, "mute_settings");
    }
}

bool CheckTarget(int iTarget, int iClient = 0)
{
    if(iTarget > 0 && IsClientInGame(iTarget)) return true;

    ClearVeriables(true);
    Log("Попытка создать голсоование... Игрока больше нет на сервере!");

    if(iClient != 0)
        CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Игрока больше нет на сервере!");

    return false;
}

bool CheckVote(int iClient)
{
    if(g_hTimer) return true;

    CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Нет на данный момент голосования!");
    return false;
}

bool IsAdminFlag(int iClient, char[] sFlag)
{
    int iFlagBits = GetUserFlagBits(iClient);

    if(iFlagBits & ReadFlagString("z") || iFlagBits & ReadFlagString(sFlag)) return true;
    return false;
}

int GetPlayers()
{
    int iPlayers;
    for(int i = 1; i <= MaxClients; i++)
    {
        if(IsClientInGame(i) && !IsFakeClient(i) && i != g_iTarget)
        {
            iPlayers++;
            if(IsAdminFlag(i, g_kvsFlag[1])) g_iPlayers++;
        }
    }

    return iPlayers;
}

void VoteClosed()
{
    ClearVeriables(true);
    DeleteTimer();
}

void DeleteTimer()
{
    if(g_hTimer)
    {
        KillTimer(g_hTimer);
        g_hTimer = null;
    }
}

void TimeLimit(int iClient, int iTime)
{
    char sKey[32];
    GetKey(sKey, sizeof(sKey)); g_hKeyValues.Rewind();
    if(g_hKeyValues.JumpToKey(sKey)) g_iTimeLimit[iClient] = g_hKeyValues.GetNum("TimeLimit") + iTime;
}

int GetAllVotes(float fPrecent)
{
    int iVotes;
    for(int i; i < g_iPlayers; i++)
    {
        fPrecent -= g_fPercent;
        if(fPrecent >= 0.0) iVotes++;
        else break;
    }

    return iVotes;
}

int GetVotes(int iTarget, int iType)
{
    int iVotes;
    for(int i = 1; i <= MaxClients; i++)
    {
        if(g_bVote[i][iTarget][iType]) iVotes++;
    }

    return iVotes;
}


void Log(const char[] sMessage, any ...)
{
    if(g_kvbLog)
    {
        char sBuffer[256];
        VFormat(sBuffer, sizeof(sBuffer), sMessage, 2);

        LogToFile(g_sLog, sBuffer);
    }
}

void UsePlugin(const char[] sName, bool bUse)
{
    if(StrEqual(sName, "basecomm")) g_bExpansion[0] = bUse;
    else if(StrEqual(sName, "SteamWorks")) g_bExpansion[1] = bUse;
}
 

DOK-26-RUS

Участник
Сообщения
264
Реакции
40
Это не ошибки, а предупреждения, плагин скомпилируется.

Попробуй так:
C-подобный:
#include <sdktools_gamerules>
#include <colorschat>

#undef REQUIRE_PLUGIN
#include <basecomm>

#undef REQUIRE_EXTENSIONS
#include <steamworks>

#pragma semicolon 1
#pragma newdecls required

public Plugin myinfo =
{
    name = "VoteBKM",
    description = "Голосование за бан, кик и мут игрока",
    author = "Drumanid",
    version = "1.0.7",
    url = "Discord: Drumanid#9108"
};

enum        {BAN, KICK, MUTE};
KeyValues    g_hKeyValues;
Menu        g_hMenu;
Handle        g_hTimer;

int            g_iType,
            g_iTarget,
            g_iPlayers,
            g_iCount,
            g_iTimeTimer,
            g_iTimeLimitAll,
            g_iTimeLimit[MAXPLAYERS +1],
            g_iChat;

float        g_fPercent,
            g_fCount;

char        g_sBuffer[256],
            g_sReason[64],
            g_sLog[128];

bool        g_bExpansion[2],
            g_bUse[MAXPLAYERS +1],
            g_bVote[MAXPLAYERS +1][MAXPLAYERS +1][3],
            g_bNoSteam[MAXPLAYERS +1];

//=================================================================

bool        g_kvbInBan,
            g_kvbInKick,
            g_kvbInMute,
            g_kvbType,
            g_kvbAdmins,
            g_kvbMessage,
            g_kvbMultiplier,
            g_kvbLog,
            g_kvbNoSteam,
            g_kvbMutePlayer;

int            g_kviTimeTimer,
            g_kviPlayersLimit,
            g_kviDisconnectBan,
            g_kviTimeBan,
            g_kviTimeLimitAll,
            g_kviPercent;

char        g_kvsFlag[2][4];

public APLRes AskPluginLoad2(Handle hMySelf, bool bLate, char[] szError, int iErrMax)
{
    if(GetEngineVersion() == Engine_CSGO) g_bGame = true;
    else g_bGame = false;
  
    return APLRes_Success;
}

public void OnAllPluginsLoaded()
{
    g_bExpansion[0] = LibraryExists("basecomm");
    g_bExpansion[1] = LibraryExists("SteamWorks");
}

public void OnLibraryRemoved(const char[] sName)
{
    UsePlugin(sName, false);
}

public void OnLibraryAdded(const char[] sName)
{
    UsePlugin(sName, true);
}

public void OnPluginStart()
{
    BuildPath(Path_SM, g_sLog, sizeof(g_sLog), "logs/VoteBKM.log");
  
    RegConsoleCmd("sm_voteban", BanCmd);
    RegConsoleCmd("sm_votekick", KickCmd);
    RegConsoleCmd("sm_votemute", MuteCmd);
    RegConsoleCmd("sm_rev", RevoteCmd);
    RegConsoleCmd("sm_votecancel", VoteCancelCmd);

    g_hMenu = new Menu(MenuVoteItems);
    g_hMenu.ExitButton = false;

    for(int i; i < 3; i++) g_hMenu.AddItem(NULL_STRING, NULL_STRING, ITEMDRAW_NOTEXT);
    g_hMenu.AddItem(NULL_STRING, "Наказать");
    g_hMenu.AddItem(NULL_STRING, "Не наказывать");
}

public void OnMapStart()
{
    if(g_hKeyValues != null) delete g_hKeyValues;

    char sPath[128];
    BuildPath(Path_SM, sPath, sizeof(sPath), "configs/votebkm.ini");

    g_hKeyValues = new KeyValues("VoteBKM");
    if(!g_hKeyValues.ImportFromFile(sPath)) SetFailState("No found file: '%s'", sPath);

    if(g_bExpansion[0]) g_kvbType = view_as<bool>(g_hKeyValues.GetNum("Type", 0));
    else g_kvbType = true;
    g_kvbInBan = view_as<bool>(g_hKeyValues.GetNum("InBan", 1));
    g_kvbInKick = view_as<bool>(g_hKeyValues.GetNum("InKick", 1));
    g_kvbInMute = view_as<bool>(g_hKeyValues.GetNum("InMute", 1));
    g_kvbAdmins = view_as<bool>(g_hKeyValues.GetNum("Admins", 0));
    g_kvbMessage = view_as<bool>(g_hKeyValues.GetNum("Message", 1));
    g_kvbMultiplier = view_as<bool>(g_hKeyValues.GetNum("Multiplier", 0));
    g_kvbLog = view_as<bool>(g_hKeyValues.GetNum("Log", 1));
    g_kvbNoSteam = view_as<bool>(g_hKeyValues.GetNum("NoSteam", 1));
    g_kvbMutePlayer = view_as<bool>(g_hKeyValues.GetNum("MutePlayer", 1));
    g_kviTimeTimer = g_hKeyValues.GetNum("Time", 20);
    g_kviPlayersLimit = g_hKeyValues.GetNum("PlayersLimit", 4);
    g_kviDisconnectBan = g_hKeyValues.GetNum("DisconnectBan", 60);
    g_kviTimeBan = g_hKeyValues.GetNum("TimeBan", 60);
    g_kviTimeLimitAll = g_hKeyValues.GetNum("TimeLimitAll", 30);
    g_kviPercent = g_hKeyValues.GetNum("VotePercent", 0);
    g_hKeyValues.GetString("FlagImmunity", g_kvsFlag[0], sizeof(g_kvsFlag[]), "t");
    g_hKeyValues.GetString("FlagCancel", g_kvsFlag[1], sizeof(g_kvsFlag[]), "d");

    ClearVeriables(false);
    DeleteTimer();
}

public Action BanCmd(int iClient, int iArgs)
{
    if(g_kvbInBan) Type(iClient, BAN);
    return Plugin_Handled;
}

public Action KickCmd(int iClient, int iArgs)
{
    if(g_kvbInKick) Type(iClient, KICK);
    return Plugin_Handled;
}

public Action MuteCmd(int iClient, int iArgs)
{
    if(g_kvbInMute) Type(iClient, MUTE);
    return Plugin_Handled;
}

public Action RevoteCmd(int iClient, int iArgs)
{
    if(iClient && CheckVote(iClient))
    {
        if(g_bUse[iClient])
        {
            g_bUse[iClient] = false; g_fCount -= g_fPercent; g_iCount--;
            if(g_kvbMessage) CPrintToChatAll("{WHITE}[{GREEN}VoteBKM{WHITE}] {GREEN}%N {WHITE}решил переголосовать!", iClient);
        }
        else CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Сначала проголосуйте, а потом сможете переголосовать!");
    }
    return Plugin_Handled;
}

public Action VoteCancelCmd(int iClient, int iArgs)
{
    if(iClient && CheckVote(iClient))
    {
        if(IsAdminFlag(iClient, g_kvsFlag[1]))
        {
            VoteClosed();
            Log("Администратор %L отменил голосование!\n ", iClient);
            CPrintToChatAll("{WHITE}[{GREEN}VoteBKM{WHITE}] {RED}Администратор {WHITE}отменил голосование!");
        }
        else CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] У вас нет доступа к этой команде!");
    }
    return Plugin_Handled;
}

void Type(int iClient, int iType)
{
    if(iClient < 1) return;

    if(g_kvbNoSteam && g_bExpansion[1] && g_bNoSteam[iClient])
    {
        CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Вы не можете этого сделать играя с пиратской версии игры!");
        return;
    }

    if(!g_kvbMutePlayer && g_bExpansion[0])
    {
        if(BaseComm_IsClientGagged(iClient) || BaseComm_IsClientMuted(iClient))
        {
            CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Вы не можете этого сделать т.к вы имеете блокировку чата или микрофона!");
            return;
        }
    }

    if(!g_bGame || !GameRules_GetProp("m_bWarmupPeriod"))
    {
        if(g_iTarget < 1)
        {
            int iTime = GetTime();
            if(g_iTimeLimitAll <= iTime)
            {
                if(GetPlayers() >= g_kviPlayersLimit)
                {
                    if(!g_kvbAdmins || g_iPlayers == 0)
                    {
                        if(g_iTimeLimit[iClient] <= iTime)
                        {
                            g_fPercent = 100.0 / float((g_iPlayers = GetPlayers()));
                          
                            Menu hMenu = new Menu(PlayerListMenuItems);
                            hMenu.ExitButton = true;

                            char sBuffer[64], sBuffer2[32]; int iCount, i;
                            GetType(iType, sBuffer, sizeof(sBuffer));

                            if(g_kviPercent == 0)
                            {
                                g_iTarget++;
                                hMenu.SetTitle("Выберите игрока которого хотите - '%s'\n ", sBuffer);

                                for(i = 1; i <= MaxClients; i++)
                                {
                                    if(IsClientInGame(i) && !IsFakeClient(i) && i != iClient)
                                    {
                                        GetClientName(i, sBuffer, sizeof(sBuffer));
                                        FormatEx(sBuffer2, sizeof(sBuffer2), "%i %i", GetClientUserId(i), iType);
                                        if(!IsAdminFlag(i, g_kvsFlag[0])) hMenu.AddItem(sBuffer2, sBuffer);
                                        else hMenu.AddItem(sBuffer2, sBuffer, ITEMDRAW_DISABLED);
                                        iCount++;
                                    }
                                }
                            }
                            else
                            {
                                hMenu.SetTitle("Выберите игрока которого хотите - '%s'\nДля того чтобы начать голосование, нужно:\n[n - текущее / n - необходимое] кол-во голосов\n ", sBuffer);

                                int iVotes[2];
                                for(i = 1; i <= MaxClients; i++)
                                {
                                    if(IsClientInGame(i) && !IsFakeClient(i) && i != iClient)
                                    {
                                        if(!IsAdminFlag(i, g_kvsFlag[0]))
                                        {
                                            iVotes[0] = GetAllVotes(float(g_kviPercent)); iVotes[1] = GetVotes(i, iType);
                                            if(!g_bVote[iClient][i][iType])
                                            {
                                                if(iVotes[0] > iVotes[1]) FormatEx(sBuffer, sizeof(sBuffer), "%N [%i/%i]", i, iVotes[1], iVotes[0]);
                                                else FormatEx(sBuffer, sizeof(sBuffer), "%N [Начать голосование]", i);
                                            }
                                            else FormatEx(sBuffer, sizeof(sBuffer), "%N [Забрать голос]", i);
                                            FormatEx(sBuffer2, sizeof(sBuffer2), "%i %i %i %i", GetClientUserId(i), iType, iVotes[0], iVotes[1]);
                                            hMenu.AddItem(sBuffer2, sBuffer);
                                        }
                                        else
                                        {
                                            FormatEx(sBuffer, sizeof(sBuffer), "%N [-/-]", i);
                                            hMenu.AddItem(NULL_STRING, sBuffer, ITEMDRAW_DISABLED);
                                        }
                                      
                                        iCount++;
                                    }
                                }

                                g_iPlayers = 0;
                            }

                            if(iCount == 0) CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] На данный момент нет подходящих игроков!");
                            hMenu.Display(iClient, 0);
                        }
                        else CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Вы недавно создавали голосование! Вы сможете запустить голосование только через {RED}%i{WHITE} секунд(у/ы)!", g_iTimeLimit[iClient] - iTime);
                    }
                    else CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Вы не сможете запустить голосование, т.к на сервере есть администратор!");
                }
                else CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Необходимо {RED}%i{WHITE} игрока, чтобы создать голосование!", g_kviPlayersLimit);
            }
            else CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Недавно было голосование! Игроки смогут запустить голосование только через {RED}%i{WHITE} секунд(у/ы)!", g_iTimeLimitAll - iTime);
        }
        else CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Вы не можете создать голосование, т.к его уже создали(ют)");
    }
    else CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Нельзя запустить голосование во время разминки!");
}

public int PlayerListMenuItems(Menu hMenu, MenuAction action, int iClient, int iItem)
{
    switch(action)
    {
        case MenuAction_End: delete hMenu;
        case MenuAction_Cancel:
        {
            if(g_kviPercent == 0 && (iItem == MenuCancel_Interrupted || iItem == MenuCancel_Timeout || iItem == MenuCancel_Exit)) g_iTarget = 0;
        }
        case MenuAction_Select:
        {
            char sBuffer[24], sExplodeBuffer[4][8]; int iTarget;
            hMenu.GetItem(iItem, sBuffer, sizeof(sBuffer));
            ExplodeString(sBuffer, " ", sExplodeBuffer, sizeof(sExplodeBuffer), sizeof(sExplodeBuffer[]));
            if(!CheckTarget((iTarget = GetClientOfUserId(StringToInt(sExplodeBuffer[0]))), iClient)) return 0;
          
            int iType = StringToInt(sExplodeBuffer[1]);
            if(g_kviPercent != 0)
            {
                if(!g_bVote[iClient][iTarget][iType])
                {
                    g_bVote[iClient][iTarget][iType] = true; int iVotes[2];
                    iVotes[0] = StringToInt(sExplodeBuffer[2]); iVotes[1] = StringToInt(sExplodeBuffer[3]) +1;
                  
                    if(iVotes[1] < iVotes[0])
                    {
                        CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Необходимо еще {RED}%i{WHITE} голос(а), чтобы создать голосование за наказание данного игрока!", iVotes[0] - iVotes[1]);
                        if(g_kvbMessage) CPrintToChatAll("{WHITE}[{GREEN}VoteBKM{WHITE}] {GREEN}%N {WHITE}отдал свой голос за наказание игрока {RED}%N", iClient, iTarget);
                        return 0;
                    }
                }
                else
                {
                    g_bVote[iClient][iTarget][iType] = false;
                    if(g_kvbMessage) CPrintToChatAll("{WHITE}[{GREEN}VoteBKM{WHITE}] {GREEN}%N {WHITE}забрал свой голос с игрока {RED}%N!", iClient, iTarget);
                    return 0;
                }
            }

            g_iType = iType;
            g_iTarget = iTarget;
            ReasonMenu(iClient);
        }
    }
    return 0;
}

void ReasonMenu(int iClient)
{
    if(!CheckTarget(g_iTarget, iClient)) return;

    Menu hMenu = new Menu(ReasonMenuItems);
    hMenu.ExitButton = true;

    hMenu.SetTitle("Выбранный игрок: %N\nВыберите причину наказания:\n ", g_iTarget);

    char sKey[32];
    switch(g_iType)
    {
        case BAN: sKey = "ban_reason";
        case KICK: sKey = "kick_reason";
        case MUTE: sKey = "mute_reason";
    }

    g_hKeyValues.Rewind();
    if(g_hKeyValues.JumpToKey(sKey) && g_hKeyValues.GotoFirstSubKey(false))
    {
        char sReason[2][64];
        do
        {
            g_hKeyValues.GetSectionName(sReason[0], sizeof(sReason[]));
            g_hKeyValues.GetString(NULL_STRING, sReason[1], sizeof(sReason[]));
            hMenu.AddItem(sReason[0], sReason[1]);
        }
        while(g_hKeyValues.GotoNextKey(false));
    }
    else g_iTarget = 0;

    hMenu.Display(iClient, 0);
}

public int ReasonMenuItems(Menu hMenu, MenuAction action, int iClient, int iItem)
{
    switch(action)
    {
        case MenuAction_End: delete hMenu;
        case MenuAction_Cancel:
        {
            if(iItem == MenuCancel_Interrupted || iItem == MenuCancel_Timeout || iItem == MenuCancel_Exit) g_iTarget = 0;
        }
        case MenuAction_Select:
        {
            hMenu.GetItem(iItem, g_sReason, sizeof(g_sReason));
            if(StrContains(g_sReason, "chat", false) == 0)
            {
                g_hTimer = CreateTimer(15.0, TimerChat, GetClientUserId(iClient));
                CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Введите причину в чате, вам дано {GREEN}15 {WHITE}секунд!");
                g_iChat = iClient; return 0;
            }

            ConfirmationMenu(iClient);
        }
    }
    return 0;
}

public Action TimerChat(Handle hTimer, any iClient)
{
    iClient = GetClientOfUserId(iClient);
    if(IsClientInGame(iClient))
    {
        CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Вы не успели ввести причину!");
        g_iChat = -1; g_iTarget = 0; TimeLimit(iClient, GetTime());
    }
    else g_iTarget = 0;

    g_hTimer = null;
    return Plugin_Stop;
}

void ConfirmationMenu(int iClient)
{
    if(!CheckTarget(g_iTarget, iClient)) return;

    Menu hMenu = new Menu(ConfirmationMenuItems);
    hMenu.ExitButton = false;

     char sType[32];
     GetType(g_iType, sType, sizeof(sType));
    hMenu.SetTitle("Вы хотите %s игрока %N?\nПричина: %s\n ", sType, g_iTarget, g_sReason);

    for(int i; i < 3; i++) hMenu.AddItem(NULL_STRING, NULL_STRING, ITEMDRAW_NOTEXT);
    hMenu.AddItem(NULL_STRING, "Да");
    hMenu.AddItem(NULL_STRING, "Нет, изменить причину!");
    hMenu.AddItem(NULL_STRING, "Нет, отменить голосование!");
    hMenu.Display(iClient, 0);
}

public int ConfirmationMenuItems(Menu hMenu, MenuAction action, int iClient, int iItem)
{
    switch(action)
    {
        case MenuAction_End: delete hMenu;
        case MenuAction_Cancel:
        {
            if(iItem == MenuCancel_Interrupted || iItem == MenuCancel_Timeout) g_iTarget = 0;
        }
        case MenuAction_Select:
        {
            switch(iItem)
            {
                case 3:
                {
                    if(!CheckTarget(g_iTarget, iClient)) return 0;
                    g_iPlayers--;

                    int iTime = GetTime();
                    g_iTimeLimitAll = iTime + g_kviTimeLimitAll;
                    TimeLimit(iClient, iTime);

                    g_iTimeTimer = g_kviTimeTimer;
                    g_hTimer = CreateTimer(1.0, TimerReturnMenu, _, TIMER_REPEAT);

                    char sReason[64], sType[32];
                    FormatEx(sReason, sizeof(sReason), "%s", g_sReason);
                    switch(g_iType)
                    {
                        case BAN:
                        {
                            sType = "забанить";
                            FormatEx(g_sReason, sizeof(g_sReason), "[VOTEBAN] Причина: %s", sReason);
                          
                        }
                        case KICK:
                        {
                            sType = "кикнуть";
                            FormatEx(g_sReason, sizeof(g_sReason), "[VOTEKICK] Причина: %s", sReason);
                        }
                        case MUTE:
                        {
                            sType = "замутить";
                            FormatEx(g_sReason, sizeof(g_sReason), "[VOTEMUTE] Причина: %s", sReason);
                        }
                    }

                    FormatEx(g_sBuffer, sizeof(g_sBuffer), "Игрок: %N\nХочет %s игрока: %N\nПричина: %s", iClient, sType, g_iTarget, sReason);
                    Log("Игрок %L хочет %s игрока %L | Причина: %s", iClient, sType, g_iTarget, sReason);
                    CPrintToChatAll("{WHITE}[{GREEN}VoteBKM{WHITE}] {GREEN}%N {WHITE}хочет {RED}%s {WHITE}игрока {RED}%N{WHITE}. Создано голосование! Причина: {RED}%s", iClient, sType, g_iTarget, sReason);

                    Voted(iClient, true);
                }
                case 4: ReasonMenu(iClient);
                case 5: g_iTarget = 0;
            }
        }
    }
    return 0;
}

public int MenuVoteItems(Menu hMenu, MenuAction action, int iClient, int iItem)
{
    if(action == MenuAction_Select)
    {
        if(!CheckTarget(g_iTarget, iClient)) return 0;

        char sMessage[32];
        switch(iItem)
        {
            case 3:
            {
                Voted(iClient, true);
                sMessage = "за наказание";
            }
            case 4:
            {
                Voted(iClient, false);
                sMessage = "не наказывать";
            }
        }

        if(g_kvbMessage) CPrintToChatAll("{WHITE}[{GREEN}VoteBKM{WHITE}] Игрок {GREEN}%N {WHITE}голосует - {GREEN}%s{WHITE} игрока", iClient, sMessage);
        CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Введите в чат {RED}!rev{WHITE}, чтобы переголосовать!");
        if(g_iPlayers == g_iCount) FinishVote();
    }
    return 0;
}

public Action TimerReturnMenu(Handle hTimer)
{
    if(--g_iTimeTimer > 0)
    {
        for(int i = 1; i <= MaxClients; i++)
        {
            if(IsClientInGame(i) && !IsFakeClient(i) && i != g_iTarget && !g_bUse[i])
            {
                g_hMenu.SetTitle("%s\nОсталось время на выбор: %i\n ", g_sBuffer, g_iTimeTimer);
                g_hMenu.Display(i, 1);
            }
        }

        return Plugin_Continue;
    }

    FinishVote();
    g_hTimer = null;
    return Plugin_Stop;
}

void Voted(int iClient, bool bUse)
{
    g_iCount++; g_bUse[iClient] = true;

    if(bUse)
    {
        if(IsAdminFlag(iClient, g_kvsFlag[1]))
        {
            CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Введите {RED}!votecancel{WHITE}, чтобы отменить голсование!");
            if(g_kvbMultiplier)
            {
                g_fCount += g_fPercent * 2;
                return;
            }
        }

        g_fCount += g_fPercent;
    }
}

void FinishVote()
{
    char sBuffers[256]; int iPercent;
    GetKey(sBuffers, sizeof(sBuffers)); g_hKeyValues.Rewind();
    if(g_hKeyValues.JumpToKey(sBuffers))
    {
        g_hKeyValues.GetString("Command", sBuffers, sizeof(sBuffers));
        iPercent = g_hKeyValues.GetNum("Percent");
    }

    if(RoundToCeil(g_fCount) >= iPercent)
    {
        if(!CheckTarget(g_iTarget, _)) return;
        Log("Игрок %L был наказан!\n ", g_iTarget);

        if(g_kvbType)
        {
            char sReplace[40], sBuffer[32];
            if(StrContains(sBuffers, "{UID}", true) != -1)
            {
                IntToString(GetClientUserId(g_iTarget), sBuffer, sizeof(sBuffer));
                FormatEx(sReplace, sizeof(sReplace), "\"#%s\"", sBuffer);
                ReplaceString(sBuffers, sizeof(sBuffers), "{UID}", sReplace, true);
            }
            else if(StrContains(sBuffers, "{NAME}", true) != -1)
            {
                GetClientName(g_iTarget, sBuffer, sizeof(sBuffer));
                FormatEx(sReplace, sizeof(sReplace), "\"%s\"", sBuffer);
                ReplaceString(sBuffers, sizeof(sBuffers), "{NAME}", sReplace, true);
            }
            else if(StrContains(sBuffers, "{STEAMID}", true) != -1)
            {
                GetClientAuthId(g_iTarget, AuthId_Steam2, sBuffer, sizeof(sBuffer));
                FormatEx(sReplace, sizeof(sReplace), "\"%s\"", sBuffer);
                ReplaceString(sBuffers, sizeof(sBuffers), "{STEAMID}", sReplace, true);
            }

            if(StrContains(sBuffers, "{REASON}", true) != -1) ReplaceString(sBuffers, sizeof(sBuffers), "{REASON}", g_sReason, true);
            ServerCommand(sBuffers);
        }
        else
        {
            switch(g_iType)
            {
                case BAN: BanClient(g_iTarget, g_kviTimeBan, BANFLAG_AUTO, g_sReason);
                case KICK: KickClient(g_iTarget, g_sReason);
                case MUTE:
                {
                    BaseComm_SetClientGag(g_iTarget, true); BaseComm_SetClientMute(g_iTarget, true);
                    CPrintToChat(g_iTarget, "{WHITE}[{GREEN}VoteBKM{WHITE}] Вы получили мут! {WHITE}Причина: {RED}%s", g_sReason);
                }
            }
        }
              
        sBuffers = "Голосование завершено, игрок был наказан!";
    }
    else
    {
        Log("Игрок %L не был наказан, недостаточно голосов!\n ", g_iTarget);
        sBuffers = "Недостаточно голосов, голосование завершено!";
    }

    if(g_iPlayers == -1)
    {
        CPrintToChatAll("{WHITE}[{GREEN}VoteBKM{WHITE}] Проголосовало {GREEN}%i {WHITE}игрок(а/ов) из {RED}%i{WHITE} игроков. %s", g_iCount, sBuffers);
        Log("-1? - g_iCount: %i | g_iPlayers: %i | g_iTarget: %i | g_fCount: %f | g_fPercent: %f | g_sBuffer[0]: %s | g_sReason[0]: %s | g_iTimeTimer: %i | g_iChat: %i",
        g_iCount, g_iPlayers, g_iTarget, g_fCount, g_fPercent, g_sBuffer[0], g_sReason[0], g_iTimeTimer, g_iChat);
    }
    else
        CPrintToChatAll("{WHITE}[{GREEN}VoteBKM{WHITE}] Проголосовало {GREEN}%i {WHITE}игрок(а/ов) из {RED}%i{WHITE} игроков. %s", g_iCount, g_iPlayers, sBuffers);
      
    VoteClosed();
}

public void OnClientPostAdminCheck(int iClient)
{
    if(g_kvbNoSteam && g_bExpansion[1] && !IsFakeClient(iClient))
    {
        if(g_bGame && SteamWorks_HasLicenseForApp(iClient, 730) == k_EUserHasLicenseResultDoesNotHaveLicense) g_bNoSteam[iClient] = true;
        else if(!g_bGame && SteamWorks_HasLicenseForApp(iClient, 240) == k_EUserHasLicenseResultDoesNotHaveLicense) g_bNoSteam[iClient] = true;
    }
}

public void OnClientDisconnect(int iClient)
{
    g_bUse[iClient] = false;
    g_bNoSteam[iClient] = false;
    g_iTimeLimit[iClient] = 0;
    if(g_iChat == iClient) g_iChat = -1;

    int a, b;
    for(a = 1; a <= MaxClients; a++)
    { 
        for(b = 0; b < 3; b++) g_bVote[iClient][a][b] = false;
    }

    if(g_fPercent > 0.0 && g_iTarget == iClient && !IsFakeClient(iClient))
    {
        Log("Игрок %L вышел во время голосования!\n ", iClient);
        BanClient(iClient, g_kviDisconnectBan, BANFLAG_AUTO, "Покинул сервер во время голосования");
        CPrintToChatAll("{WHITE}[{GREEN}VoteBKM{WHITE}] {RED}Игрок вышел с сервера, голсоование завершено!");
        VoteClosed();
    }
}

public Action OnClientSayCommand(int iClient, const char[] sCommand, const char[] sArgs)
{
    if(g_kvbInBan && StrContains(sArgs, "voteban", false) == 0)
    {
        Type(iClient, BAN);
        return Plugin_Handled;
    }
    else if(g_kvbInKick && StrContains(sArgs, "votekick", false) == 0)
    {
        Type(iClient, KICK);
        return Plugin_Handled;
    }
    else if(g_kvbInMute && StrContains(sArgs, "votemute", false) == 0)
    {
        Type(iClient, MUTE);
        return Plugin_Handled;
    }
    else if(g_iChat == iClient)
    {
        FormatEx(g_sReason, sizeof(g_sReason), "%s", sArgs);
        g_iChat = -1; DeleteTimer();

        ConfirmationMenu(iClient);
        return Plugin_Handled;
    }

    return Plugin_Continue;
}

void ClearVeriables(bool bUse)
{
    if(bUse)
    {
        for(int i = 1; i <= MaxClients; i++)
        {
            g_bUse[i] = false;
            g_bVote[i][g_iTarget][g_iType] = false;
        }
    }
    else
    {
        for(int a = 1, b, c; a <= MaxClients; a++)
        {
            g_bUse[a] = false;
            for(b = 1; b <= MaxClients; b++) for(c = 0; c < 3; c++) g_bVote[a][b][c] = false;
        }
    }

    g_iType = 0;
    g_iTarget = 0;
    g_iPlayers = 0;
    g_iCount = 0;
    g_fCount = 0.0;
    g_fPercent = 0.0;
    g_sBuffer[0] = 0;
    g_sReason[0] = 0;
    g_iTimeTimer = 0;
    g_iChat = -1;
}

void GetType(int iType, char[] sType, int iSize)
{
    switch(iType)
    {
        case BAN: strcopy(sType, iSize, "ЗАБАНИТЬ");
        case KICK: strcopy(sType, iSize, "КИКНУТЬ");
        case MUTE: strcopy(sType, iSize, "ЗАМУТИТЬ");
    }
}

void GetKey(char[] sKey, int iSize)
{
    switch(g_iType)
    {
        case BAN: strcopy(sKey, iSize, "ban_settings");
        case KICK: strcopy(sKey, iSize, "kick_settings");
        case MUTE: strcopy(sKey, iSize, "mute_settings");
    }
}

bool CheckTarget(int iTarget, int iClient = 0)
{
    if(iTarget > 0 && IsClientInGame(iTarget)) return true;

    ClearVeriables(true);
    Log("Попытка создать голсоование... Игрока больше нет на сервере!");

    if(iClient != 0)
        CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Игрока больше нет на сервере!");

    return false;
}

bool CheckVote(int iClient)
{
    if(g_hTimer) return true;

    CPrintToChat(iClient, "{WHITE}[{GREEN}VoteBKM{WHITE}] Нет на данный момент голосования!");
    return false;
}

bool IsAdminFlag(int iClient, char[] sFlag)
{
    int iFlagBits = GetUserFlagBits(iClient);

    if(iFlagBits & ReadFlagString("z") || iFlagBits & ReadFlagString(sFlag)) return true;
    return false;
}

int GetPlayers()
{
    int iPlayers;
    for(int i = 1; i <= MaxClients; i++)
    {
        if(IsClientInGame(i) && !IsFakeClient(i) && i != g_iTarget)
        {
            iPlayers++;
            if(IsAdminFlag(i, g_kvsFlag[1])) g_iPlayers++;
        }
    }

    return iPlayers;
}

void VoteClosed()
{
    ClearVeriables(true);
    DeleteTimer();
}

void DeleteTimer()
{
    if(g_hTimer)
    {
        KillTimer(g_hTimer);
        g_hTimer = null;
    }
}

void TimeLimit(int iClient, int iTime)
{
    char sKey[32];
    GetKey(sKey, sizeof(sKey)); g_hKeyValues.Rewind();
    if(g_hKeyValues.JumpToKey(sKey)) g_iTimeLimit[iClient] = g_hKeyValues.GetNum("TimeLimit") + iTime;
}

int GetAllVotes(float fPrecent)
{
    int iVotes;
    for(int i; i < g_iPlayers; i++)
    {
        fPrecent -= g_fPercent;
        if(fPrecent >= 0.0) iVotes++;
        else break;
    }

    return iVotes;
}

int GetVotes(int iTarget, int iType)
{
    int iVotes;
    for(int i = 1; i <= MaxClients; i++)
    {
        if(g_bVote[i][iTarget][iType]) iVotes++;
    }

    return iVotes;
}


void Log(const char[] sMessage, any ...)
{
    if(g_kvbLog)
    {
        char sBuffer[256];
        VFormat(sBuffer, sizeof(sBuffer), sMessage, 2);

        LogToFile(g_sLog, sBuffer);
    }
}

void UsePlugin(const char[] sName, bool bUse)
{
    if(StrEqual(sName, "basecomm")) g_bExpansion[0] = bUse;
    else if(StrEqual(sName, "SteamWorks")) g_bExpansion[1] = bUse;
}
Получается так

//// VoteBKM.sp
//
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(427) : warning 217: inconsistent indentation (did you mix tabs and spaces?)
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(429) : warning 217: inconsistent indentation (did you mix tabs and spaces?)
// Code size: 31556 bytes
// Data size: 82580 bytes
// Stack/heap size: 17404 bytes
// Total requirements: 131540 bytes
//
// 2 Warnings.
//
// Compilation Time: 0,33 sec
// ----------------------------------------
 

Mr_panica

XenForo one 💖
Сообщения
921
Реакции
435
Получается так

//// VoteBKM.sp
//
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(427) : warning 217: inconsistent indentation (did you mix tabs and spaces?)
// C:\sourcemod-csgo\sourcemod\scripting\VoteBKM.sp(429) : warning 217: inconsistent indentation (did you mix tabs and spaces?)
// Code size: 31556 bytes
// Data size: 82580 bytes
// Stack/heap size: 17404 bytes
// Total requirements: 131540 bytes
//
// 2 Warnings.
//
// Compilation Time: 0,33 sec
// ----------------------------------------
Это предупреждение выводится когда смешиваешь отступы и пробелы, вроде, возможно в настройках компилятора можно выключить, ни на что не влияет.

Лучше скину файлом, не должно быть предупреждений больше.
 

Вложения

  • VoteBKM.sp
    25.5 КБ · Просмотры: 17

DOK-26-RUS

Участник
Сообщения
264
Реакции
40
через консоль ни чего не делает, а если силами плагина, то в SB ни чего нет
 

ilya85i

Участник
Сообщения
41
Реакции
2
Здравствуйте. Нужна помощь в настройке плагина Votebkm. Плагин установлен на сервере cs go режим Запретная зона. Когда запущено голосование, то голосуют только живые игроки, мёртвые не могут и голосование не набирает необходимое количество голосов. Подскажите как правильно настроить этот плагин под этот режим игры.
 

khood

Участник
Сообщения
214
Реакции
51
fix pls
C++:
L 05/04/2024 - 10:51:21: [SM] Exception reported: String formatted incorrectly - parameter 4 (total 3)
L 05/04/2024 - 10:51:21: [SM] Blaming: VoteBKM.smx
L 05/04/2024 - 10:51:21: [SM] Call stack trace:
L 05/04/2024 - 10:51:21: [SM]   [0] VFormat
L 05/04/2024 - 10:51:21: [SM]   [1] Line 71, C:\Users\unknown\Desktop\SM 1.11 6962\include\morecolors.inc::CPrintToChatAll
L 05/04/2024 - 10:51:21: [SM]   [2] Line 629, C:\Users\unknown\Desktop\SM 1.11 6962\VoteBKM.sp::FinishVote
L 05/04/2024 - 10:51:21: [SM]   [3] Line 540, C:\Users\unknown\Desktop\SM 1.11 6962\VoteBKM.sp::TimerReturnMenu
 

BossKotoriiNeSmok

Участник
Сообщения
976
Реакции
189
Флудит ужас, а так работает с сб++ все выводит)
Есть у кого фикс от засирания логов?

C-подобный:
L 06/02/2024 - 01:07:51: [SM] Exception reported: String formatted incorrectly - parameter 4 (total 3)
L 06/02/2024 - 01:07:51: [SM] Blaming: VoteBKM.smx
L 06/02/2024 - 01:07:51: [SM] Call stack trace:
L 06/02/2024 - 01:07:51: [SM]   [0] VFormat
L 06/02/2024 - 01:07:51: [SM]   [1] Line 70, D:\Downloads\Comilator\include\colorschat.inc::CPrintToChatAll
L 06/02/2024 - 01:07:51: [SM]   [2] Line 628, D:\Downloads\Comilator\VoteBKM.sp::FinishVote
L 06/02/2024 - 01:07:51: [SM]   [3] Line 539, D:\Downloads\Comilator\VoteBKM.sp::TimerReturnMenu
L 06/02/2024 - 01:07:52: [SM] Exception reported: String formatted incorrectly - parameter 4 (total 3)
L 06/02/2024 - 01:07:52: [SM] Blaming: VoteBKM.smx
L 06/02/2024 - 01:07:52: [SM] Call stack trace:
L 06/02/2024 - 01:07:52: [SM]   [0] VFormat
L 06/02/2024 - 01:07:52: [SM]   [1] Line 70, D:\Downloads\Comilator\include\colorschat.inc::CPrintToChatAll
L 06/02/2024 - 01:07:52: [SM]   [2] Line 628, D:\Downloads\Comilator\VoteBKM.sp::FinishVote
L 06/02/2024 - 01:07:52: [SM]   [3] Line 539, D:\Downloads\Comilator\VoteBKM.sp::TimerReturnMenu
L 06/02/2024 - 01:07:53: [SM] Exception reported: String formatted incorrectly - parameter 4 (total 3)
L 06/02/2024 - 01:07:53: [SM] Blaming: VoteBKM.smx
L 06/02/2024 - 01:07:53: [SM] Call stack trace:
L 06/02/2024 - 01:07:53: [SM]   [0] VFormat
L 06/02/2024 - 01:07:53: [SM]   [1] Line 70, D:\Downloads\Comilator\include\colorschat.inc::CPrintToChatAll
L 06/02/2024 - 01:07:53: [SM]   [2] Line 628, D:\Downloads\Comilator\VoteBKM.sp::FinishVote
L 06/02/2024 - 01:07:53: [SM]   [3] Line 539, D:\Downloads\Comilator\VoteBKM.sp::TimerReturnMenu
L 06/02/2024 - 01:11:18: [SM] Exception reported: String formatted incorrectly - parameter 4 (total 3)
L 06/02/2024 - 01:11:18: [SM] Blaming: VoteBKM.smx
L 06/02/2024 - 01:11:18: [SM] Call stack trace:
L 06/02/2024 - 01:11:18: [SM]   [0] VFormat
L 06/02/2024 - 01:11:18: [SM]   [1] Line 70, D:\Downloads\Comilator\include\colorschat.inc::CPrintToChatAll
L 06/02/2024 - 01:11:18: [SM]   [2] Line 628, D:\Downloads\Comilator\VoteBKM.sp::FinishVote
L 06/02/2024 - 01:11:18: [SM]   [3] Line 539, D:\Downloads\Comilator\VoteBKM.sp::TimerReturnMenu
 

BossKotoriiNeSmok

Участник
Сообщения
976
Реакции
189
Стоит "NoSteam" "1" // 1 - позволять игрокам играющие с пиратской версии игры создавать голосования | 0 - запретить , но они все равно не могут голосовать(
 

BossKotoriiNeSmok

Участник
Сообщения
976
Реакции
189
Флудит ужас, а так работает с сб++ все выводит)
Есть у кого фикс от засирания логов?

C-подобный:
L 06/02/2024 - 01:07:51: [SM] Exception reported: String formatted incorrectly - parameter 4 (total 3)
L 06/02/2024 - 01:07:51: [SM] Blaming: VoteBKM.smx
L 06/02/2024 - 01:07:51: [SM] Call stack trace:
L 06/02/2024 - 01:07:51: [SM]   [0] VFormat
L 06/02/2024 - 01:07:51: [SM]   [1] Line 70, D:\Downloads\Comilator\include\colorschat.inc::CPrintToChatAll
L 06/02/2024 - 01:07:51: [SM]   [2] Line 628, D:\Downloads\Comilator\VoteBKM.sp::FinishVote
L 06/02/2024 - 01:07:51: [SM]   [3] Line 539, D:\Downloads\Comilator\VoteBKM.sp::TimerReturnMenu
L 06/02/2024 - 01:07:52: [SM] Exception reported: String formatted incorrectly - parameter 4 (total 3)
L 06/02/2024 - 01:07:52: [SM] Blaming: VoteBKM.smx
L 06/02/2024 - 01:07:52: [SM] Call stack trace:
L 06/02/2024 - 01:07:52: [SM]   [0] VFormat
L 06/02/2024 - 01:07:52: [SM]   [1] Line 70, D:\Downloads\Comilator\include\colorschat.inc::CPrintToChatAll
L 06/02/2024 - 01:07:52: [SM]   [2] Line 628, D:\Downloads\Comilator\VoteBKM.sp::FinishVote
L 06/02/2024 - 01:07:52: [SM]   [3] Line 539, D:\Downloads\Comilator\VoteBKM.sp::TimerReturnMenu
L 06/02/2024 - 01:07:53: [SM] Exception reported: String formatted incorrectly - parameter 4 (total 3)
L 06/02/2024 - 01:07:53: [SM] Blaming: VoteBKM.smx
L 06/02/2024 - 01:07:53: [SM] Call stack trace:
L 06/02/2024 - 01:07:53: [SM]   [0] VFormat
L 06/02/2024 - 01:07:53: [SM]   [1] Line 70, D:\Downloads\Comilator\include\colorschat.inc::CPrintToChatAll
L 06/02/2024 - 01:07:53: [SM]   [2] Line 628, D:\Downloads\Comilator\VoteBKM.sp::FinishVote
L 06/02/2024 - 01:07:53: [SM]   [3] Line 539, D:\Downloads\Comilator\VoteBKM.sp::TimerReturnMenu
L 06/02/2024 - 01:11:18: [SM] Exception reported: String formatted incorrectly - parameter 4 (total 3)
L 06/02/2024 - 01:11:18: [SM] Blaming: VoteBKM.smx
L 06/02/2024 - 01:11:18: [SM] Call stack trace:
L 06/02/2024 - 01:11:18: [SM]   [0] VFormat
L 06/02/2024 - 01:11:18: [SM]   [1] Line 70, D:\Downloads\Comilator\include\colorschat.inc::CPrintToChatAll
L 06/02/2024 - 01:11:18: [SM]   [2] Line 628, D:\Downloads\Comilator\VoteBKM.sp::FinishVote
L 06/02/2024 - 01:11:18: [SM]   [3] Line 539, D:\Downloads\Comilator\VoteBKM.sp::TimerReturnMenu
Нет не у кого?
 
Сверху Снизу