Куда добавить ColorChat после выбора модели оружия

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
42
Реакции
0
Как добавить информацию ColorChat после выбора модели оружия? Куда это добавить? Я получаю ошибки при добавлении (ожидаемый токен :;)

Код:
#include <amxmodx>
#include <amxmisc>
#include <engine> 
#include <vault>
#include <fun>
#include <colorchat>

#define PLUGIN "Wybor skinow"
#define VERSION "1.0.0" 
#define AUTHOR "K@MILOVVSKY"

new model_m4[33]
new model_ak[33]

public plugin_init() { 
    
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_event("CurWeapon","CurWeapon","be","1=1") 
    register_clcmd("say /skiny", "menuWyboru")
    register_clcmd("say /skin", "menuWyboru")
    register_clcmd("say /skins", "menuWyboru")
    register_clcmd("say /modele", "menuWyboru")
    register_clcmd("say /model", "menuWyboru")
    register_clcmd("say /models", "menuWyboru")
    
}

public plugin_precache() { 
    //precache_model("models/v_m4a1.mdl") // zwykla
    precache_model("models/gzh_skiny/m4a1/m4a1_1.mdl")
    precache_model("models/gzh_skiny/m4a1/m4a1_2.mdl")
    precache_model("models/gzh_skiny/m4a1/m4a1_3.mdl")
    precache_model("models/gzh_skiny/m4a1/m4a1_4.mdl")
    precache_model("models/gzh_skiny/m4a1/m4a1_5.mdl")
    
    //precache_model("models/v_ak47.mdl") // zwykly
    precache_model("models/gzh_skiny/ak47/ak47_1.mdl")
    precache_model("models/gzh_skiny/ak47/ak47_2.mdl")
    precache_model("models/gzh_skiny/ak47/ak47_3.mdl")
    precache_model("models/gzh_skiny/ak47/ak47_4.mdl")
    precache_model("models/gzh_skiny/ak47/ak47_5.mdl")
} 

public menuWyboru(id)
{
    new menuBody[512]
    formatex(menuBody, charsmax(menuBody), "\yWybierz bron")
    new menu = menu_create(menuBody, "skinsmenu")

    menu_additem(menu, "\wM4A1")
    menu_additem(menu, "\wAK47")
    
    
    menu_setprop(menu, MPROP_BACKNAME, "Wroc");
    menu_setprop(menu, MPROP_NEXTNAME, "Dalej");
    menu_setprop(menu, MPROP_EXITNAME, "Wyjscie");

    menu_display(id, menu);
}

public skinsmenu(id, menu, item) {

    if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
    
    switch(item) 
    {
        case 0: menu_m4(id)
        case 1: menu_ak(id)
        default: return PLUGIN_HANDLED
    }
    return PLUGIN_HANDLED
} 

public menu_m4(id) {
    new menuBody[512]
    formatex(menuBody, charsmax(menuBody), "\ySkiny do \rM4A1:")
    new menu = menu_create(menuBody, "m4menu")
    
    menu_additem(menu, "\wZwykla M4A1")
    
    menu_additem(menu, "\wM4A1 - Monster")
    
    menu_additem(menu, "\wM4A1 - Snake")
    
    menu_additem(menu, "\wM4A1 - Bench")
    
    menu_additem(menu, "\wM4A1 - Lizard")
    
    menu_additem(menu, "\wM4A1 - Dundert")
    
    
    menu_setprop(menu, MPROP_BACKNAME, "Wroc");
    menu_setprop(menu, MPROP_NEXTNAME, "Dalej");
    menu_setprop(menu, MPROP_EXITNAME, "Wyjscie");

    menu_display(id, menu);
}

public m4menu(id, menu, item) {
    switch(item) 
    {
        case 0: SetM4A1(id , 0) 
        case 1: SetM4A1(id , 1)
        case 2: SetM4A1(id , 2)
        case 3: SetM4A1(id , 3)
        case 4: SetM4A1(id , 4)
        case 5: SetM4A1(id , 5)
        default: return PLUGIN_HANDLED
    }
    ZapiszM4(id)
    return PLUGIN_HANDLED
} 

