Само по 1 Surv/Nem на рунд.

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Аватар
DoPe ;]]
Извън линия
Потребител
Потребител
Мнения: 402
Регистриран на: 27 Фев 2017, 22:10
Обратна връзка:

Само по 1 Surv/Nem на рунд.

Мнение от DoPe ;]] » 04 Апр 2017, 18:33

Да може да се купува само по 1 survivor и nemesis на рунд, и да изпише съобщение: Only one surv/nem is allowed per round!
Прикачени файлове
com4o_vip_extra_buy_survnem.sma
(3.85 KiB) Свалено 108 пъти
com4o_vip_extra_buy_survnem.sma
(3.85 KiB) Свалено 108 пъти
The Best Deathrun Server: 79.124.49.91:27019
The Best Respawn Server: 79.124.49.88:27021

Аватар
JustInCase
Извън линия
Потребител
Потребител
Мнения: 582
Регистриран на: 14 Окт 2016, 23:31
Се отблагодари: 4 пъти
Получена благодарност: 15 пъти

Re: Само по 1 Surv/Nem на рунд.

Мнение от JustInCase » 04 Апр 2017, 18:39

Код за потвърждение: Избери целия код

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <zombieplague>
#include <zmvip>

#define PLUGIN "[ZP] S/N Buy"
#define VERSION "1.1"
#define AUTHOR "aaarnas"

new g_msgSayText
new nemesis, survivor
new g_bought[33], bought
new cvar_n_price, cvar_s_price, cvar_limit_all, cvar_everytime, cvar_show_bought, cvar_allow_times
new g_iLimit[33]

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    cvar_everytime = register_cvar("zp_allow_buy", "2")
    cvar_allow_times = register_cvar("zp_allow_times", "4")
    cvar_limit_all = register_cvar("zp_limit_for_all", "1")
    cvar_n_price = register_cvar("zp_nemesis_price", "35")
    cvar_s_price = register_cvar("zp_survivor_price", "35")
    cvar_show_bought = register_cvar("zp_show_who_bought", "1")
    
    g_msgSayText = get_user_msgid("SayText")
    
    // Extra items
    nemesis = zv_register_extra_item("Buy Nemesis", "For one round", get_pcvar_num(cvar_n_price), 0)
    survivor = zv_register_extra_item("Buy Survivor","For one round", get_pcvar_num(cvar_s_price), 0)
}

public zp_round_ended()
    bought = false
public zp_round_started(id)
{
    g_iLimit[ id ] = 0
}
public zv_extra_item_selected(id, itemid) {
    
    new value = get_pcvar_num(cvar_everytime)
    
    if(itemid == nemesis) {
        
        if(get_pcvar_num(cvar_limit_all) && bought) {
            client_printcolor(id, "/g[ZP] This is no more avaible in this round. Try next round.")
            return ZV_PLUGIN_HANDLED
        }
        if(g_bought[id] >= get_pcvar_num(cvar_allow_times)) {
            client_printcolor(id, "/g[ZP] You can't buy it more than %d times.", get_pcvar_num(cvar_allow_times))
            return ZV_PLUGIN_HANDLED
        }
        if(value == 2) {
            if(g_iLimit[id] >= 1) {
                client_printcolor(id, "/g[ZP] You can buy nemesis 1 time per round")
                return ZP_PLUGIN_HANDLED
            }
            zp_make_user_nemesis(id)
            g_iLimit[ id ] ++
            new name[64]
            get_user_name(id, name, 63)
            client_printcolor(0, "/g[ZP] %s /ybought nemesis", name)
            g_bought[id]++
        }
        else if(zp_has_round_started() == value) {
            zp_make_user_nemesis(id)
            if(get_pcvar_num(cvar_show_bought)) {
                new name[64]
                get_user_name(id, name, 63)
                client_printcolor(0, "/g[ZP] %s /ybought nemesis", name)
                g_bought[id]++
                bought = true
            }
        }
        else {
            client_printcolor(id, "/g[ZP] /yYou can buy Nemesis only when %s.", value ? "round started":"round not started")
            return ZV_PLUGIN_HANDLED
        }
    }
    else if(itemid == survivor) {
        
        if(get_pcvar_num(cvar_limit_all) && bought) {
            client_printcolor(id, "/g[ZP] This is no more avaible in this round. Try next round.")
            return ZV_PLUGIN_HANDLED
        }
        if(g_bought[id] >= get_pcvar_num(cvar_allow_times)) {
            client_printcolor(id, "/g[ZP] You can't buy it more than %d times.", get_pcvar_num(cvar_allow_times))
            return ZV_PLUGIN_HANDLED
        }
        if(value == 2) {
            if(g_iLimit[id] >= 1) {
                client_printcolor(id, "/g[ZP] You can buy nemesis 1 time per round")
                return ZP_PLUGIN_HANDLED
            }
            zp_make_user_survivor(id)
            new name[64]
            get_user_name(id, name, 63)
            client_printcolor(0, "/g[ZP] %s /ybought nemesis", name)
            g_bought[id]++
        }
        else if(zp_has_round_started() == value) {
            zp_make_user_survivor(id)
            if(get_pcvar_num(cvar_show_bought)) {
                new name[64]
                get_user_name(id, name, 63)
                client_printcolor(0, "/g[ZP] %s /ybought survivor", name)
                g_bought[id]++
                bought = true
            }
        }
        else {
            client_printcolor(id, "/g[ZP] /yYou can buy Survivor only when %s.", value ? "round started":"round not started")
            return ZV_PLUGIN_HANDLED
        }
    }
    return 1
}

