ZMBIO.RO
Counter-Strike [Plugin] Skin arme doar la Vip - Printable Version

+- ZMBIO.RO (https://zmbio.ro)
+-- Forum: Gaming portal (https://zmbio.ro/Forum-Gaming-portal)
+--- Forum: Counter-Strike 1.6 (https://zmbio.ro/Forum-Counter-Strike-1-6)
+---- Forum: [CS1.6] Plugins (https://zmbio.ro/Forum-CS1-6-Plugins)
+---- Thread: Counter-Strike [Plugin] Skin arme doar la Vip (/Thread-Counter-Strike-Plugin-Skin-arme-doar-la-Vip)



[Plugin] Skin arme doar la Vip - mindfreak. - 12-11-2025

Pluginu asta îl am de când aveam server de cs. E plugin cu skin pe arme doar pentru vip, activat prin comanda /skins

Code: 
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>

#define PLUGIN "Weapons Model Vip"
#define VERSION "1.0"
#define AUTHOR "SirErick"

new g_weapons[33], g_maxplayers

new const WEAPONENTNAMES[][] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10", "weapon_aug", "weapon_smokegrenade",
    "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550", "weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249",
    "weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552", "weapon_ak47", "weapon_knife", "weapon_p90" }

enum _:model_weapons
{
    V_AK47,
    V_M4A1,
    V_AWP
}
enum _:models_weapons_new
{
    V_WEAPONS[50]
}
new const new_weapons[model_weapons][models_weapons_new] =
{
   
    "models/v_ak47anubis.mdl",
    "models/v_m4a1victim.mdl",
    "models/v_awpwildstyle.mdl"
}

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    set_pcvar_string(register_cvar("Weapons Model Vip", VERSION, FCVAR_SERVER|FCVAR_SPONLY), VERSION)
    for (new i = 1; i < sizeof WEAPONENTNAMES; i++)
    {
        if(WEAPONENTNAMES[i][0]) RegisterHam(Ham_Item_Deploy, WEAPONENTNAMES[i], "fw_Item_Deploy_Post", 1)
    }
    register_clcmd("say /skins", "new_menu")
    g_maxplayers = get_maxplayers()
}
public plugin_precache()
{
    for(new i = 0;i < sizeof new_weapons;i++)
    {
           
        precache_model(new_weapons[i][V_WEAPONS]);
    }
}
public client_putinserver(id)
{
    g_weapons[id] = 0
}
public event_round_start()
{
    for (new id = 1; id <= g_maxplayers; id++)
    {
        if (!is_user_connected(id))
            continue;
               
    }
}   
public new_menu(id)
{
    if (!is_user_alive(id))
        return PLUGIN_HANDLED

    new Menu = menu_create("Extrem-Tutorials | Weapons", "show_menu_weapons")
    menu_additem(Menu, "AK47 Anubis"            , "1", 0)
    menu_additem(Menu, "M4A1 Victim "            , "2", 0)
    menu_additem(Menu, "AWP Wyld Style"            , "3", 0)

    menu_setprop(Menu,MPROP_EXITNAME,"Exit")
    menu_setprop(Menu, MPROP_EXIT, MEXIT_ALL)

    menu_display(id, Menu, 0)
    return PLUGIN_HANDLED
}
public show_menu_weapons(id, menu, item)
{
    if (!is_user_alive(id))
        return PLUGIN_HANDLED

    if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
    switch(item)
    {
        case 0:
        {
           
            g_weapons[id] = 1
        }
        case 1:
        {
           
            g_weapons[id] = 2
        }
        case 2:
        {
           
            g_weapons[id] = 3
        }
    }
    return PLUGIN_HANDLED;
}

public fw_Item_Deploy_Post(weapon_ent)
{
    if(!pev_valid(weapon_ent))
    return

    // Get weapon's owner
    static owner
    owner = fm_cs_get_weapon_ent_owner(weapon_ent)

    // Get weapon's id
    static weaponid
    weaponid = cs_get_weapon_id(weapon_ent)

    switch (weaponid)
    {
       
        case CSW_AK47:
        {
           
            if (g_weapons[owner] == 1)
            {
               
                set_pev(owner, pev_viewmodel2, new_weapons[V_AK47][V_WEAPONS])
            }
        }
        case CSW_M4A1:
        {
           
            if (g_weapons[owner] == 2)
            {
               
                set_pev(owner, pev_viewmodel2, new_weapons[V_M4A1][V_WEAPONS])
            }
        }
        case CSW_AWP:
        {
           
            if (g_weapons[owner] == 3)
            {
               
                set_pev(owner, pev_viewmodel2, new_weapons[V_AWP][V_WEAPONS])
            }
        }
    }
}   
stock fm_cs_get_weapon_ent_owner(ent)
{
    // Prevent server crash if entity's private data not initalized
    if (pev_valid(ent) != 2)
    return -1;

    return get_pdata_cbase(ent, 41, 4);
}
 Cel de sus e pluginul inițial, foarte simplist, cu acces pentru toată lumea. Și la asta am modificat niște linii. Deci e pluginul inițial cu mici modificări dar nu majore.

Mai jos aveți cel care îl foloseam eu pe server, modificat de mine.

Code: 
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>

#define PLUGIN "Weapons Model Vip"
#define VERSION "1.0"
#define AUTHOR "SirErick"

// Array-uri și variabile globale
new g_weapons[33], g_maxplayers;

new const WEAPONENTNAMES[][] = {
    "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4",
    "weapon_mac10", "weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven",
    "weapon_ump45", "weapon_sg550", "weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18",
    "weapon_awp", "weapon_mp5navy", "weapon_m249", "weapon_m3", "weapon_m4a1", "weapon_tmp",
    "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552", "weapon_ak47",
    "weapon_knife", "weapon_p90"
};

enum _:model_weapons {
    V_AK47,
    V_M4A1,
    V_AWP
};

enum _:models_weapons_new {
    V_WEAPONS[50]
};

new const new_weapons[model_weapons][models_weapons_new] = {
    "models/v_ak47anubis.mdl",
    "models/v_m4a1victim.mdl",
    "models/v_awpwildstyle.mdl"
};

// =================== Plugin Init ===================
public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR);

    // CVar simplu, nu afectează funcționalitatea
    set_pcvar_string(register_cvar("Weapons Model Vip", VERSION, FCVAR_SERVER|FCVAR_SPONLY), VERSION);

    // Înregistrăm toate armele pentru Ham Sandwich
    for (new i = 1; i < sizeof WEAPONENTNAMES; i++)
    {
        if(WEAPONENTNAMES[i][0])
            RegisterHam(Ham_Item_Deploy, WEAPONENTNAMES[i], "fw_Item_Deploy_Post", 1);
    }

    // Comanda pentru meniu
    register_clcmd("say /skins", "new_menu");

    g_maxplayers = get_maxplayers();
}

