Русское сообщество по скриптингу

Как запретить воскрешение, если остался 1 зек.

Все вопросы по скриптингу для AMXX, помощь в редактировании плагинов.

Модераторы: Subb98, liFe iS GoOD

Правила форума
1. Запрещено материться и оскорблять других участников форума.
2. Запрещен флуд, оффтоп, дабл постинг во всех разделах форума, кроме раздела "Болтовня".
3. Запрещено взламывать сайт/форум или наносить любой вред проекту.
4. Запрещено рекламировать другие ресурсы.
5. Запрещено создавать темы без информативного названия. Название темы должно отображать ее смысл.

В данном разделе форума разрешено создавать темы, касающие только скриптинга для AMX Mod X.

Правила при создании новой темы:
1. При вставке кода плагина необходимо использовать тег [code=php].
2. Любые изображения должны быть загружены, как вложения к вашему сообщению.
3. При описании проблемы или запросе на помощь в редактировании плагина обязательно выкладывайте исходник sma плагина.

Как запретить воскрешение, если остался 1 зек.

Сообщение Максим_SerJanT » 25 авг 2019, 15:05

Помогите пжлст, пытался сделать так, чтобы при 1 зеке нельзя было ресатся через меню, но всегда не получалось...
Помогите пожалуйста.
Код: Выделить всё
#include <amxmodx>

#define PLUGIN    "[JBE] Меню авторитета"
#define VERSION    "1.0"
#define AUTHOR    "ALIK"

#define PREFIX    "^4[JBE]^1"

#define AUTHORITY_MENU_ID        "AUTHORITY MENU"
#define AUTHORITY_MENU_TITLE    "\yАвторитетное меню:"
#define AUTHORITY_MENU_ITEMS    21
#define AUTHORITY_MENU_ACCES     ADMIN_LEVEL_C

#define PLAYERS_MENU_ID         "PLAYERS MENU"
#define PLAYERS_MENU_TITLE         "Выбор игрока:"

native jbe_get_day_mode();
    
    
/** NULL */
    #define IsGameStarted() (bool:(jbe_get_day_mode() == 3))
    
native jbe_get_user_team
(pId);
    
    
/** pId */
    #define Player_GetTeam jbe_get_user_team
    
    
#define IsTeam(%1,%2) (bool:(jbe_get_user_team(%1) == %2))
    
native jbe_informer_offset_up
(pId);
    
    
/** pId */
    #define Player_SetNewMenuPosition jbe_informer_offset_up

#define ALL 0

/** pId */
#define IsAlive(%1) (bool:(is_user_alive(%1)))

/** pId */
#define IsConnected(%1) (bool:(is_user_connected(%1)))

/** pId, ADMIN_ */
#define IsFlag(%1,%2) (bool:(get_user_flags(%1) & %2))

/** szMenu, iLen, szMenuTitle */
#define MENU_TITLE(%1,%2,%3) (%2 = formatex(%1[%2], charsmax(%1) - %2, %3))

/** szMenu[], iLen, szItemName */
#define MENU_ITEM(%1,%2,%3) (%2 += formatex(%1[%2], charsmax(%1) - %2, %3))

/** pId, bitsKeys, szMenu, szMenuId */
#define SHOW_MENU(%1,%2,%3,%4) show_menu(%1, %2, %3, -1, %4)

/** szMenuId, szMenu_Handler */
#define RegisterMenu(%1,%2) register_menucmd(register_menuid(%1), 1023, %2)

/** iMenuKey */
#define KEY(%0) (1 << (((%0) + 9) % 10))
#define KEY_HANDLER(%0) ((%0 + 1) % 10)

/** FUNCTION NAME, pId */
#define _MENU_CALLBACK(%0,%1) \
    Player_GetMenu_%0(%1, g_iPlayerMenuPage[%1], AUTHORITY_MENU_TITLE, AUTHORITY_MENU_ID)

/** FUNCTION NAME, pId, bMe */
#define _PLAYERS_MENU_CALLBACK(%0,%1) \
    Player_GetPlayersMenu_%0(%1, g_iPlayerMenuPage[%1], g_bTargetAliveType[%1], g_iTargetNeedTeam[%1], PLAYERS_MENU_TITLE, PLAYERS_MENU_ID)