public SetM4A1(id , M4A1) {
    model_m4[id] = M4A1
    
    new Clip, Ammo, Weapon = get_user_weapon(id, Clip, Ammo) 
    if ( Weapon != CSW_M4A1 )
    return PLUGIN_HANDLED
    
    new vModel[56]
    
    switch(M4A1)
    {
    case 0: {
            format(vModel,55,"models/v_m4a1.mdl")
        }
    case 1: {
            format(vModel,55,"models/gzh_skiny/m4a1/m4a1_1.mdl")
        }
    case 2: {
            format(vModel,55,"models/gzh_skiny/m4a1/m4a1_2.mdl")
        }
    case 3: {
            format(vModel,55,"models/gzh_skiny/m4a1/m4a1_3.mdl")
        }
    case 4: {
            format(vModel,55,"models/gzh_skiny/m4a1/m4a1_4.mdl")
        }
    case 5: {
            format(vModel,55,"models/gzh_skiny/m4a1/m4a1_5.mdl")
        }
    } 
    
    entity_set_string(id, EV_SZ_viewmodel, vModel)
    
    return PLUGIN_HANDLED;  
}

public menu_ak(id) {
    new menuBody[512]
    formatex(menuBody, charsmax(menuBody), "\ySkiny do \rAK47:")
    new menu = menu_create(menuBody, "akmenu")
    
    menu_additem(menu, "\wZwykly AK47")
    
    menu_additem(menu, "\wAK47 - Feniks")
    
    menu_additem(menu, "\wAK47 - Mandrog")
    
    menu_additem(menu, "\wAK47 - Migween")
    
    menu_additem(menu, "\wAK47 - Botten")
    
    menu_additem(menu, "\wAK47 - Socween")
    
    
    menu_setprop(menu, MPROP_BACKNAME, "Wroc");
    menu_setprop(menu, MPROP_NEXTNAME, "Dalej");
    menu_setprop(menu, MPROP_EXITNAME, "Wyjscie");

    menu_display(id, menu);
}

public akmenu(id, menu, item) {
    switch(item) 
    {
        case 0: SetAK47(id , 0)
        case 1: SetAK47(id , 1)
        case 2: SetAK47(id , 2)
        case 3: SetAK47(id , 3)
        case 4: SetAK47(id , 4)
        case 5: SetAK47(id , 5)
        default: return PLUGIN_HANDLED
    }
    ZapiszAK(id)
    return PLUGIN_HANDLED
} 

public SetAK47(id , AK47) {
    model_ak[id] = AK47
    
    new Clip, Ammo, Weapon = get_user_weapon(id, Clip, Ammo) 
    if ( Weapon != CSW_AK47 )
    return PLUGIN_HANDLED
    
    new vModel[56]
    
    switch(AK47)
    {
    case 0: {
            format(vModel,55,"models/v_ak47.mdl")
        }
    case 1: {
            format(vModel,55,"models/gzh_skiny/ak47/ak47_1.mdl")
        }
    case 2: {
            format(vModel,55,"models/gzh_skiny/ak47/ak47_2.mdl")
        }
    case 3: {
            format(vModel,55,"models/gzh_skiny/ak47/ak47_3.mdl")
        }
    case 4: {
            format(vModel,55,"models/gzh_skiny/ak47/ak47_4.mdl")
        }
    case 5: {
            format(vModel,55,"models/gzh_skiny/ak47/ak47_5.mdl")
        }
    } 
    
    entity_set_string(id, EV_SZ_viewmodel, vModel)
    
    return PLUGIN_HANDLED;  
}

public CurWeapon(id)
{
    if(!is_user_alive(id))
        return PLUGIN_HANDLED;
    

    SetM4A1(id, model_m4[id])
    SetAK47(id, model_ak[id])
    
    return PLUGIN_HANDLED   

}

public client_authorized(id)
{
    ZaladujM4(id)
    ZaladujAK(id)
}


ZapiszM4(id)
{ 
    
    new authid[32]
    get_user_authid(id, authid, 31)
    
    new vaultkey[64]
    new vaultdata[64]
    
    format(vaultkey, 63, "M4A1_%s", authid)
    format(vaultdata, 63, "%d", model_m4[id])
    set_vaultdata(vaultkey, vaultdata)
}