// =================== Precache Modele ===================
public plugin_precache()
{
    for(new i = 0; i < sizeof new_weapons; i++)
    {
        precache_model(new_weapons[i][V_WEAPONS]);
    }
}

// =================== Jucător în server ===================
public client_putinserver(id)
{
    g_weapons[id] = 0;
}

// =================== Round Start ===================
public event_round_start()
{
    for (new id = 1; id <= g_maxplayers; id++)
    {
        if (!is_user_connected(id))
            continue;
    }
}

// =================== Meniu VIP ===================
public new_menu(id)
{
    if (!is_user_alive(id))
        return PLUGIN_HANDLED;

    // Verificare VIP: flag "z"
    if (!(get_user_flags(id) & ADMFLAG_ROOT)) // Înlocuiește cu flagul VIP corect dacă e altul
    {
        client_print(id, print_chat, "\x04[Vip] \x01Only VIP can use this menu.");
        return PLUGIN_HANDLED;
    }

    new Menu = menu_create("Extrem-Tutorials| Vip Skins Weapons", "show_menu_weapons");
    menu_additem(Menu, "AK47 Anubis", "1", 0);
    menu_additem(Menu, "M4A1 Victim", "2", 0);
    menu_additem(Menu, "AWP Wyld Style", "3", 0);

    menu_setprop(Menu, MPROP_EXITNAME, "Exit");
    menu_setprop(Menu, MPROP_EXIT, MEXIT_ALL);

    menu_display(id, Menu, 0);
    return PLUGIN_HANDLED;
}

// =================== Meniu Callback ===================
public show_menu_weapons(id, menu, item)
{
    if (!is_user_alive(id))
        return PLUGIN_HANDLED;

    if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }

    switch(item)
    {
        case 0: g_weapons[id] = 1;
        case 1: g_weapons[id] = 2;
        case 2: g_weapons[id] = 3;
    }

    return PLUGIN_HANDLED;
}

// =================== Schimbare Model Arme ===================
public fw_Item_Deploy_Post(weapon_ent)
{
    if(!pev_valid(weapon_ent))
        return;

    static owner = fm_cs_get_weapon_ent_owner(weapon_ent);
    static weaponid = cs_get_weapon_id(weapon_ent);

    switch (weaponid)
    {
        case CSW_AK47:
        {
            if (g_weapons[owner] == 1)
                set_pev(owner, pev_viewmodel2, new_weapons[V_AK47][V_WEAPONS]);
        }
        case CSW_M4A1:
        {
            if (g_weapons[owner] == 2)
                set_pev(owner, pev_viewmodel2, new_weapons[V_M4A1][V_WEAPONS]);
        }
        case CSW_AWP:
        {
            if (g_weapons[owner] == 3)
                set_pev(owner, pev_viewmodel2, new_weapons[V_AWP][V_WEAPONS]);
        }
    }
}

// =================== Obținere Owner ===================
stock fm_cs_get_weapon_ent_owner(ent)
{
    if (pev_valid(ent) != 2)
        return -1;

    return get_pdata_cbase(ent, 41, 4);
}
Am pus la fiecare sma-ul, le puteți personaliza cum vreți, am zis sa îl pun, nici nu prea ma mai joc cs și nu avea rost sa îl țin prin laptop aiurea.