[APS] Ban

reapi module gmx [APS] Ban 0.1.84-alpha

Нет прав для скачивания
Установка
  1. Скопируйте файлы согласно директориям
  2. Откройте aps_ban.sma и скомпилируйте плагин (инструкция).
  3. Скопируйте скомпилированный aps_ban.amxx в директорию "addons/amxmodx/plugins".
  4. Раскомментируйте aps_ban.amxx в /amxmodx/configs/plugins-aps.ini
Настройки
В .sma
Флаг доступа для бана (строка 6)
Код:
const FLAG_ACCESS = ADMIN_BAN;      // Bans flag access
Вывод своего текста игроку при бане (строка 72)
Код:
rh_drop_client(id, "Вы были забанены! Детали в консоли или на сайте.");
aps_ban_console.txt
Настройка своего текста для вывода в консоль игроку
Код:
[ЗАБАНЕН]-------------------------------------[ЗАБАНЕН]
||| Вы забанены! Демо в группу!
||| Ник: %PLAYER_NAME% sdfsd
||| IP: %PLAYER_IP%
||| STEAM_ID: %PLAYER_STEAMID%
||| Причина: %REASON%
||| Бан выдан: %CREATED%
||| Забанен на: %TIME%
||| Еще осталось: %LEFT%
||| Бан истекает: %EXPIRED%
||| Заявки на разбан: группа
[ЗАБАНЕН]-------------------------------------[ЗАБАНЕН]
API
Код:
#if defined _aps_plmenu_included
    #endinput
#endif
#define _aps_plmenu_included

enum APS_PlMenu_Item {
    APS_PlMenu_InvalidItem = -1,
};

enum APS_PlMenu_Handler {
    APS_PlMenu_Handler_Default = -2,
    APS_PlMenu_Handler_Invaild = -1,
};

forward APS_PlMenu_Inited();
forward APS_PlMenu_CheckAccess(const player, const target, const APS_PlMenu_Item:item);

// handler(const admin, const player, const reason[], const itme, const extra)
stock APS_PlMenu_Handler:APS_PlMenu_CreateHandler(const handler[]) {
    return APS_PlMenu_Handler:CreateOneForward(get_plugin(-1), handler, FP_CELL, FP_CELL, FP_STRING, FP_CELL, FP_CELL);
}

stock APS_PlMenu_DestroyHandler(APS_PlMenu_Handler:handler) {
    if (handler >= 0) {
        DestroyForward(handler);
    }
}

stock APS_PlMenu_Item:APS_PlMenu_Add(
    const APS_Type:type, const title[],
    const APS_PlMenu_Handler:handler = APS_PlMenu_Handler_Default,
    const APS_PlMenu_Handler:resonHandler = APS_PlMenu_Handler_Default,
    const APS_PlMenu_Handler:timeHandler = APS_PlMenu_Handler_Default,
    const APS_PlMenu_Handler:extraHandler = APS_PlMenu_Handler_Invaild,
    const bool:needConfirm = true
) {
    new pluginID = APS_PlMenu_GetPluginID();
    if (pluginID == -1) {
        return APS_PlMenu_InvalidItem;
    }
    new func = get_func_id("APS_PlMenu_Add", pluginID);
    if (func == -1) {
        return APS_PlMenu_InvalidItem;
    }
  
    if (callfunc_begin_i(func, pluginID) != 1) {
        return APS_PlMenu_InvalidItem;
    }
    callfunc_push_int(_:type);
    callfunc_push_str(title);
    callfunc_push_int(_:handler);
    callfunc_push_int(_:resonHandler);
    callfunc_push_int(_:timeHandler);
    callfunc_push_int(_:extraHandler);
    callfunc_push_int(_:needConfirm);
    return APS_PlMenu_Item:callfunc_end();
}

stock bool:APS_PlMenu_NextStep(const admin, const value) {
    new pluginID = APS_PlMenu_GetPluginID();
    if (pluginID == -1) {
        return false;
    }
    new func = get_func_id("APS_PlMenu_NextStep", pluginID);
    if (func == -1) {
        return false;
    }
  
    if (callfunc_begin_i(func, pluginID) != 1) {
        return false;
    }
    callfunc_push_int(admin);
    callfunc_push_int(value);
    callfunc_end();
  
    return true;
}

stock bool:APS_PlMenu_PrevStep(const admin) {
    new pluginID = APS_PlMenu_GetPluginID();
    if (pluginID == -1) {
        return false;
    }
    new func = get_func_id("APS_PlMenu_PrevStep", pluginID);
    if (func == -1) {
        return false;
    }
  
    if (callfunc_begin_i(func, pluginID) != 1) {
        return false;
    }
    callfunc_push_int(admin);
    callfunc_end();
  
    return true;
}

stock APS_PlMenu_GetPlayer(const admin) {
    new pluginID = APS_PlMenu_GetPluginID();
    if (pluginID == -1) {
        return -1;
    }
    new func = get_func_id("APS_PlMenu_GetPlayer", pluginID);
    if (func == -1) {
        return -1;
    }
  
    if (callfunc_begin_i(func, pluginID) != 1) {
        return -1;
    }
    callfunc_push_int(admin);
    return callfunc_end();
}

stock bool:APS_PlMenu_Show(const admin, const player = 0, const APS_PlMenu_Item:item = APS_PlMenu_InvalidItem, const reason = -1, const time = -1, const extra = 0) {
    new pluginID = APS_PlMenu_GetPluginID();
    if (pluginID == -1) {
        return false;
    }
    new func = get_func_id("APS_PlMenu_Show", pluginID);
    if (func == -1) {
        return false;
    }
  
    if (callfunc_begin_i(func, pluginID) != 1) {
        return false;
    }
    callfunc_push_int(admin);
    callfunc_push_int(player);
    callfunc_push_int(_:item);
    callfunc_push_int(reason);
    callfunc_push_int(time);
    callfunc_push_int(extra);
    return bool:callfunc_end();
}

stock APS_PlMenu_GetPluginID() {
    static pluginID = -1;
    if (pluginID == -1) {
        new plugin = get_plugin(-1);
      
        for(new i, n = get_pluginsnum(), status[2], func; i < n; i++) {
            if (plugin == i) {
                continue;
            }
          
            get_plugin(i, .status = status, .len5 = charsmax(status));

            //status debug || status running
            if (status[0] != 'd' && status[0] != 'r') {
                continue;
            }
      
            func = get_func_id("APS_PlMenu_Main", i);

            if (func != -1) {
                pluginID = i;
                break;
            }
        }
    }
  
    return pluginID;
}
Код:
#if defined _aps_time_included
    #endinput
#endif
#define _aps_time_included

enum _:APS_TIME_ELEMENT {
    APS_TIME_ELEMENT_SECONDS,
    APS_TIME_ELEMENT_TITLE[64]
};

new const APS_TIME_ELEMENTS[][APS_TIME_ELEMENT] = {
    { 60, "APS_TIME_ELEMENT_MINUTES" },
    { 3600, "APS_TIME_ELEMENT_HOURS" },
    { 86400, "APS_TIME_ELEMENT_DAYS" },
    { 604800, "APS_TIME_ELEMENT_WEEKS" },
    { 2592000, "APS_TIME_ELEMENT_MONTHS" },
    { 31104000, "APS_TIME_ELEMENT_YEARS" },
};

stock aps_get_time_length(const id, const unitCnt, output[], const outputLen, const everKey[] = "APS_TIME_ELEMENT_PERMANENTLY")
{
    SetGlobalTransTarget(id);
    if (unitCnt <= 0) {
        return formatex(output, outputLen, "%l", everKey);
    }

    new secondCnt = unitCnt, count, element = sizeof APS_TIME_ELEMENTS - 1, len = 0;
    do {
        count = secondCnt / APS_TIME_ELEMENTS[element][APS_TIME_ELEMENT_SECONDS];
        secondCnt -= (count * APS_TIME_ELEMENTS[element][APS_TIME_ELEMENT_SECONDS]);
        if (count <= 0) {
            element--;
            continue;
        }

        if (secondCnt > 0 || len == 0) {
            len += formatex(output[len], outputLen - len, len > 0 ? " %d %l" : "%d %l", count, APS_TIME_ELEMENTS[element][APS_TIME_ELEMENT_TITLE]);
        } else {
            len += formatex(output[len], outputLen - len, " %l %d %l", "APS_TIME_ELEMENT_AND", count, APS_TIME_ELEMENTS[element][APS_TIME_ELEMENT_TITLE]);
        }
        element--;
      
    } while (secondCnt > 0 && element >= 0);

    if (secondCnt > 0) {
        if (len > 0) {
            len += formatex(output[len], outputLen - len, " %l %d %l", "APS_TIME_ELEMENT_AND", secondCnt, "APS_TIME_ELEMENT_SECONDS");
        } else {
            len += formatex(output[len], outputLen - len, "%d %l", secondCnt, "APS_TIME_ELEMENT_SECONDS");
        }
    }

    return len;
}
Сверху Снизу