ZaladujM4(id) 
{ 
    new authid[32] 
    get_user_authid(id,authid,31)
    
    new vaultkey[64], vaultdata[64]
    
    format(vaultkey, 63, "M4A1_%s", authid)
    get_vaultdata(vaultkey, vaultdata, 63)
    model_m4[id] = str_to_num(vaultdata)
    
}

ZapiszAK(id)
{ 
    
    new authid[32]
    get_user_authid(id, authid, 31)
    
    new vaultkey[64]
    new vaultdata[64]
    
    format(vaultkey, 63, "AK47_%s", authid)
    format(vaultdata, 63, "%d", model_ak[id])
    set_vaultdata(vaultkey, vaultdata)
}

ZaladujAK(id) 
{ 
    new authid[32] 
    get_user_authid(id,authid,31)
    
    new vaultkey[64], vaultdata[64]
    
    format(vaultkey, 63, "AK47_%s", authid)
    get_vaultdata(vaultkey, vaultdata, 63)
    model_ak[id] = str_to_num(vaultdata)
    
}




/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
ColorChat(id, NORMAL, "text");
 
Сообщения
336
Реакции
417
Помог
7 раз(а)
Код:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <vault>
#include <fun>
#include <colorchat>

#define PLUGIN "Wybor skinow"
#define VERSION "1.0.0"
#define AUTHOR "K@MILOVVSKY"

new model_m4[33]
new model_ak[33]

public plugin_init() {
    
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_event("CurWeapon","CurWeapon","be","1=1")
    register_clcmd("say /skiny", "menuWyboru")
    register_clcmd("say /skin", "menuWyboru")
    register_clcmd("say /skins", "menuWyboru")
    register_clcmd("say /modele", "menuWyboru")
    register_clcmd("say /model", "menuWyboru")
    register_clcmd("say /models", "menuWyboru")
    
}

public plugin_precache() {
    //precache_model("models/v_m4a1.mdl") // zwykla
    precache_model("models/gzh_skiny/m4a1/m4a1_1.mdl")
    precache_model("models/gzh_skiny/m4a1/m4a1_2.mdl")
    precache_model("models/gzh_skiny/m4a1/m4a1_3.mdl")
    precache_model("models/gzh_skiny/m4a1/m4a1_4.mdl")
    precache_model("models/gzh_skiny/m4a1/m4a1_5.mdl")
    
    //precache_model("models/v_ak47.mdl") // zwykly
    precache_model("models/gzh_skiny/ak47/ak47_1.mdl")
    precache_model("models/gzh_skiny/ak47/ak47_2.mdl")
    precache_model("models/gzh_skiny/ak47/ak47_3.mdl")
    precache_model("models/gzh_skiny/ak47/ak47_4.mdl")
    precache_model("models/gzh_skiny/ak47/ak47_5.mdl")
}

public menuWyboru(id)
{
    new menuBody[512]
    formatex(menuBody, charsmax(menuBody), "\yWybierz bron")
    new menu = menu_create(menuBody, "skinsmenu")

    menu_additem(menu, "\wM4A1")
    menu_additem(menu, "\wAK47")
    
    
    menu_setprop(menu, MPROP_BACKNAME, "Wroc");
    menu_setprop(menu, MPROP_NEXTNAME, "Dalej");
    menu_setprop(menu, MPROP_EXITNAME, "Wyjscie");

    menu_display(id, menu);
}

public skinsmenu(id, menu, item) {

    if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
    
    switch(item)
    {
        case 0: menu_m4(id)
        case 1: menu_ak(id)
        default: return PLUGIN_HANDLED
    }
    return PLUGIN_HANDLED
}