stock client_printcolor(const id, const input[], any:...)
{
    new iCount = 1, iPlayers[32]
    
    static szMsg[191]
    vformat(szMsg, charsmax(szMsg), input, 3)
    
    replace_all(szMsg, 190, "/g", "^4") // green txt
    replace_all(szMsg, 190, "/y", "^1") // orange txt
    replace_all(szMsg, 190, "/ctr", "^3") // team txt
    replace_all(szMsg, 190, "/w", "^0") // team txt
    
    if(id) iPlayers[0] = id
    else get_players(iPlayers, iCount, "ch")
    
    for (new i = 0; i < iCount; i++)
    {
        if (is_user_connected(iPlayers[i]))
        {
            message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, iPlayers[i])
            write_byte(iPlayers[i])
            write_string(szMsg)
            message_end()
        }
    }
} 
Пробвай.
Последно промяна от JustInCase на 04 Апр 2017, 18:49, променено общо 1 път.
MANSION - HNS : 45.144.155.99:27026
ONLINE

Аватар
TryAgain
Извън линия
Потребител
Потребител
Мнения: 182
Регистриран на: 25 Яну 2017, 16:59
Се отблагодари: 1 път
Получена благодарност: 26 пъти

Re: Само по 1 Surv/Nem на рунд.

Мнение от TryAgain » 04 Апр 2017, 18:48

JustInCase написа:

Код за потвърждение: Избери целия код

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <zombieplague>
#include <zmvip>

#define PLUGIN "[ZP] S/N Buy"
#define VERSION "1.1"
#define AUTHOR "aaarnas"

new g_msgSayText
new nemesis, survivor
new g_bought[33], bought
new cvar_n_price, cvar_s_price, cvar_limit_all, cvar_everytime, cvar_show_bought, cvar_allow_times
new g_iLimit[33]

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    cvar_everytime = register_cvar("zp_allow_buy", "2")
    cvar_allow_times = register_cvar("zp_allow_times", "4")
    cvar_limit_all = register_cvar("zp_limit_for_all", "1")
    cvar_n_price = register_cvar("zp_nemesis_price", "35")
    cvar_s_price = register_cvar("zp_survivor_price", "35")
    cvar_show_bought = register_cvar("zp_show_who_bought", "1")
    
    g_msgSayText = get_user_msgid("SayText")
    
    // Extra items
    nemesis = zv_register_extra_item("Buy Nemesis", "For one round", get_pcvar_num(cvar_n_price), 0)
    survivor = zv_register_extra_item("Buy Survivor","For one round", get_pcvar_num(cvar_s_price), 0)
}

public zp_round_ended()
    bought = false
