Weapon skin system - хочу поправить

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
13
Реакции
-1
завуалированный мат
Приветствую ребят ,знаю что есть подобные темы ,но не гудите пожалуйста !*)
есть плагин weapon skin system есть меню knife_menu

1.в weapon skin system нужно что бы скины брали админы и ВИПЫ
2.если можно разбить все по стволам(ак,авп и т.д.)
3.если игрок не вип и не админ то ему пишет в чате
4.Измените мой исходник пожалуйста!

С меня 50 на баланс!


это мой исходник который контачит с knife_menu
Код:
new g_iForwards[5];
new Float:g_flLastTouchTime;
new bool:g_bIgnoreSetModel = 1;
new FILE_MODELS[17] =
{
    119, 101, 97, 112, 111, 110, 95, 115, 107, 105, 110, 115, 46, 105, 110, 105, 0
};
new Array:g_aWeaponSkins;
new g_LoadedWeapons;
new g_iWeaponSkinsCount;
new g_iPlayerSkins[33][32];
bool:operator==(Float:,Float:)(Float:oper1, Float:oper2)
{
    return floatcmp(oper1, oper2) == 0;
}

public __fatal_ham_error(Ham:id, HamError:err, reason[])
{
    new func = get_func_id("HamFilter", -1);
    new bool:fail = 1;
    new var1;
    if (func != -1 && callfunc_begin_i(func, -1) == 1)
    {
        callfunc_push_int(id);
        callfunc_push_int(err);
        callfunc_push_str(reason, "HamFilter");
        if (callfunc_end() == 1)
        {
            fail = false;
        }
    }
    if (fail)
    {
        set_fail_state(reason);
    }
    return 0;
}

public plugin_init()
{
    register_plugin("Weapon Skin System", "0.6.0-50", "Mistrick");
    register_clcmd("say /skins", "Command_ChangeSkin", -1, 4772, -1);
    register_clcmd("say /skinreset", "Command_ResetSkin", -1, 4772, -1);
    g_iForwards[0] = CreateMultiForward("wss_weapon_deploy", "HamFilter", 0, 0, 0, 0);
    g_iForwards[1] = CreateMultiForward("wss_weapon_holster", "HamFilter", 0, 0, 0, 0);
    g_iForwards[2] = CreateMultiForward("wss_weapon_can_pickup", "", 0, 0, 0, 0, 0);
    g_iForwards[3] = CreateMultiForward("wss_weapon_drop", "", 0, 0, 0, 0, 0);
    RegisterWeapons();
    RegisterWeaponDrop();
    return 0;
}

RegisterWeapons()
{
    new i = 1;
    new weapon_name[32];
    while (i < 30)
    {
        if (get_weaponname(i, weapon_name, 31))
        {
            RegisterHam(66, weapon_name, "Ham_WeaponDeploy_Post", 1);
            RegisterHam(FILE_MODELS, weapon_name, "Ham_WeaponHolster_Post", 1);
            RegisterHam("", weapon_name, "Ham_WeaponAddToPlayer_Post", 1);
        }
        i++;
    }
    register_touch("armoury_entity", "player", "CArmouryEntity__Touch");
    register_touch("weaponbox", "player", "CWeaponBox__Touch");
    return 0;
}

RegisterWeaponDrop()
{
    RegisterHam("HamFilter", "grenade", "Ham_WeaponSpawn_Post", 1);
    RegisterHam("HamFilter", "weaponbox", "Ham_WeaponSpawn_Post", 1);
    register_forward("", "FM_SetModel_Pre", "HamFilter");
    return 0;
}

public plugin_precache()
{
    new file_path[128];
    get_localinfo("amxx_configsdir", file_path, 127);
    format(file_path, 127, "%s/%s", file_path, FILE_MODELS);
    new file = fopen(file_path, "rt");
    if (!file)
    {
        set_fail_state("File not found!");
    }
    g_aWeaponSkins = ArrayCreate(99, 1);
    new fwd = CreateMultiForward("wss_loaded_skin", "HamFilter", 0, 0, 2);
    new buffer[256];
    new weapon_name[32];
    new skin_name[32];
    new model_v[64];
    new model_p[64];
    new model_w[64];
    new weaponid;
    new skin_info[99];
    new ret;
    while (!feof(file))
    {
        fgets(file, buffer, 255);
        new var1;
        if (!(!buffer[0] || buffer[0] == 59))
        {
            parse(buffer, weapon_name, 31, skin_name, 31, model_v, 63, model_p, 63, model_w, 63);
            weaponid = get_weapon_csw(weapon_name);
            if (weaponid)
            {
                skin_info[0] = weaponid;
                g_LoadedWeapons = 1 << weaponid | g_LoadedWeapons;
                new var2;
                if (model_v[0] && file_exists(model_v))
                {
                    skin_info[33] = engfunc(43, model_v);
                    precache_model(model_v);
                }
                new var3;
                if (model_p[0] && file_exists(model_p))
                {
                    skin_info[34] = engfunc(43, model_p);
                    precache_model(model_p);
                }
                new var4;
                if (model_w[0] && file_exists(model_w))
                {
                    copy(skin_info[35], "", model_w);
                    precache_model(model_w);
                }
                copy(skin_info[1], 31, skin_name);
                ExecuteForward(fwd, ret, g_iWeaponSkinsCount + 1, weaponid, skin_name);
                ArrayPushArray(g_aWeaponSkins, skin_info);
                g_iWeaponSkinsCount += 1;
                skin_info[33] = 0;
                skin_info[34] = 0;
                skin_info[35] = 0;
            }
        }
    }
    fclose(file);
    if (!g_iWeaponSkinsCount)
    {
        ArrayDestroy(g_aWeaponSkins);
        set_fail_state("File is empty!");
    }
    return 0;
}

public plugin_natives()
{
    register_library("weapon_skin_system");
    register_native("wss_get_weapon_skin_index", "native_get_weapon_skin_index", "HamFilter");
    register_native("wss_get_skin_name", "native_get_skin_name", "HamFilter");
    register_native("wss_set_user_skin", "native_set_user_skin", "HamFilter");
    return 0;
}

public native_get_weapon_skin_index(plugin, params)
{
    new weapon = get_param(1);
    return pev(weapon, 103);
}

public native_get_skin_name(plugin, params)
{
    new skin = get_param(1);
    new var1;
    if (skin < 1 || skin > g_iWeaponSkinsCount)
    {
        log_error(10, "[WSS] Get skin name: wrong skin index! index %d", skin);
        return 0;
    }
    new skin_info[99];
    ArrayGetArray(g_aWeaponSkins, skin + -1, skin_info);
    set_string(2, skin_info[1], get_param(""));
    return 1;
}

public native_set_user_skin(plugin, params)
{
    new id = get_param(1);
    new weaponid = get_param(2);
    new skin_index = get_param("");
    new var1;
    if (id < 1 || id > 32)
    {
        log_error(10, "[WSS] Set user skin: wrong player index! index %d", id);
        return 0;
    }
    if (!weaponid)
    {
        arrayset(g_iPlayerSkins[id], "HamFilter", 32);
        return 1;
    }
    g_iPlayerSkins[id][weaponid] = skin_index;
    return 1;
}

public client_connect(id)
{
    arrayset(g_iPlayerSkins[id], "HamFilter", 32);
    return 0;
}

public Command_ChangeSkin(id)
{
    new menu = menu_create("Skin Menu", "SkinMenu_Handler", "HamFilter");
    new skin_info[99];
    new i;
    while (i < g_iWeaponSkinsCount)
    {
        ArrayGetArray(g_aWeaponSkins, i, skin_info);
        menu_additem(menu, skin_info[1], 7512, "HamFilter", -1);
        i++;
    }
    menu_display(id, menu, "HamFilter");
    return 0;
}

public SkinMenu_Handler(id, menu, item)
{
    if (item == -3)
    {
        menu_destroy(menu);
        return 1;
    }
    new skin_info[99];
    ArrayGetArray(g_aWeaponSkins, item, skin_info);
    g_iPlayerSkins[id][skin_info[0]] = item + 1;
    new weapon;
    new weaponid;
    new cur_weapon = get_pdata_cbase(id, 373, 5);
    new i;
    while (i < 6)
    {
        weapon = get_pdata_cbase(id, i + 367, 5);
        while (pev_valid(weapon) == 2)
        {
            weaponid = get_pdata_int(weapon, 43, 4);
            if (skin_info[0] == weaponid)
            {
                set_pev(weapon, 103, item + 1);
                if (cur_weapon == weapon)
                {
                    if (skin_info[33])
                    {
                        set_pev(id, 67, skin_info[33]);
                    }
                    if (skin_info[34])
                    {
                        set_pev(id, FILE_MODELS, skin_info[34]);
                    }
                }
                i = 6;
                i++;
            }
            weapon = get_pdata_cbase(weapon, 42, 4);
        }
        i++;
    }
    menu_destroy(menu);
    return 1;
}

public Command_ResetSkin(id)
{
    static weapons[31][0] =
    {
        {
            0, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        }
    };
    new menu = menu_create("Skin Reset", "SkinReset_Handler", "HamFilter");
    new i = 1;
    new num[2];
    while (i < 32)
    {
        new var1;
        if (1 << i & g_LoadedWeapons && g_iPlayerSkins[id][i])
        {
            num[0] = i;
            menu_additem(menu, weapons[i], num, "HamFilter", -1);
        }
        i++;
    }
    menu_display(id, menu, "HamFilter");
    return 0;
}

public SkinReset_Handler(id, menu, item)
{
    if (item == -3)
    {
        menu_destroy(menu);
        return 1;
    }
    new info[2];
    new buffer;
    menu_item_getinfo(menu, item, buffer, info, 1, {0}, "HamFilter", buffer);
    new weaponid = info[0];
    g_iPlayerSkins[id][weaponid] = 0;
    menu_destroy(menu);
    return 1;
}

public Ham_WeaponDeploy_Post(weapon)
{
    new id = get_pdata_cbase(weapon, 41, 4);
    new weaponid = get_pdata_int(weapon, 43, 4);
    new skin = pev(weapon, 103);
    if (skin)
    {
        new skin_info[99];
        ArrayGetArray(g_aWeaponSkins, skin + -1, skin_info);
        if (skin_info[33])
        {
            set_pev(id, 67, skin_info[33]);
        }
        if (skin_info[34])
        {
            set_pev(id, FILE_MODELS, skin_info[34]);
        }
        new ret;
        ExecuteForward(g_iForwards[0], ret, id, weapon, weaponid, skin);
    }
    return 0;
}

public Ham_WeaponHolster_Post(weapon)
{
    new id = get_pdata_cbase(weapon, 41, 4);
    new weaponid = get_pdata_int(weapon, 43, 4);
    new skin = pev(weapon, 103);
    if (skin)
    {
        new ret;
        ExecuteForward(g_iForwards[1], ret, id, weapon, weaponid, skin);
    }
    return 0;
}

public CArmouryEntity__Touch(ent, id)
{
    g_flLastTouchTime = get_gametime();
    return 0;
}

public CWeaponBox__Touch(ent, id)
{
    new i;
    new weapon;
    while (i < 6)
    {
        weapon = get_pdata_cbase(ent, i + 34, 4);
        if (pev_valid(weapon) == 2)
        {
            new id = pev(ent, 18);
            new weaponid = get_pdata_int(weapon, 43, 4);
            new skin = pev(weapon, 103);
            if (skin)
            {
                new ret;
                ExecuteForward(g_iForwards[2], ret, id, ent, weapon, weaponid, skin);
                if (ret)
                {
                    return 1;
                }
            }
        }
        i++;
    }
    return 0;
}

public Ham_WeaponAddToPlayer_Post(weapon, id)
{
    new weaponid = get_pdata_int(weapon, 43, 4);
    new type;
    if (0 < pev(weapon, 18))
    {
        type = 0;
    }
    else
    {
        if (get_gametime() == g_flLastTouchTime)
        {
            type = 1;
        }
        type = 2;
    }
    new var1;
    if (type == 1 || type)
    {
        return 1;
    }
    if (pev(weapon, 103))
    {
        return 1;
    }
    if (g_iPlayerSkins[id][weaponid])
    {
        set_pev(weapon, 103, g_iPlayerSkins[id][weaponid]);
    }
    return 1;
}

public Ham_WeaponSpawn_Post(ent)
{
    if (pev_valid(ent) == 2)
    {
        g_bIgnoreSetModel = false;
    }
    return 0;
}

public FM_SetModel_Pre(ent)
{
    new var1;
    if (g_bIgnoreSetModel || !pev_valid(ent) == 2)
    {
        return 1;
    }
    g_bIgnoreSetModel = true;
    new classname[32];
    pev(ent, 1, classname, 31);
    if (equal(classname, "grenade", "HamFilter"))
    {
        new id = pev(ent, 18);
        new weaponid = fm_cs_get_grenade_type(ent);
        new ret = cs_weapon_drop(id, ent, ent, weaponid);
        if (ret)
        {
            return 4;
        }
        return 1;
    }
    new i;
    new weapon;
    while (i < 6)
    {
        weapon = get_pdata_cbase(ent, i + 34, 4);
        if (pev_valid(weapon) == 2)
        {
            new id = pev(ent, 18);
            new weaponid = get_pdata_int(weapon, 43, 4);
            new ret = cs_weapon_drop(id, ent, weapon, weaponid);
            if (ret)
            {
                return 4;
            }
        }
        i++;
    }
    return 1;
}

cs_weapon_drop(id, weaponbox, weapon, weaponid)
{
    new skin = pev(weapon, 103);
    if (skin)
    {
        new skin_info[99];
        ArrayGetArray(g_aWeaponSkins, skin + -1, skin_info);
        engfunc(2, weaponbox, skin_info[35]);
        new ret;
        ExecuteForward(g_iForwards[3], ret, id, weaponbox, weapon, weaponid, skin);
        return 1;
    }
    return 0;
}

get_weapon_csw(weapon_name[])
{
    static weapons[31][0] =
    {
        {
            0, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        },
        {
            119, ...
        }
    };
    new i = 1;
    while (i < 31)
    {
        if (equali(weapon_name, weapons[i], "HamFilter"))
        {
            return i;
        }
        i++;
    }
    return 0;
}