public menu_m4(id) {
    new menuBody[512]
    formatex(menuBody, charsmax(menuBody), "\ySkiny do \rM4A1:")
    new menu = menu_create(menuBody, "m4menu")
    
    menu_additem(menu, "\wZwykla M4A1")
    
    menu_additem(menu, "\wM4A1 - Monster")
    
    menu_additem(menu, "\wM4A1 - Snake")
    
    menu_additem(menu, "\wM4A1 - Bench")
    
    menu_additem(menu, "\wM4A1 - Lizard")
    
    menu_additem(menu, "\wM4A1 - Dundert")
    
    
    menu_setprop(menu, MPROP_BACKNAME, "Wroc");
    menu_setprop(menu, MPROP_NEXTNAME, "Dalej");
    menu_setprop(menu, MPROP_EXITNAME, "Wyjscie");

    menu_display(id, menu);
}

public m4menu(id, menu, item) {
    switch(item)
    {
        case 0:
        {
            SetM4A1(id , 0)
            ColorChat(id, NORMAL, "You have chosen the M4A1 skin")
        }
        case 1:
        {
            SetM4A1(id , 1)
            ColorChat(id, NORMAL, "You have chosen the M4A1 Monster skin")
        }
        case 2:
        {
            SetM4A1(id , 2)
            ColorChat(id, NORMAL, "You have chosen the M4A1 Snake skin")
        }
        case 3:
        {
            SetM4A1(id , 3)
            ColorChat(id, NORMAL, "You have chosen the M4A1 Bench skin")
        }
        case 4:
        {
            SetM4A1(id , 4)
            ColorChat(id, NORMAL, "You have chosen the M4A1 Lizard skin")
        }
        case 5:
        {
            SetM4A1(id , 5)
            ColorChat(id, NORMAL, "You have chosen the M4A1 Dundert skin")
        }
        default: return PLUGIN_HANDLED
    }
    ZapiszM4(id)
    return PLUGIN_HANDLED
}

public SetM4A1(id , M4A1) {
    model_m4[id] = M4A1
    
    new Clip, Ammo, Weapon = get_user_weapon(id, Clip, Ammo)
    if ( Weapon != CSW_M4A1 )
    return PLUGIN_HANDLED
    
    new vModel[56]
    
    switch(M4A1)
    {
    case 0: {
            format(vModel,55,"models/v_m4a1.mdl")
        }
    case 1: {
            format(vModel,55,"models/gzh_skiny/m4a1/m4a1_1.mdl")
        }
    case 2: {
            format(vModel,55,"models/gzh_skiny/m4a1/m4a1_2.mdl")
        }
    case 3: {
            format(vModel,55,"models/gzh_skiny/m4a1/m4a1_3.mdl")
        }
    case 4: {
            format(vModel,55,"models/gzh_skiny/m4a1/m4a1_4.mdl")
        }
    case 5: {
            format(vModel,55,"models/gzh_skiny/m4a1/m4a1_5.mdl")
        }
    }
    
    entity_set_string(id, EV_SZ_viewmodel, vModel)
    
    return PLUGIN_HANDLED; 
}

public menu_ak(id) {
    new menuBody[512]
    formatex(menuBody, charsmax(menuBody), "\ySkiny do \rAK47:")
    new menu = menu_create(menuBody, "akmenu")
    
    menu_additem(menu, "\wZwykly AK47")
    
    menu_additem(menu, "\wAK47 - Feniks")
    
    menu_additem(menu, "\wAK47 - Mandrog")
    
    menu_additem(menu, "\wAK47 - Migween")
    
    menu_additem(menu, "\wAK47 - Botten")
    
    menu_additem(menu, "\wAK47 - Socween")
    
    
    menu_setprop(menu, MPROP_BACKNAME, "Wroc");
    menu_setprop(menu, MPROP_NEXTNAME, "Dalej");
    menu_setprop(menu, MPROP_EXITNAME, "Wyjscie");

    menu_display(id, menu);
}

public akmenu(id, menu, item) {
    switch(item)
    {
        case 0:
        {
            SetAK47(id , 0)
            ColorChat(id, NORMAL, "You have chosen the AK47 skin")
        }
        case 1:
        {
            SetAK47(id , 1)
            ColorChat(id, NORMAL, "You have chosen the AK47 Feniks skin")
        }
        case 2:
        {
            SetAK47(id , 2)
            ColorChat(id, NORMAL, "You have chosen the AK47 Mandrog skin")
        }
        case 3:
        {
            SetAK47(id , 3)
            ColorChat(id, NORMAL, "You have chosen the AK47 Migween skin")
        }
        case 4:
        {
            SetAK47(id , 4)
            ColorChat(id, NORMAL, "You have chosen the AK47 Botten skin")
        }
        case 5:
        {
            SetAK47(id , 5)
            ColorChat(id, NORMAL, "You have chosen the AK47 Socween skin")
        }
        default: return PLUGIN_HANDLED
    }
    ZapiszAK(id)
    return PLUGIN_HANDLED
}