public zp_round_started(id)
{
    g_iLimit[ id ] = 0
}
public zv_extra_item_selected(id, itemid) {
    
    new value = get_pcvar_num(cvar_everytime)
    
    if(itemid == nemesis) {
        
        if(get_pcvar_num(cvar_limit_all) && bought) {
            client_printcolor(id, "/g[ZP] This is no more avaible in this round. Try next round.")
            return ZV_PLUGIN_HANDLED
        }
        if(g_bought[id] >= get_pcvar_num(cvar_allow_times)) {
            client_printcolor(id, "/g[ZP] You can't buy it more than %d times.", get_pcvar_num(cvar_allow_times))
            return ZV_PLUGIN_HANDLED
        }
        if(value == 2) {
            if(g_iLimit >= 1) {
                client_printcolor(id, "/g[ZP] You can buy nemesis 1 time per round")
                return ZP_PLUGIN_HANDLED
            }
            zp_make_user_nemesis(id)
            g_iLimit[ id ] ++
            new name[64]
            get_user_name(id, name, 63)
            client_printcolor(0, "/g[ZP] %s /ybought nemesis", name)
            g_bought[id]++
        }
        else if(zp_has_round_started() == value) {
            zp_make_user_nemesis(id)
            if(get_pcvar_num(cvar_show_bought)) {
                new name[64]
                get_user_name(id, name, 63)
                client_printcolor(0, "/g[ZP] %s /ybought nemesis", name)
                g_bought[id]++
                bought = true
            }
        }
        else {
            client_printcolor(id, "/g[ZP] /yYou can buy Nemesis only when %s.", value ? "round started":"round not started")
            return ZV_PLUGIN_HANDLED
        }
    }
    else if(itemid == survivor) {
        
        if(get_pcvar_num(cvar_limit_all) && bought) {
            client_printcolor(id, "/g[ZP] This is no more avaible in this round. Try next round.")
            return ZV_PLUGIN_HANDLED
        }
        if(g_bought[id] >= get_pcvar_num(cvar_allow_times)) {
            client_printcolor(id, "/g[ZP] You can't buy it more than %d times.", get_pcvar_num(cvar_allow_times))
            return ZV_PLUGIN_HANDLED
        }
        if(value == 2) {
            if(g_iLimit >= 1) {
                client_printcolor(id, "/g[ZP] You can buy nemesis 1 time per round")
                return ZP_PLUGIN_HANDLED
            }
            zp_make_user_survivor(id)
            new name[64]
            get_user_name(id, name, 63)
            client_printcolor(0, "/g[ZP] %s /ybought nemesis", name)
            g_bought[id]++
        }
        else if(zp_has_round_started() == value) {
            zp_make_user_survivor(id)
            if(get_pcvar_num(cvar_show_bought)) {
                new name[64]
                get_user_name(id, name, 63)
                client_printcolor(0, "/g[ZP] %s /ybought survivor", name)
                g_bought[id]++
                bought = true
            }
        }
        else {
            client_printcolor(id, "/g[ZP] /yYou can buy Survivor only when %s.", value ? "round started":"round not started")
            return ZV_PLUGIN_HANDLED
        }
    }
    return 1
}

stock client_printcolor(const id, const input[], any:...)
{
    new iCount = 1, iPlayers[32]
    
    static szMsg[191]
    vformat(szMsg, charsmax(szMsg), input, 3)
    
    replace_all(szMsg, 190, "/g", "^4") // green txt
    replace_all(szMsg, 190, "/y", "^1") // orange txt
    replace_all(szMsg, 190, "/ctr", "^3") // team txt
    replace_all(szMsg, 190, "/w", "^0") // team txt
    
    if(id) iPlayers[0] = id
    else get_players(iPlayers, iCount, "ch")
    
    for (new i = 0; i < iCount; i++)
    {
        if (is_user_connected(iPlayers[i]))
        {
            message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, iPlayers[i])
            write_byte(iPlayers[i])
            write_string(szMsg)
            message_end()
        }
    }
} 
Пробвай.
54 line & 91 line
if(g_iLimit >= 1) == > if(g_iLimit[id] >= 1)

Аватар
JustInCase
Извън линия
Потребител
Потребител
Мнения: 582
Регистриран на: 14 Окт 2016, 23:31
Се отблагодари: 4 пъти
Получена благодарност: 15 пъти

Re: Само по 1 Surv/Nem на рунд.

Мнение от JustInCase » 04 Апр 2017, 18:49

Оп да моя грешка едитнах си мнението
MANSION - HNS : 45.144.155.99:27026
ONLINE

Публикувай отговор
  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Заявки за плъгини”

Кой е на линия

Потребители разглеждащи този форум: 0 регистрирани и 39 госта