enum _:TOTAL_TEAMS
{
    TEAM_NONE,
    TEAM_PRISON,
    TEAM_GUARD
};
    
enum _
:TOTAL_MENU_ARRAYS
{
    AI_MENU_NAME[48],
    
    AI_MENU_LIMIT
,
    AI_MENU_ALIVE,
    AI_MENU_ALIVE2,
    AI_MENU_TEAM,
    
    bool
:AI_MENU_MODE,
    bool:AI_MENU_MODE2
};
new Array:g_szArrayMenu,
    
    g_iMenuItemsNum
;

new g_iMenuLimit[33][AUTHORITY_MENU_ITEMS], bool:g_bMenuNeedPlayers[33][AUTHORITY_MENU_ITEMS];

new bool:g_bFirstConnected[33];

    /** pId */
    #define IsFirstConnected(%1) (bool:(g_bFirstConnected[%1]))

new g_iPlayerMenuPage[33], g_iPlayerMenuTarget[33][32];

new bool:g_bTargetAliveType[33], g_iTargetNeedTeam[33], g_iTargetPlyerItem[33];

new g_iForwardResult, g_iJbeForward;

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR);
    
    RegisterMenu
(PLAYERS_MENU_ID, "ShowMenu_Players_Handler");
    RegisterMenu(AUTHORITY_MENU_ID, "ShowMenu_Authority_Handler");
    
    register_clcmd
("say /am", "Cmd_AuthorityMenu", AUTHORITY_MENU_ACCES);
}

public plugin_precache()
{
    g_szArrayMenu = ArrayCreate(TOTAL_MENU_ARRAYS);
    
    g_iJbeForward 
= CreateMultiForward
    
(
        "Jbe_AuthorityItemSelected", ET_CONTINUE, FP_CELL, FP_CELL, FP_CELL
    
);
}

public client_putinserver(pId)
{
    if(!IsFirstConnected(pId))
    {
        for(new i = 0, szArrayMenu[TOTAL_MENU_ARRAYS]; i < g_iMenuItemsNum; i++)
        {
            ArrayGetArray(g_szArrayMenu, i, szArrayMenu);
            
            g_bMenuNeedPlayers
[pId][i] = szArrayMenu[AI_MENU_MODE];
            g_iMenuLimit[pId][i] = szArrayMenu[AI_MENU_LIMIT];
        }
        g_bFirstConnected[pId] = true;
    }
}

public Cmd_AuthorityMenu(pId, bitsAccess)
{
    if(!IsConnected(pId)) return;
    
    if
(!IsFlag(pId, bitsAccess))
    {
        Player_SendTextInfo
        
(
            pId, "%s У тебя нет прав !", PREFIX
        
);
        return;
    }
    
    if
(IsGameStarted())
    {
        Player_SendTextInfo
        
(
            pId, "%s Дождись конца игрового режима !", PREFIX
        
);
        return;
    }
    
    _MENU_CALLBACK
(New, pId);
}