public SetAK47(id , AK47) {
    model_ak[id] = AK47
    
    new Clip, Ammo, Weapon = get_user_weapon(id, Clip, Ammo)
    if ( Weapon != CSW_AK47 )
    return PLUGIN_HANDLED
    
    new vModel[56]
    
    switch(AK47)
    {
    case 0: {
            format(vModel,55,"models/v_ak47.mdl")
        }
    case 1: {
            format(vModel,55,"models/gzh_skiny/ak47/ak47_1.mdl")
        }
    case 2: {
            format(vModel,55,"models/gzh_skiny/ak47/ak47_2.mdl")
        }
    case 3: {
            format(vModel,55,"models/gzh_skiny/ak47/ak47_3.mdl")
        }
    case 4: {
            format(vModel,55,"models/gzh_skiny/ak47/ak47_4.mdl")
        }
    case 5: {
            format(vModel,55,"models/gzh_skiny/ak47/ak47_5.mdl")
        }
    }
    
    entity_set_string(id, EV_SZ_viewmodel, vModel)
    
    return PLUGIN_HANDLED; 
}

public CurWeapon(id)
{
    if(!is_user_alive(id))
        return PLUGIN_HANDLED;
    

    SetM4A1(id, model_m4[id])
    SetAK47(id, model_ak[id])
    
    return PLUGIN_HANDLED   

}

public client_authorized(id)
{
    ZaladujM4(id)
    ZaladujAK(id)
}


ZapiszM4(id)
{
    
    new authid[32]
    get_user_authid(id, authid, 31)
    
    new vaultkey[64]
    new vaultdata[64]
    
    format(vaultkey, 63, "M4A1_%s", authid)
    format(vaultdata, 63, "%d", model_m4[id])
    set_vaultdata(vaultkey, vaultdata)
}

ZaladujM4(id)
{
    new authid[32]
    get_user_authid(id,authid,31)
    
    new vaultkey[64], vaultdata[64]
    
    format(vaultkey, 63, "M4A1_%s", authid)
    get_vaultdata(vaultkey, vaultdata, 63)
    model_m4[id] = str_to_num(vaultdata)
    
}

ZapiszAK(id)
{
    
    new authid[32]
    get_user_authid(id, authid, 31)
    
    new vaultkey[64]
    new vaultdata[64]
    
    format(vaultkey, 63, "AK47_%s", authid)
    format(vaultdata, 63, "%d", model_ak[id])
    set_vaultdata(vaultkey, vaultdata)
}

ZaladujAK(id)
{
    new authid[32]
    get_user_authid(id,authid,31)
    
    new vaultkey[64], vaultdata[64]
    
    format(vaultkey, 63, "AK47_%s", authid)
    get_vaultdata(vaultkey, vaultdata, 63)
    model_ak[id] = str_to_num(vaultdata)
    
}




/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
 
Сообщения
42
Реакции
0
Отлично, работает. Могли бы вы все же сделать так, чтобы меню не исчезало после выбора опции?
Я бы хотел, чтобы меню исчезало только тогда, когда игрок нажимает клавишу EXIT - 0.
 
Сообщения
1,316
Реакции
2,317
Помог
57 раз(а)
Отлично, работает. Могли бы вы все же сделать так, чтобы меню не исчезало после выбора опции?
Я бы хотел, чтобы меню исчезало только тогда, когда игрок нажимает клавишу EXIT - 0.
  • This section contains topics that require assistance with the revision or explanation of the material.
  • The topic should be published attempts (diff code or sequence of actions) self-search solutions.
    If you have no experience and attempts to understand the problem yourself, then you should go to the "Purchase" section.
 
Статус
В этой теме нельзя размещать новые ответы.

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу