how to do off/on in the menu

Ако имате затруднения при изработката/преработката на даден плъгин - пишете тук, ще се опитаме да ви помогнем!
Аватар
USA_CA
Извън линия
Foreigner
Foreigner
Мнения: 106
Регистриран на: 19 Юли 2020, 18:02

how to do off/on in the menu

Мнение от USA_CA » 21 Авг 2020, 19:43

hello everyone as do in 5 point of off/on grenade sound, that would when clicked on point the on/off (and that would be written there on or off sound)

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

#include <amxmodx>

new g_iMenu;

public plugin_init() {
    register_plugin("Server Menu", "0.1", "maFFyoZZyk");
    register_clcmd("say /menu", "CmdMenu");
    register_clcmd("menu", "CmdMenu");
    register_clcmd("nightvision", "CmdMenu");
}

public plugin_cfg() {
    g_iMenu = menu_create("\wМеню", "MenuHandler")
    menu_additem(g_iMenu, "\r[\yanew\r]", "1");
    menu_additem(g_iMenu, "\r[\yreset score\r]", "2");
    menu_additem(g_iMenu, "\r[\ytest \rVIP]", "3");
    menu_additem(g_iMenu, "\r[\yvote for ban\r]", "4");
    menu_additem(g_iMenu, "\r[\ysound grenade\r]", "5");
    menu_additem(g_iMenu, "\r[\ymute\r]", "6");
    menu_additem(g_iMenu, "\r[\yadmin menu\r]", "7");
    menu_additem(g_iMenu, "\r[\ytop 15\r]", "8");
    
    menu_setprop(g_iMenu, MPROP_NEXTNAME, "further");
    menu_setprop(g_iMenu, MPROP_BACKNAME, "back");
    menu_setprop(g_iMenu, MPROP_EXITNAME, "exit");
    menu_setprop(g_iMenu, MPROP_EXIT,MEXIT_ALL);
}

public plugin_end() {
    menu_destroy(g_iMenu);
}

public CmdMenu(id) {
    menu_display(id, g_iMenu);
    return PLUGIN_HANDLED;
}

public MenuHandler(id, menu, item) {
    if (item == MENU_EXIT) {
        return;
    }
        
    new data[7];
    menu_item_getinfo(menu, item, .info = data, .infolen = charsmax(data));
    switch (str_to_num(data)) {
        case 1: client_cmd(id, "say /anew");
        case 2: client_cmd(id, "say /rs");
        case 3: client_cmd(id, "say /viptest");
        case 4: client_cmd(id, "say /voteban");
        case 5: client_cmd(id, "say /gsound");
	case 6: client_cmd(id, "say /mute");
        case 7:client_cmd(id, "amxmodmenu");
	case 8: client_cmd(id, "say /top15");
    }
}

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

how to do off/on in the menu

Мнение от OciXCrom » 22 Авг 2020, 14:28


Аватар
USA_CA
Извън линия
Foreigner
Foreigner
Мнения: 106
Регистриран на: 19 Юли 2020, 18:02

how to do off/on in the menu

Мнение от USA_CA » 22 Авг 2020, 14:56

OciXCrom написа: 22 Авг 2020, 14:28 Why not simply use this? https://forums.alliedmods.net/showthread.php?t=284324
can I do this please, it is more convenient for me, and opens on the key "N"

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

how to do off/on in the menu

Мнение от OciXCrom » 22 Авг 2020, 15:47

I don't see how editing a .sma file and recompiling the plugin is more convenient than editing an .ini file.
You assign it to the "nightvision" command if you want to open with N.

Аватар
USA_CA
Извън линия
Foreigner
Foreigner
Мнения: 106
Регистриран на: 19 Юли 2020, 18:02

how to do off/on in the menu

Мнение от USA_CA » 22 Авг 2020, 15:58

this is not what I want, I wanted when you click on the sounds of grenades, the inscription changed to on or off

Аватар
atmax
Извън линия
Потребител
Потребител
Мнения: 492
Регистриран на: 22 Мар 2018, 15:06
Се отблагодари: 37 пъти
Получена благодарност: 43 пъти

how to do off/on in the menu

Мнение от atmax » 22 Авг 2020, 18:07

Your post is in help with scripting and you asking how so I will show you how. But you can't do it in this code you have to do it in Grenade Sound plugin because there you have bool is it active or not then you do this:

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

new Temp[35]
formatex(Temp, charsmax(Temp), "Grenade Sound [%s]", g_bGrenade[id] ? "ON" : "\rOFF\w")
I can't explain it better..
Rest in peace my friend I always will remember you! 🖤👊

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

Обратно към “Помощ в скриптирането”

Кой е на линия

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