fm_cs_get_grenade_type(index)
{
    new bits = get_pdata_int(index, 114, 5);
    if (bits & 1)
    {
        return 4;
    }
    if (bits & 2)
    {
        return 9;
    }
    if (!bits)
    {
        return 25;
    }
    return 0;
}
 

Вложения

Последнее редактирование:
Сообщения
13
Реакции
-1
wopox1337, я не чего,он работает все гуд ...меню вылазит через knife_menu
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Knife Menu"
#define VERSION "1.0"
#define AUTHOR "NinTenDo-Cs"

new keys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_0
new keys2 = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_9|MENU_KEY_0

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)

register_menu("Menu", keys, "func_menu")
register_menu("Priv", keys2, "func_priv")

register_clcmd("menu", "knife_menu")
register_clcmd("amx_menu", "knife_menu")
register_clcmd("server_menu", "knife_menu")


register_clcmd("nightvision", "knife_menu") // открытие меню на "N" - ночное видение.

register_clcmd("say /menu", "knife_menu")
register_clcmd("say_team /menu", "knife_menu")
}

public knife_menu(id)
{
static menu[650], iLen
iLen = 0
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "\y[\wМЕНЮ СЕРВЕРА\y] \y[\wЖЕНСКИЙ МАТРИАРХАТ\y]^n\r[\yОнлайн покупка\r] \rORLBUY.RU^n\r[\yIP\r] \w178.170.189.186:27015^n^n")

iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\y[\r1\y] [\wТОП 15\y]^n")
keys |= MENU_KEY_1
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\y[\r2\y] [\wЗамутить \rГовнюка\y]^n")
keys |= MENU_KEY_2
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\y[\r3\y] [\wСкины\y]^n")
keys |= MENU_KEY_3
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\y[\r4\y] [\wМеню \rмузыки\y]^n")
keys |= MENU_KEY_4
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\y[\r5\y] [\rБосс\y]^n")
keys |= MENU_KEY_5
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\y[\r6\y] [\rОбнулить \wсчёт\y]^n")
keys |= MENU_KEY_6
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\y[\r7\y] [\wСменить карту\y]^n^n")
keys |= MENU_KEY_7
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\y[\r8\y] [\rПривилегии\y]^n^n")
keys |= MENU_KEY_8

iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\y[\r0\y] [\wВыход\y]^n")
keys |= MENU_KEY_0

show_menu(id, keys, menu, -1, "Menu")
return PLUGIN_HANDLED
}

public func_menu(id, key)
{
switch(key)
{
case 0: client_cmd(id, "say /top15")
case 1: client_cmd(id, "say /mute")
case 2: client_cmd(id, "say /skins")
case 3: client_cmd(id, "say /ermmenu")
case 4: client_cmd(id, "say /boss")
case 5: client_cmd(id, "say /rs")
case 6: client_cmd(id, "say /rtv")
case 7: priv_menu(id)
}
return PLUGIN_HANDLED
}

public priv_menu(id)
{
static menu[650], iLen
iLen = 0
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "\y[\wМЕНЮ СЕРВЕРА\y] \y[\wЖЕНСКИЙ МАТРИАРХАТ\y]^n\r[\yОнлайн покупка\r] \rORLBUY.RU^n\r[\yIP\r] \w178.170.189.186:27015^n^n")

if(get_user_flags(id) & ADMIN_LEVEL_H) // Флаг доступа.
{
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\y[\r1\y] [\wВип\y]^n")
keys |= MENU_KEY_1
}
else
{
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\y[\r1\y] \d[Вип]^n")
keys &= ~MENU_KEY_1
}
if(get_user_flags(id) & ADMIN_BAN) // Флаг доступа.
{
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\y[\r2\y] [\rАдмин-меню\y]^n")
keys |= MENU_KEY_2
}
else
{
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\y[\r2\y] \r[Админ-меню]^n")
keys &= ~MENU_KEY_2
}


iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\y[\r0\y] [\wВыход\y]^n")
keys |= MENU_KEY_0

show_menu(id, keys2, menu, -1, "Priv")
return PLUGIN_HANDLED
}

public func_priv(id, key)
{
switch(key)
{
case 0: client_cmd(id, "vipmenu")
case 1: client_cmd(id, "amxmodmenu")
}
return PLUGIN_HANDLED
}
 
Сообщения
1,304
Реакции
2,303
Помог
57 раз(а)
Revolt-34,
4.Измените мой исходник пожалуйста!
С этим вам сюда. Но сразу предупреждаю, за те деньги, что вы предложили, даже школьник за заказ не возьмётся.
 
Статус
В этой теме нельзя размещать новые ответы.

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

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