public ShowMenu_Authority_Handler(pId, iKey)
{
    if(!IsConnected(pId) || IsGameStarted()) return;
    
    switch
(KEY_HANDLER(iKey))
    {
        case 0: return;
        case 8: _MENU_CALLBACK(Back, pId);
        case 9: _MENU_CALLBACK(Next, pId);
        default:
        {
            new iItem = g_iPlayerMenuTarget[pId][(g_iPlayerMenuPage[pId] * 7) + iKey];
            
            g_iTargetPlyerItem
[pId] = iItem;
            
            switch
(g_iMenuLimit[pId][iItem])
            {
                case 0:
                {
                    Player_SendTextInfo
                    
(
                        pId, "%s Ты достиг лимита !", PREFIX
                    
);
                    _MENU_CALLBACK(Saved, pId); return;
                }
                default:
                {
                    new szArrayMenu[TOTAL_MENU_ARRAYS];
                    ArrayGetArray(g_szArrayMenu, iItem, szArrayMenu);
                    
                    g_iTargetNeedTeam
[pId] = szArrayMenu[AI_MENU_TEAM];
                    
                    g_bTargetAliveType
[pId] = szArrayMenu[AI_MENU_MODE2];
                    
                    new bool
:bAlive = IsAlive(pId),
                        bool:bChange = bool:(g_iMenuLimit[pId][iItem] != -1);

                    switch(szArrayMenu[AI_MENU_ALIVE])
                    {
                        case -1:
                        {
                            switch(g_bMenuNeedPlayers[pId][iItem])
                            {
                                case false:
                                {
                                    ExecuteForward(g_iJbeForward, g_iForwardResult, pId, iItem, pId);
                                    
                                    switch
(g_iForwardResult)
                                    {
                                        case 0:
                                        {
                                            if(bChange) --g_iMenuLimit[pId][iItem];
                                        }
                                        default: return;
                                    }
                                }
                                case true:
                                {
                                    _PLAYERS_MENU_CALLBACK(New, pId);
                                }
                            }
                        }
                        case 0:
                        {
                            switch(bAlive)
                            {
                                case false:
                                {
                                    switch(g_bMenuNeedPlayers[pId][iItem])
                                    {
                                        case false:
                                        {
                                            ExecuteForward(g_iJbeForward, g_iForwardResult, pId, iItem, pId);
                                            
                                            switch
(g_iForwardResult)
                                            {
                                                case 0:
                                                {
                                                    if(bChange) --g_iMenuLimit[pId][iItem];
                                                }
                                                default: return;
                                            }
                                        }
                                        case true:
                                        {
                                            _PLAYERS_MENU_CALLBACK(New, pId);
                                        }
                                    }
                                }
                                case true:
                                {
                                    _MENU_CALLBACK(Saved, pId); return;
                                }
                            }
                        }
                        case 1:
                        {
                            switch(bAlive)
                            {
                                case false:
                                {
                                    _MENU_CALLBACK(Saved, pId); return;
                                }
                                case true:
                                {
                                    switch(g_bMenuNeedPlayers[pId][iItem])
                                    {
                                        case false:
                                        {
                                            ExecuteForward(g_iJbeForward, g_iForwardResult, pId, iItem, pId);
                                            
                                            switch
(g_iForwardResult)
                                            {
                                                case 0:
                                                {
                                                    if(bChange) --g_iMenuLimit[pId][iItem];
                                                }
                                                default: return;
                                            }
                                        }
                                        case true:
                                        {
                                            _PLAYERS_MENU_CALLBACK(New, pId);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

public ShowMenu_Players_Handler(pId, iKey)
{
    if(!IsConnected(pId) || IsGameStarted()) return;
    
    new iItem 
= g_iTargetPlyerItem[pId];
    
    switch
(KEY_HANDLER(iKey))
    {
        case 0: return;
        case 8: _PLAYERS_MENU_CALLBACK(Back, pId);
        case 9: _PLAYERS_MENU_CALLBACK(Next, pId);
        default:
        {
            new iPlayer = g_iPlayerMenuTarget[pId][(g_iPlayerMenuPage[pId] * 7) + iKey];
            
            if
(!IsConnected(iPlayer))
            {
                _PLAYERS_MENU_CALLBACK(Saved, pId); return;
            }
            
            new szArrayMenu
[TOTAL_MENU_ARRAYS];
            ArrayGetArray(g_szArrayMenu, iItem, szArrayMenu);
            
            new bool
:bAlive = IsAlive(iPlayer),
                bool:bChange = bool:(g_iMenuLimit[pId][iItem] != -1);
            
            switch
(szArrayMenu[AI_MENU_ALIVE2])
            {
                case -1:
                {
                    ExecuteForward(g_iJbeForward, g_iForwardResult, pId, iItem, iPlayer);
                    
                    switch
(g_iForwardResult)
                    {
                        case 0:
                        {
                            if(bChange) --g_iMenuLimit[pId][iItem];
                        }
                        default: return;
                    }
                }
                case 0:
                {
                    switch(bAlive)
                    {
                        case false:
                        {
                            ExecuteForward(g_iJbeForward, g_iForwardResult, pId, iItem, iPlayer);
                            
                            switch
(g_iForwardResult)
                            {
                                case 0:
                                {
                                    if(bChange) --g_iMenuLimit[pId][iItem];
                                }
                                default: return;
                            }
                        }
                        case true:
                        {
                            _PLAYERS_MENU_CALLBACK(Saved, pId); return;
                        }
                    }
                }
                case 1:
                {
                    switch(bAlive)
                    {
                        case false:
                        {
                            _PLAYERS_MENU_CALLBACK(Saved, pId); return;
                        }
                        case true:
                        {
                            ExecuteForward(g_iJbeForward, g_iForwardResult, pId, iItem, iPlayer);
                            
                            switch
(g_iForwardResult)
                            {
                                case 0:
                                {
                                    if(bChange) --g_iMenuLimit[pId][iItem];
                                }
                                default: return;
                            }
                        }
                    }
                }
            }
        }
    }
}

Player_GetPlayersMenu_Next(pId, &iPage, bool:bMe, iTeam, const szTitle[], const szMenuId[])
{
    return Player_GetPlayersMenu(pId, ++iPage, bMe, iTeam, szTitle, szMenuId);
}

Player_GetPlayersMenu_Back(pId, &iPage, bool:bMe, iTeam, const szTitle[], const szMenuId[])
{
    return Player_GetPlayersMenu(pId, --iPage, bMe, iTeam, szTitle, szMenuId);
}

Player_GetPlayersMenu_Saved(pId, &iPage, bool:bMe, iTeam, const szTitle[], const szMenuId[])
{
    return Player_GetPlayersMenu(pId, iPage, bMe, iTeam, szTitle, szMenuId);
}

Player_GetPlayersMenu_New(pId, &iPage, bool:bMe, iTeam, const szTitle[], const szMenuId[])
{
    return Player_GetPlayersMenu(pId, iPage = 0, bMe, iTeam, szTitle, szMenuId);
}

Player_GetPlayersMenu(pId, iPage, bool:bMe, iTeam, const szTitle[], const szMenuId[])
{
    if(iPage < 0 || !IsConnected(pId) || !iTeam || iTeam > TEAM_GUARD)
        return PLUGIN_HANDLED;
        
    Player_SetNewMenuPosition
(pId);
    
    new szPlayers
[32], iPlayers;
    get_players(szPlayers, iPlayers);
    
    new i 
= min(iPage * 7, iPlayers);
    
    new iStart     
= i - (% 7);
    new iEnd     = min(iStart + 7, iPlayers);
    
    iPage 
= iStart / 7;
    
    g_iPlayerMenuPage
[pId] = iPage;
    g_iPlayerMenuTarget[pId] = szPlayers;
    
    new szPlayersMenu
[512], iLen;
    
    new iPlayerPages 
= ((iPlayers - 1) / 7) + 1;
    switch(iPlayerPages)
    {
        case 1:
        {
            MENU_TITLE(szPlayersMenu, iLen, "%s^n^n", szTitle);
        }
        default:
        {
            MENU_TITLE(szPlayersMenu, iLen, "%s\y\R%d/%d^n^n", szTitle, iPage + 1, iPlayerPages);
        }
    }
    
    new bool
:bAlive;
    new iItem, iPlayer;
    new bitsKeys = KEY(0);
    new szName[32], szArrayMenu[TOTAL_MENU_ARRAYS];

    for(= iStart; i < iEnd; i++)
    {
        iPlayer = szPlayers[i];
        
        get_user_name
(iPlayer, szName, charsmax(szName));
        
        ArrayGetArray
(g_szArrayMenu, g_iTargetPlyerItem[pId], szArrayMenu);
        
        bAlive 
= IsAlive(iPlayer);
        
        switch
(iTeam)
        {
            case -1:
            {
                switch(szArrayMenu[AI_MENU_ALIVE2])
                {
                    case -1:
                    {
                        if(iPlayer == pId)
                        {
                            switch(bMe)
                            {
                                case false:
                                {
                                    bitsKeys &= ~KEY(++iItem);
                                    
                                    MENU_ITEM
(szPlayersMenu, iLen, "\y[%d] \d%s^n", iItem, szName);
                                }
                                case true:
                                {
                                    bitsKeys |= KEY(++iItem);
                                    
                                    MENU_ITEM
(szPlayersMenu, iLen, "\y[%d] \y%s^n", iItem, szName);
                                }
                            }
                        }
                        else
                        
{
                            bitsKeys |= KEY(++iItem);
                            
                            MENU_ITEM
(szPlayersMenu, iLen, "\y[%d] \w%s^n", iItem, szName);
                        }
                    }
                    case 0:
                    {
                        switch(bAlive)
                        {
                            case false:
                            {
                                if(iPlayer == pId)
                                {
                                    switch(bMe)
                                    {
                                        case false:
                                        {
                                            bitsKeys &= ~KEY(++iItem);
                                            
                                            MENU_ITEM
(szPlayersMenu, iLen, "\y[%d] \d%s^n", iItem, szName);
                                        }
                                        case true:
                                        {
                                            bitsKeys |= KEY(++iItem);
                                            
                                            MENU_ITEM
(szPlayersMenu, iLen, "\y[%d] \y%s^n", iItem, szName);
                                        }
                                    }
                                }
                                else
                                
{
                                    bitsKeys |= KEY(++iItem);
                                    
                                    MENU_ITEM
(szPlayersMenu, iLen, "\y[%d] \w%s^n", iItem, szName);
                                }
                            }
                            case true:
                            {
                                bitsKeys &= ~KEY(++iItem);
                                
                                MENU_ITEM
(szPlayersMenu, iLen, "\y[%d] \d%s^n", iItem, szName);
                            }
                        }
                    }
                    case 1:
                    {
                        switch(bAlive)
                        {
                            case false:
                            {
                                bitsKeys &= ~KEY(++iItem);
                                
                                MENU_ITEM
(szPlayersMenu, iLen, "\y[%d] \d%s^n", iItem, szName);
                            }
                            case true:
                            {
                                if(iPlayer == pId)
                                {
                                    switch(bMe)
                                    {
                                        case false:
                                        {
                                            bitsKeys &= ~KEY(++iItem);
                                            
                                            MENU_ITEM
(szPlayersMenu, iLen, "\y[%d] \d%s^n", iItem, szName);
                                        }
                                        case true:
                                        {
                                            bitsKeys |= KEY(++iItem);
                                            
                                            MENU_ITEM
(szPlayersMenu, iLen, "\y[%d] \y%s^n", iItem, szName);
                                        }
                                    }
                                }
                                else
                                
{
                                    bitsKeys |= KEY(++iItem);
                                    
                                    MENU_ITEM
(szPlayersMenu, iLen, "\y[%d] \w%s^n", iItem, szName);
                                }
                            }
                        }
                    }
                }
            }
            default:
            {
                new bool:bTeam = IsTeam(iPlayer, iTeam);
                switch(bTeam)
                {
                    case false:
                    {
                        bitsKeys &= ~KEY(++iItem);
                        
                        MENU_ITEM
(szPlayersMenu, iLen, "\y[%d] \d%s^n", iItem, szName);                        
                    
}
                    case true:
                    {
                        switch(szArrayMenu[AI_MENU_ALIVE2])
                        {
                            case -1:
                            {
                                if(iPlayer == pId)
                                {
                                    switch(bMe)
                                    {
                                        case false:
                                        {
                                            bitsKeys &= ~KEY(++iItem);
                                            
                                            MENU_ITEM
(szPlayersMenu, iLen, "\y[%d] \d%s^n", iItem, szName);
                                        }
                                        case true:
                                        {
                                            bitsKeys |= KEY(++iItem);
                                            
                                            MENU_ITEM
(szPlayersMenu, iLen, "\y[%d] \y%s^n", iItem, szName);
                                        }
                                    }
                                }
                                else
                                
{
                                    bitsKeys |= KEY(++iItem);
                                    
                                    MENU_ITEM
(szPlayersMenu, iLen, "\y[%d] \w%s^n", iItem, szName);
                                }
                            }
                            case 0:
                            {
                                switch(bAlive)
                                {
                                    case false:
                                    {
                                        if(iPlayer == pId)
                                        {
                                            switch(bMe)
                                            {
                                                case false:
                                                {
                                                    bitsKeys &= ~KEY(++iItem);
                                                    
                                                    MENU_ITEM
(szPlayersMenu, iLen, "\y[%d] \d%s^n", iItem, szName);
                                                }
                                                case true:
                                                {
                                                    bitsKeys |= KEY(++iItem);
                                                    
                                                    MENU_ITEM
(szPlayersMenu, iLen, "\y[%d] \y%s^n", iItem, szName);
                                                }
                                            }
                                        }
                                        else
                                        
{
                                            bitsKeys |= KEY(++iItem);
                                            
                                            MENU_ITEM
(szPlayersMenu, iLen, "\y[%d] \w%s^n", iItem, szName);
                                        }
                                    }
                                    case true:
                                    {
                                        bitsKeys &= ~KEY(++iItem);
                                        
                                        MENU_ITEM
(szPlayersMenu, iLen, "\y[%d] \d%s^n", iItem, szName);
                                    }
                                }
                            }
                            case 1:
                            {
                                switch(bAlive)
                                {
                                    case false:
                                    {
                                        bitsKeys &= ~KEY(++iItem);
                                        
                                        MENU_ITEM
(szPlayersMenu, iLen, "\y[%d] \d%s^n", iItem, szName);
                                    }
                                    case true:
                                    {
                                        if(iPlayer == pId)
                                        {
                                            switch(bMe)
                                            {
                                                case false:
                                                {
                                                    bitsKeys &= ~KEY(++iItem);
                                                    
                                                    MENU_ITEM
(szPlayersMenu, iLen, "\y[%d] \d%s^n", iItem, szName);
                                                }
                                                case true:
                                                {
                                                    bitsKeys |= KEY(++iItem);
                                                    
                                                    MENU_ITEM
(szPlayersMenu, iLen, "\y[%d] \y%s^n", iItem, szName);
                                                }
                                            }
                                        }
                                        else
                                        
{
                                            bitsKeys |= KEY(++iItem);
                                            
                                            MENU_ITEM
(szPlayersMenu, iLen, "\y[%d] \w%s^n", iItem, szName);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    
    if
(iPage)
    {
        bitsKeys |= KEY(8);
        
        MENU_ITEM
(szPlayersMenu, iLen, "^n\y[8] \wНазад");
    }
    
    if
(iPlayerPages > 1 && iPage + 1 < iPlayerPages)
    {
        bitsKeys |= KEY(9);
        
        MENU_ITEM
(szPlayersMenu, iLen, "^n\y[9] \wДалее");
    }
    
    MENU_ITEM
(szPlayersMenu, iLen, "^n\y[0] \wВыход");
    
    return SHOW_MENU
(pId, bitsKeys, szPlayersMenu, szMenuId);
}

Player_GetMenu_Next(pId, &iPage, const szTitle[], const szMenuId[])
{
    return Player_GetMenu(pId, ++iPage, szTitle, szMenuId);
}

Player_GetMenu_Back(pId, &iPage, const szTitle[], const szMenuId[])
{
    return Player_GetMenu(pId, --iPage, szTitle, szMenuId);
}

Player_GetMenu_Saved(pId, &iPage, const szTitle[], const szMenuId[])
{
    return Player_GetMenu(pId, iPage, szTitle, szMenuId);
}

Player_GetMenu_New(pId, &iPage, const szTitle[], const szMenuId[])
{
    return Player_GetMenu(pId, iPage = 0, szTitle, szMenuId);
}

Player_GetMenu(pId, iPage, const szTitle[], const szMenuId[])
{
    if(iPage < 0) return PLUGIN_HANDLED;
    
    Player_SetNewMenuPosition
(pId);
    
    new i 
= min(iPage * 7, g_iMenuItemsNum);
    
    new iStart     
= i - (% 7);
    new iEnd     = min(iStart + 7, g_iMenuItemsNum);
    
    iPage 
= iStart / 7;
    
    g_iPlayerMenuPage
[pId] = iPage;
    
    new szMenu
[512], iLen;
    
    new iPlayerPages 
= ((g_iMenuItemsNum - 1) / 7) + 1;
    switch(iPlayerPages)
    {
        case 1:
        {
            MENU_TITLE(szMenu, iLen, "%s^n^n", szTitle);
        }
        default:
        {
            MENU_TITLE(szMenu, iLen, "%s\y\R%d/%d^n^n", szTitle, iPage + 1, iPlayerPages);
        }
    }
    
    new iItem
, iKey;
    new bitsKeys = KEY(0);
    new szArrayMenu[TOTAL_MENU_ARRAYS];
    
    new bool
:bAlive;
    
    for
(= iStart; i < iEnd; i++)
    {
        iKey = (iPage * 7) + iItem;
        g_iPlayerMenuTarget[pId][iKey] = iKey;
        
        ArrayGetArray
(g_szArrayMenu, iKey, szArrayMenu);
        
        bAlive 
= IsAlive(pId);
        switch(g_iMenuLimit[pId][iKey])
        {
            case -1:
            {
                switch(szArrayMenu[AI_MENU_ALIVE])
                {
                    case -1:
                    {
                        bitsKeys |= KEY(++iItem);
                        
                        MENU_ITEM
(szMenu, iLen, "\y[%d] \w%s^n", iItem, szArrayMenu[AI_MENU_NAME]);
                    }
                    case 0:
                    {
                        switch(bAlive)
                        {
                            case false:
                            {
                                bitsKeys |= KEY(++iItem);
                                
                                MENU_ITEM
(szMenu, iLen, "\y[%d] \w%s^n", iItem, szArrayMenu[AI_MENU_NAME]);
                            }
                            case true:
                            {
                                MENU_ITEM(szMenu, iLen, "\y[%d] \d%s \r[\yМ\r]^n", ++iItem, szArrayMenu[AI_MENU_NAME]);
                            }
                        }
                    }
                    case 1:
                    {
                        switch(bAlive)
                        {
                            case false:
                            {
                                MENU_ITEM(szMenu, iLen, "\y[%d] \d%s \r[\yЖ\r]^n", ++iItem, szArrayMenu[AI_MENU_NAME]);
                            }
                            case true:
                            {
                                bitsKeys |= KEY(++iItem);
                                
                                MENU_ITEM
(szMenu, iLen, "\y[%d] \w%s^n", iItem, szArrayMenu[AI_MENU_NAME]);
                            }
                        }
                    }
                }
            }
            case 0:
            {
                MENU_ITEM(szMenu, iLen, "\y[%d] \d%s \r[\yЛ\r]^n", ++iItem, szArrayMenu[AI_MENU_NAME]);
            }
            default:
            {
                switch(szArrayMenu[AI_MENU_ALIVE])
                {
                    case -1:
                    {
                        bitsKeys |= KEY(++iItem);
                        
                        MENU_ITEM
\
                        (\
                            szMenu, iLen, "\y[%d] %s%s \r[\d%d\r]^n",\
                        \
                            iItem, g_iMenuLimit[pId][iKey] == 0 ? "\d" : "\w", szArrayMenu[AI_MENU_NAME], g_iMenuLimit[pId][iKey]\
                        );
                    }
                    case 0:
                    {
                        switch(bAlive)
                        {
                            case false:
                            {
                                bitsKeys |= KEY(++iItem);
                                
                                MENU_ITEM
\
                                (\
                                    szMenu, iLen, "\y[%d] %s%s \r[\d%d\r]^n",\
                                \
                                    iItem, g_iMenuLimit[pId][iKey] == 0 ? "\d" : "\w", szArrayMenu[AI_MENU_NAME], g_iMenuLimit[pId][iKey]\
                                );
                            }
                            case true:
                            {
                                MENU_ITEM\
                                (\
                                    szMenu, iLen, "\y[%d] \d%s \r[\yМ\r]^n",\
                                \
                                    ++iItem, szArrayMenu[AI_MENU_NAME]\
                                );
                            }
                        }
                    }
                    case 1:
                    {
                        switch(bAlive)
                        {
                            case false:
                            {
                                MENU_ITEM\
                                (\
                                    szMenu, iLen, "\y[%d] \d%s \r[\yЖ\r]^n",\
                                \
                                    ++iItem, szArrayMenu[AI_MENU_NAME]\
                                );
                            }
                            case true:
                            {
                                bitsKeys |= KEY(++iItem);
                                
                                MENU_ITEM
\
                                (\
                                    szMenu, iLen, "\y[%d] %s%s \r[\d%d\r]^n",\
                                \
                                    iItem, g_iMenuLimit[pId][iKey] == 0 ? "\d" : "\w", szArrayMenu[AI_MENU_NAME], g_iMenuLimit[pId][iKey]\
                                );
                            }
                        }
                    }
                }
            }
        }
    }
    
    if
(iPage)
    {
        bitsKeys |= KEY(8);
    
        MENU_ITEM
(szMenu, iLen, "^n\y[8] \wНазад");
    }
    
    if
(iPlayerPages > 1 && iPage + 1 < iPlayerPages)
    {
        bitsKeys |= KEY(9);
        
        MENU_ITEM
(szMenu, iLen, "^n\y[9] \wДалее");
    }
    
    MENU_ITEM
(szMenu, iLen, "^n\y[0] \wВыход");
    
    return SHOW_MENU
(pId, bitsKeys, szMenu, szMenuId);
}

const Msg_SayTextId = 76;

Player_SendTextInfo(pId, const szMessage[], any:...)
{
    new iPlayers[32], iCount = 1;
    new szMsg[191]; vformat(szMsg, charsmax(szMsg), szMessage, 3); 
    
    replace_all
(szMsg, 190, "!g", "^4");
    replace_all(szMsg, 190, "!y", "^1");
    replace_all(szMsg, 190, "!t", "^3");

    if(pId) iPlayers[0] = pId; else get_players(iPlayers, iCount, "ch");
    {
        for(new pId = 0; pId < iCount; pId++)
        {
            if(IsConnected(iPlayers[pId]))
            {
                message_begin(MSG_ONE_UNRELIABLE, Msg_SayTextId, _, iPlayers[pId]);
                write_byte(iPlayers[pId]);
                write_string(szMsg);
                message_end();
            }
        }
    }
}

public plugin_natives()
{
    register_native("RegisterAuthorityItem", "Native_RegisterItem", 1);
}

public Native_RegisterItem(const szName[], iLimit, iType, bool:bMode, iNeedTeam, iType2, bool:bMode2)
{
    if(g_iMenuItemsNum >= AUTHORITY_MENU_ITEMS || !iNeedTeam || iNeedTeam > TEAM_GUARD) return -1;
    
    param_convert
(1);
    
    new szArrayMenu
[TOTAL_MENU_ARRAYS];
    copy(szArrayMenu[AI_MENU_NAME], charsmax(szArrayMenu[AI_MENU_NAME]), szName);
    
    szArrayMenu
[AI_MENU_ALIVE] = iType;
    szArrayMenu[AI_MENU_ALIVE2] = iType2;
    szArrayMenu[AI_MENU_LIMIT] = iLimit;
    szArrayMenu[AI_MENU_TEAM] = iNeedTeam;
    
    szArrayMenu
[AI_MENU_MODE] = bMode;
    szArrayMenu[AI_MENU_MODE2] = bMode2;
    
    ArrayPushArray
(g_szArrayMenu, szArrayMenu);
    
    return 
++g_iMenuItemsNum - 1;
}
Аватара пользователя
Максим_SerJanT
 
Сообщения: 21
Зарегистрирован: 16 авг 2017, 01:32
Благодарил (а): 1 раз.
Поблагодарили: 1 раз.
Языки программирования: Pawn
SourcePawn
C++
Php
Ruby
Python
C#

Re: Как запретить воскрешение, если остался 1 зек.

Сообщение Lyse » 11 сен 2019, 13:03

Код: Выделить всё
if(get_zek() == 1){
 return;
Аватара пользователя
Lyse
 
Сообщения: 15
Зарегистрирован: 12 авг 2018, 23:03
Благодарил (а): 0 раз.
Поблагодарили: 4 раз.
Опыт программирования: Около года
Языки программирования: java
AMXX


Вернуться в Скриптинг

Кто сейчас на конференции

Сейчас этот форум просматривают: Bing [Bot] и гости: 2