Скины в випе ограничиваются!

Статус
В этой теме нельзя размещать новые ответы.

trekken

Участник
Сообщения
497
Реакции
182
Операционная система
Linux
Список мета-модулей
[01] SourceMod (1.10.0.6502) by AlliedModders LLC
[02] CSGO-ArmsFix (1.0) by Kyle (4y)
[03] CS Tools (1.10.0.6502) by AlliedModders LLC
[04] SDK Tools (1.10.0.6502) by AlliedModders LLC
[05] SDK Hooks (1.10.0.6502) by AlliedModders LLC
[06] SteamWorks Extension (1.2.3) by Kyle Sanderson
[07] DHooks (2.2.0-detours9) by Dr!fter
[08] SendProxy Manager (1.2) by Afronanny
[09] PTaH (1.1.3) by Phoenix (˙·٠●Феникс●٠·˙)
Список плагинов SM
01 "BlockingZones | Блокирующие зоны" (1.3) by Drumanid
02 "Fun Votes" (1.10.0.6502) by AlliedModders LLC
03 "Private Messages" (1.3.1) by Bristwex imperia-css.ru
04 "Admin Menu" (1.10.0.6502) by AlliedModders LLC
05 "Rock The Vote" (1.7.3-dev+5217) by AlliedModders LLC
06 "SuperAdminka" (1.5.2) by Grey™
07 "Token Auto Updater" (1.4) by Phoenix (˙·٠●Феникс●٠·˙)
08 "[VIP] Command Blocker" (1.0) by FIVE (Discord: FIVE#3136) & Someone
09 "Player Commands" (1.10.0.6502) by AlliedModders LLC
10 "Fun Commands" (1.10.0.6502) by AlliedModders LLC
11 "Grenade Smoke Color" (1.3.1) by HSFighter
12 "-N- Arms Fix" (2.0.3) by NomisCZ (-N-)
13 "Fake cases" (1.0) by tommie113
14 "[CS:GO] ResetScore" (1.0) by pracc
15 "HotGuard AntiCheat" (3.2.1) by MaZa
16 "Fix Hint Color Messages" (1.2.2 Franc1sco franug github version) by Phoenix (˙·٠●Феникс●٠·˙)
17 "Weapon Restrict [FORK]" (3.1.9 F) by Someone & Dr!fter
18 "Simple Chat Processor (Redux)" (1.1.5) by Simple Plugins, Mini
19 "Master Admin Change Team" (1.0+) by Masterofks
20 "[LR] Module - FakeRank" (v3.1) by RoadSide Romeo & Wend4r
21 "[VIP] Paint" (1.6) by asdf
22 "Admin all spec" (1.0.2) by Dr!fter
23 "Basic Info Triggers" (1.10.0.6502) by AlliedModders LLC
24 "Trail Display Settings" (1.2) by Zephyrus & Justkasi
25 "Anti-Flood" (1.10.0.6502) by AlliedModders LLC
26 "Sound Commands" (1.10.0.6502) by AlliedModders LLC
27 "Offline Ban list" (2.5.5) by Grey™ & R1KO
28 "[VIP] Keys" (1.0.2) by R1KO (skype: vova.andrienko1)
29 "[VIP] CustomWeapons" (1.1.0) by R1KO, vadrozh aka NaN
30 "[VIP] Spawn Effects" (1.2) by Mr.ToNik
31 "[VIP] Kill Screen" (1.0.2) by R1KO (skype: vova.andrienko1)
32 "[VIP] Gloves (Valve)" (2.0) by R1KO
33 "[VIP] Test" (1.0.3) by R1KO (skype: vova.andrienko1)
34 "[VIP] CHAT (+scp)" (3.1.1) by R1KO
35 "[VIP] Client Spawn Hook Fix" (1.0.1) by CrazyHackGUT aka Kruzya
36 "[VIP] Armor" (1.1) by R1KO (skype: vova.andrienko1)
37 "[VIP] Покупка оружия команды" (1.2.3) by Planes
38 "[VIP] COIN" (2.0.1) by Pheonix (˙·٠●Феникс●٠·˙) & R1KO, pracc
39 "[VIP] Core" (3.0.1 R) by R1KO
40 "[VIP] Trails" (1.2) by R1KO
41 "[VIP] Skins" (1.0.5) by R1KO (skype: vova.andrienko1)
42 <Failed> "VIP Users Test Period" (1.0.1) by GoDtm666
43 "Basic Chat" (1.10.0.6502) by AlliedModders LLC
44 "[CORE] SmokeColors" (1.0.2) by Tomiks(vk.com/tomiksofficial) | Credits: iLoco#7631 && vanz666
45 "[VIP] Colored Smoke" (1.0.1) by Tomiks(vk.com/tomiksofficial) | Credits: iLoco#7631
46 "[VIP] Defuser" (1.0.2) by R1KO, T1MOX4, vadrozh
47 "CS:GO Esl Admin ESP (mmcs.pro)" (2.9) by SAZONISCHE
48 "MapChooser" (1.7.3-dev+5217) by AlliedModders LLC
49 "Basic Votes" (1.10.0.6502) by AlliedModders LLC
50 "Advertisements" (0.6 CSGO-1.1) by Tsunami (CSGO FIX Феникс)
51 "CS:GO Admin ESP" (2.1) by Root
52 "Weapons & Knives" (1.7.1) by kgns | oyunhost.net
53 "[WarnSystem] Core" (1.4.3.2) by vadrozh, Rabb1t
54 "[Keys] VIP" (1.3) by R1KO
55 "[Keys] Core" (1.4) by R1KO
56 "Basic Ban Commands" (1.10.0.6502) by AlliedModders LLC
57 "VoteBKM" (1.0.6) by Drumanid
58 "[VIP] Dissolve Body" (1.2.2) by KOROVKA, R1KO
59 "Hook Grab Rope" (1.1.4) by Sheepdude, SumGuy14
60 "Chat logs/chat_logs/Логирования чата и Rcon" (2.1.1) by McFlurry (rewritten Nek.'a 2x2 | ggwp.site)
61 "Client Preferences" (1.10.0.6502) by AlliedModders LLC
62 "Map Nominations" (1.7.3-dev+5217) by AlliedModders LLC
63 "Admin Help" (1.10.0.6502) by AlliedModders LLC
64 "Admin all spec" (1.1) by Dr!fter, babka68
65 "[CS:GO] Weapon Stickers" (1.0.17) by quasemago and donut1k
66 "Reserved Slots" (1.10.0.6502) by AlliedModders LLC
67 <Error> "Material Admin" (0.8.2-fe87f4b) by Material Admin Dev Team
68 "Admin logs/Логирования действий админов" (1.3.7) by vIr-Dan (rewritten Nek.'a 2x2 | ggwp.site)
69 "[CS:GO] Spritetrail fix" (1.0.1) by FrozDark
70 "Fake VAC kick" (1.01) by Invex | Byte
71 "Basic Commands" (1.10.0.6502) by AlliedModders LLC
72 "AntiAfk" (2.1) by Drumanid
73 "Connect_info" (2.0) by R1KO
74 "SM Franug CS:GO Agents Chooser" (1.1.6) by Franc1sco franug & Romeo
75 "[Levels Ranks] Core" (v3.1.2) by RoadSide Romeo & Wend4r
76 "Admin File Reader" (1.10.0.6502) by AlliedModders LLC
77 <Failed> "[VIP] Иммунитет от ограничения оружия" (1.0.0) by Phoenix (˙·٠●Феникс●٠·˙)
78 "restart_1.smx"
79 "eItems" (0.10) by ESK0 (Original author: SM9)
80 "Nextmap" (1.10.0.6502) by AlliedModders LLC
81 "Basic Comm Control" (1.10.0.6502) by AlliedModders LLC
82 "[Admin Menu] VAC Kick (Refork)" (1.0.0 [PRIVATE]) by 1mpulse (skype:potapovdima1)
Список расширений SM
[01] Automatic Updater (1.10.0.6502): Updates SourceMod gamedata files
[02] Webternet (1.10.0.6502): Extension for interacting with URLs
[03] CSGO-ArmsFix (1.0): Fix glove overcap with custom arms
[04] CS Tools (1.10.0.6502): CS extended functionality
[05] BinTools (1.10.0.6502): Low-level C/C++ Calling API
[06] SDK Tools (1.10.0.6502): Source SDK Tools
[07] Top Menus (1.10.0.6502): Creates sorted nested menus
[08] SDK Hooks (1.10.0.6502): Source SDK Hooks
[09] SteamWorks Extension (1.2.3): Exposes SteamWorks functions to Developers
[10] TAU LIB (1.4):
[11] DHooks (2.2.0-detours9): Dynamic Hooks
[12] Client Preferences (1.10.0.6502): Saves client preference settings
[13] SQLite (1.10.0.6502): SQLite Driver
[14] Regex (1.10.0.6502): Provides regex natives for plugins
[15] SendProxy Manager (1.2): Change stuff without actually changing stuff!
[16] PTaH (1.1.3): Additional CS:GO Hooks and Natives
[17] <OPTIONAL> file "sourcescramble.ext.so": /var/servers/server3492/csgo/addons/sourcemod/extensions/sourcescramble.ext.so: cannot open shared object file: No such file or directory
[18] REST in Pawn (1.2.1): Provides HTTP and JSON natives for plugins
[19] MySQL-DBI (1.10.0.6502): MySQL driver implementation for DBI
Здравствуйте, сегодня хотел создать отдельный скин для человека (он приобрел этот скин) я хотел сделать так что бы все скины кроме одного были доступны випам, но что-то пошло не так при входе в меня после скина x_girl все серое (нельзя выбрать) как исправить эту проблему, я каждое наименование скина вписывал по одному, красным выбрал те что доступны, а зелёным те что не доступны.
 

Вложения

  • Screenshot_217.png
    Screenshot_217.png
    3.3 КБ · Просмотры: 46
Решение
В скинах есть такая хрень, как лимит на длину строки с доступными скинами. Я поступил так, что назвал все скины номерами от 10 или 100, не помню (если будет 10 и 100 в номерах, то 100 не заработает, т.к. одинаково, нужно выбрать одно)

MrQout

~[C0d3z]
Сообщения
314
Реакции
246
Скорее всего я думаю что связано с тем что у других випок этого нету а у этой есть. (Ну или же наоборот, я уже конкретно не помню)
У меня похожая проблема была но не к определенному игроку а при добавление скинов в другую випку. Попробуй поиграться со скинами в других випках, например добавить эти скины в випку(-и).
 

xek

Рыба клоун
Сообщения
1,652
Реакции
636
В скинах есть такая хрень, как лимит на длину строки с доступными скинами. Я поступил так, что назвал все скины номерами от 10 или 100, не помню (если будет 10 и 100 в номерах, то 100 не заработает, т.к. одинаково, нужно выбрать одно)
 
Решение

trekken

Участник
Сообщения
497
Реакции
182
В скинах есть такая хрень, как лимит на длину строки с доступными скинами. Я поступил так, что назвал все скины номерами от 10 или 100, не помню (если будет 10 и 100 в номерах, то 100 не заработает, т.к. одинаково, нужно выбрать одно)
то-есть мне например скин pura переименовать в 13 ?
 

trekken

Участник
Сообщения
497
Реакции
182
Да. Я переименовал все, названия все равно у человека в меню есть, и у тебя в файле, по мне разницы не сыграет.
Переименовал, от 1 до 30 и чёт теперь все закрыто))))
Сообщения автоматически склеены:

Вот как я переименовал
 

Вложения

  • Screenshot_218.png
    Screenshot_218.png
    18.5 КБ · Просмотры: 24

RusJJ

Доброе утро девачьки
Сообщения
2,582
Реакции
1,075
А не проще в VIP Skins просто буфер увеличить, а не плодить один и тот же предмет в базе данных и, если скины выданы вручную, потерять их?
 

SIRIUS

♿___DejaVu
Сообщения
509
Реакции
253
Не подскажешь как это сделать?)
В исходнике буфер больше сделать, позже скину, пока не дома
Сообщения автоматически склеены:

Не подскажешь как это сделать?)
Я по прежнему не дома, вроде как-то так, надеюсь скомпилить сможешь.
CSS:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <clientprefs>
#include <vip_core>
#include <cstrike>

public Plugin:myinfo =
{
    name = "[VIP] Skins",
    author = "R1KO (skype: vova.andrienko1)",
    version = "1.0.5",
    url = "hlmod.ru"
};

#define DEBUG_MODE 0

#if DEBUG_MODE
new String:g_sDebugLogFile[PLATFORM_MAX_PATH];
#endif

#if DEBUG_MODE
stock DebugMsg(const String:sMsg[], any:...)
{
    decl String:sBuffer[250];
    VFormat(sBuffer, sizeof(sBuffer), sMsg, 2);
    LogToFile(g_sDebugLogFile, sBuffer);
}
#define DebugMessage(%0) DebugMsg(%0);
#else
#define DebugMessage(%0)
#endif

new bool:g_bIsCSGO;

#define VIP_SKINS                "Skins"
#define VIP_SKINS_MENU        "Skins_Menu"

new Handle:        g_hKeyValues                    = INVALID_HANDLE,
    Handle:        g_hCookieSkin[2]    = {INVALID_HANDLE, ...},
    bool:        g_bClientPreview[MAXPLAYERS+1],
    String:        g_sSkinModel[MAXPLAYERS+1][PLATFORM_MAX_PATH],
    String:        g_sArmsModel[MAXPLAYERS+1][PLATFORM_MAX_PATH];

new m_szArmsModel = -1;

new const String:g_sTeamNames[][] =
{
    "ALL",
    "TEAM_T",
    "TEAM_CT"
};
   
public VIP_OnVIPLoaded()
{
    VIP_RegisterFeature(VIP_SKINS, STRING, _, OnToggleItem);
    VIP_RegisterFeature(VIP_SKINS_MENU, _, SELECTABLE, OnSelectItem, _, OnDrawItem);

    VIP_HookClientSpawn(OnPlayerSpawn);
}

public OnPluginStart()
{
    #if DEBUG_MODE  
    BuildPath(Path_SM, g_sDebugLogFile, sizeof(g_sDebugLogFile), "logs/VIP_Skins_Debug.log");
    #endif

    g_bIsCSGO = bool:(GetEngineVersion() == Engine_CSGO);
   
    g_hCookieSkin[0] = RegClientCookie("VIP_Skin_T", "VIP_Skin_T", CookieAccess_Public);
    g_hCookieSkin[1] = RegClientCookie("VIP_Skin_CT", "VIP_Skin_CT", CookieAccess_Public);
    /*
    RegConsoleCmd("sm_skins", SkinsMenu_CMD);
    RegConsoleCmd("sm_models", SkinsMenu_CMD);
    */
    HookEvent("player_team", Event_PlayerTeam);
    if(g_bIsCSGO)
    {
        m_szArmsModel = FindSendPropOffs("CCSPlayer", "m_szArmsModel");
        HookEvent("player_spawn", Event_PlayerSpawn);
    }

    LoadTranslations("vip_skins.phrases");
    LoadTranslations("vip_core.phrases");
    LoadTranslations("vip_modules.phrases");
}

public OnMapStart()
{
    if(g_hKeyValues != INVALID_HANDLE)
    {
        CloseHandle(g_hKeyValues);
    }

    g_hKeyValues = CreateKeyValues("Skins");
   
    decl String:sBuffer[PLATFORM_MAX_PATH];
    BuildPath(Path_SM, sBuffer, sizeof(sBuffer), "data/vip/modules/skins.txt");

    if (!FileToKeyValues(g_hKeyValues, sBuffer)) SetFailState("Couldn't parse file %s", sBuffer);
   
    KvRewind(g_hKeyValues);
    if(KvGotoFirstSubKey(g_hKeyValues))
    {
        do
        {
            KvSetNum(g_hKeyValues, "loaded", 0);
            KvSetNum(g_hKeyValues, "arms_loaded", 0);
        //    KvGetSectionName(g_hKeyValues, sBuffer, sizeof(sBuffer));
            KvGetString(g_hKeyValues, "model", sBuffer, sizeof(sBuffer));
            DebugMessage("Read model: '%s'", sBuffer)
            if(sBuffer[0] && LoadSkin(sBuffer, true))
            {
                if(g_bIsCSGO)
                {
                    KvGetString(g_hKeyValues, "arms_model", sBuffer, sizeof(sBuffer));
                    DebugMessage("Read arms_model: '%s'", sBuffer)
                    if(sBuffer[0] && LoadSkin(sBuffer, false))
                    {
                        KvSetNum(g_hKeyValues, "arms_loaded", 1);
                    }
                }
                KvSetNum(g_hKeyValues, "loaded", 1);
            }
        } while (KvGotoNextKey(g_hKeyValues));
    }
}

bool:LoadSkin(const String:sModel[], bool:bNecessarily)
{
    DebugMessage("LoadSkin %b: '%s' -> Exists: %b", bNecessarily, sModel, FileExists(sModel))
    if(FileExists(sModel, true))
    {
        PrecacheModel(sModel, true);
        if(IsModelPrecached(sModel))
        {
            AddFileToDownloadsTable(sModel);
            return true;
        }
        else
        {
            LogError("Model '%s' doesn't pass precache", sModel);
        }
    }
    else if(bNecessarily)
    {
        LogError("File '%s' does not exist", sModel);
    }
    return false;
}

public OnClientPutInServer(iClient)
{
    g_sSkinModel[iClient][0] = '\0';
    if(g_bIsCSGO)
    {
        g_sArmsModel[iClient][0] = '\0';
    }
}

public OnClientDisconnect(iClient)
{
    g_sSkinModel[iClient][0] = '\0';
    if(g_bIsCSGO)
    {
        g_sArmsModel[iClient][0] = '\0';
    }
}

public bool:OnSelectItem(iClient, const String:sFeatureName[])
{
    if(GetClientTeam(iClient) <= 1)
    {
        VIP_PrintToChatClient(iClient, "%t", "JOIN_TEAM");
        return true;
    }
    DisplayMenu(CreateSkinsMenu(iClient), iClient, MENU_TIME_FOREVER);
    return false;
}

public OnDrawItem(iClient, const String:sFeatureName[], iStyle)
{
    switch(VIP_GetClientFeatureStatus(iClient, VIP_SKINS))
    {
        case ENABLED: return ITEMDRAW_DEFAULT;
        case DISABLED: return ITEMDRAW_DISABLED;
        case NO_ACCESS: return ITEMDRAW_RAWLINE;
    }

    return iStyle;
}

Handle:CreateSkinsMenu(iClient)
{
    new Handle:hMenu = CreateMenu(SkinsMenu_Handler);
    SetMenuExitBackButton(hMenu, true);
    SetMenuTitle(hMenu, "%T\n \n", "SKINS", iClient);
   
    decl String:sClientSkins[128];
    FormatEx(sClientSkins, sizeof(sClientSkins), "%T\n \n", "DISABLE_SKIN", iClient);

    AddMenuItem(hMenu, "", sClientSkins);

    KvRewind(g_hKeyValues);
    if(KvGotoFirstSubKey(g_hKeyValues))
    {
        decl String:sBuffer[256], String:sName[128], bool:bAll, iSkinTeam, iTeam;
        VIP_GetClientFeatureString(iClient, VIP_SKINS, sClientSkins, sizeof(sClientSkins));
        bAll = StrEqual(sClientSkins, "all", false);
        iTeam = GetClientTeam(iClient);
        SetTrieValue(VIP_GetVIPClientTrie(iClient), "SkinTeam", iTeam);
        iTeam--;
        do
        {
            if(KvGetNum(g_hKeyValues, "loaded") == 0) continue;

            KvGetSectionName(g_hKeyValues, sBuffer, sizeof(sBuffer));

            KvGetString(g_hKeyValues, "team", sName, sizeof(sName));
            iSkinTeam = GetTeamFromString(sName);
            if(iSkinTeam == iTeam || iSkinTeam == 0)
            {
                KvGetString(g_hKeyValues, "name", sName, sizeof(sName), sBuffer);
                AddMenuItem(hMenu, sBuffer, sName, (bAll == false && StrContains(sClientSkins, sBuffer, false) == -1) ? ITEMDRAW_DISABLED:ITEMDRAW_DEFAULT);
            }
        } while (KvGotoNextKey(g_hKeyValues));
    }
   
    KvRewind(g_hKeyValues);
   
    if(GetMenuItemCount(hMenu) < 2)
    {
        FormatEx(sClientSkins, sizeof(sClientSkins), "%T", "NO_SKINS_AVAILABLE", iClient);
        AddMenuItem(hMenu, "", sClientSkins, ITEMDRAW_DISABLED);
    }

    return hMenu;
}

GetTeamFromString(const String:sBuffer[])
{
    switch(sBuffer[0])
    {
        case 'C', 'c':    return 2;
        case 'T', 't':    return 1;
        case 'A', 'a':    return 0;
        case '\0':        return -1;
    }
    return -1;
}

public SkinsMenu_Handler(Handle:hMenu, MenuAction:action, iClient, Item)
{
    switch(action)
    {
        case MenuAction_End:
        {
            CloseHandle(hMenu);
        }
        case MenuAction_Cancel:
        {
            if(Item == MenuCancel_ExitBack) VIP_SendClientVIPMenu(iClient);
        }
        case MenuAction_Select:
        {
            new iTeam = GetClientTeam(iClient), iSkinTeam;
            GetTrieValue(VIP_GetVIPClientTrie(iClient), "SkinTeam", iSkinTeam);
            if(iSkinTeam != 0 && iTeam != iSkinTeam)
            {
                VIP_PrintToChatClient(iClient, "%t", "ERROR");
                VIP_SendClientVIPMenu(iClient);
                return;
            }

            if(iTeam <= 1)
            {
                VIP_PrintToChatClient(iClient, "%t", "JOIN_TEAM");
                VIP_SendClientVIPMenu(iClient);
                return;
            }

            if(Item == 0)
            {
                g_sSkinModel[iClient][0] = '\0';
                if(g_bIsCSGO)
                {
                    g_sArmsModel[iClient][0] = '\0';
                }
                //SetClientDefSkin(iClient);
                CS_UpdateClientModel(iClient);
                VIP_SendClientVIPMenu(iClient);
                return;
            }
   
            decl String:sInfo[64];
            GetMenuItem(hMenu, Item, sInfo, sizeof(sInfo));

            DisplayMenu(CreateSkinInfoMenu(iClient, sInfo), iClient, MENU_TIME_FOREVER);
        }
    }
}

Handle:CreateSkinInfoMenu(iClient, const String:sKey[])
{
    new Handle:hMenu;
    KvRewind(g_hKeyValues);
    if(KvJumpToKey(g_hKeyValues, sKey, false))
    {
        hMenu = CreateMenu(SkinInfoMenu_Handler);
        SetMenuExitBackButton(hMenu, true);
        decl String:sName[64], iTeam;
        KvGetString(g_hKeyValues, "team", sName, sizeof(sName));
        iTeam = GetTeamFromString(sName);
        KvGetString(g_hKeyValues, "name", sName, sizeof(sName));
        SetMenuTitle(hMenu, "%T\n \n%T %s\n%T %T\n \n", "INFO", iClient, "NAME", iClient, sName, "TEAM", iClient, g_sTeamNames[iTeam], iClient);
       
        FormatEx(sName, sizeof(sName), "%T", g_bClientPreview[iClient] ? "DISABLE_PREVIEW":"ENABLE_PREVIEW", iClient);
        AddMenuItem(hMenu, sKey, sName, (GetClientTeam(iClient) > 1 && IsPlayerAlive(iClient)) ? ITEMDRAW_DEFAULT:ITEMDRAW_DISABLED);
       
        FormatEx(sName, sizeof(sName), "%T", "SET", iClient);
        AddMenuItem(hMenu, sKey, sName);
       
        AddMenuItem(hMenu, "", "", ITEMDRAW_NOTEXT);
        AddMenuItem(hMenu, "", "", ITEMDRAW_NOTEXT);
        AddMenuItem(hMenu, "", "", ITEMDRAW_NOTEXT);
        AddMenuItem(hMenu, "", "", ITEMDRAW_NOTEXT);
    }

    return hMenu;
}

public SkinInfoMenu_Handler(Handle:hMenu, MenuAction:action, iClient, Item)
{
    switch(action)
    {
        case MenuAction_End: CloseHandle(hMenu);
        case MenuAction_Cancel:
        {
            ClientPreview(iClient, _, false);
            if(Item == MenuCancel_ExitBack) DisplayMenu(CreateSkinsMenu(iClient), iClient, MENU_TIME_FOREVER);
        }
        case MenuAction_Select:
        {
            new iTeam = GetClientTeam(iClient), iSkinTeam;
            GetTrieValue(VIP_GetVIPClientTrie(iClient), "SkinTeam", iSkinTeam);
            if(iSkinTeam != 0 && iTeam != iSkinTeam)
            {
                VIP_PrintToChatClient(iClient, "%t", "ERROR");
                VIP_SendClientVIPMenu(iClient);
                return;
            }

            if(iTeam <= 1)
            {
                VIP_PrintToChatClient(iClient, "%t", "JOIN_TEAM");
                VIP_SendClientVIPMenu(iClient);
                return;
            }
   
            decl String:sInfo[64];
            GetMenuItem(hMenu, Item, sInfo, sizeof(sInfo));
            KvRewind(g_hKeyValues);
            if(KvJumpToKey(g_hKeyValues, sInfo, false))
            {
               
                switch(Item)
                {
                    case 0:
                    {
                        if(IsPlayerAlive(iClient))
                        {
                            if(g_bClientPreview[iClient])
                            {
                                ClientPreview(iClient, _, false);
                            }
                            else
                            {
                                decl String:sBuffer[PLATFORM_MAX_PATH];
                                KvGetString(g_hKeyValues, "model", sBuffer, sizeof(sBuffer));
                                ClientPreview(iClient, sBuffer, true);
                            }
                            DisplayMenu(CreateSkinInfoMenu(iClient, sInfo), iClient, MENU_TIME_FOREVER);
                        }
                        else
                        {
                            VIP_PrintToChatClient(iClient, "%t", "ERROR");
                            VIP_SendClientVIPMenu(iClient);
                        }
                       
                    }
                    case 1:
                    {
                        ClientPreview(iClient, _, false);
                        decl String:sName[64], String:sBuffer[64];
                        KvGetString(g_hKeyValues, "name", sName, sizeof(sName));
                        FormatEx(sBuffer, sizeof(sBuffer), "%T", g_sTeamNames[iTeam-1], iClient);
                        VIP_PrintToChatClient(iClient, "%t", "YOU_SET_SKIN", sName, sBuffer);
                        KvGetSectionName(g_hKeyValues, g_sSkinModel[iClient], sizeof(g_sSkinModel[]));
                        SetClientCookie(iClient, g_hCookieSkin[iTeam-2], g_sSkinModel[iClient]);
                        KvGetString(g_hKeyValues, "model", g_sSkinModel[iClient], sizeof(g_sSkinModel[]));
                        if(g_bIsCSGO && KvGetNum(g_hKeyValues, "arms_loaded") == 1)
                        {
                            KvGetString(g_hKeyValues, "arms_model", g_sArmsModel[iClient], sizeof(g_sArmsModel[]));
                        }

                        if(IsPlayerAlive(iClient))
                        {
                            SetClientVIPSkin(iClient);
                            SetClientVIPArms(iClient);
                        }

                        VIP_SendClientVIPMenu(iClient);
                    }
                }
            }  

           
        }
    }
}

ClientPreview(iClient, const String:sModel[] = "", bool:bEnabled = true)
{
    g_bClientPreview[iClient] = bEnabled;
    //static String:sOriginalModel[MAXPLAYERS+1][PLATFORM_MAX_PATH];
    if(IsClientInGame(iClient))
    {
        if (g_bClientPreview[iClient])
        {
            //GetClientModel(iClient, sOriginalModel[iClient], sizeof(sOriginalModel[]));
            SetEntityModel(iClient, sModel);
            SetEntPropEnt(iClient, Prop_Send, "m_hObserverTarget", 0);
            SetEntProp(iClient, Prop_Send, "m_iObserverMode", 1);
            SetEntProp(iClient, Prop_Send, "m_bDrawViewmodel", false);
            SetEntProp(iClient, Prop_Send, "m_iFOV", 120);
        } else
        {
            //PrecacheModel(sOriginalModel[iClient]);
            //SetEntityModel(iClient, sOriginalModel[iClient]);
            CS_UpdateClientModel(iClient);
            SetEntPropEnt(iClient, Prop_Send, "m_hObserverTarget", -1);
            SetEntProp(iClient, Prop_Send, "m_iObserverMode", 0);
            SetEntProp(iClient, Prop_Send, "m_bDrawViewmodel", true);
            SetEntProp(iClient, Prop_Send, "m_iFOV", 90);
        }
    }
}

public Event_PlayerTeam(Handle:hEvent, const String:name[], bool:dontBroadcast)
{
    new iClient = GetClientOfUserId(GetEventInt(hEvent, "userid"));
    if(g_bClientPreview[iClient])
    {
        ClientPreview(iClient, _, false);
    }
    if(iClient && VIP_IsClientVIP(iClient) && VIP_GetClientFeatureStatus(iClient, VIP_SKINS) != NO_ACCESS)
    {
        new iTeam = GetEventInt(hEvent, "team");
        if (iTeam > 1 && iTeam != GetEventInt(hEvent, "oldteam"))
        {
            GetClientCookie(iClient, g_hCookieSkin[iTeam-2], g_sSkinModel[iClient], sizeof(g_sSkinModel[]));
            KvRewind(g_hKeyValues);
            if(KvJumpToKey(g_hKeyValues, g_sSkinModel[iClient], false))
            {
                if(KvGetNum(g_hKeyValues, "loaded") == 1)
                {
                    decl String:sTeam[10], iSkinTeam;
                    KvGetString(g_hKeyValues, "team", sTeam, sizeof(sTeam));
                    iSkinTeam = GetTeamFromString(sTeam);
                    if(iSkinTeam == 0 || iSkinTeam == iTeam-1)
                    {
                        KvGetString(g_hKeyValues, "model", g_sSkinModel[iClient], sizeof(g_sSkinModel[]));
                        if(g_bIsCSGO && KvGetNum(g_hKeyValues, "arms_loaded") == 1)
                        {
                            KvGetString(g_hKeyValues, "arms_model", g_sArmsModel[iClient], sizeof(g_sArmsModel[]));
                        }
                        return;
                    }
                }
            }

            g_sSkinModel[iClient][0] = '\0';
            if(g_bIsCSGO)
            {
                g_sArmsModel[iClient][0] = '\0';
            }
        }
    }
}

public OnPlayerSpawn(iClient, iTeam, bool:bIsVIP)
{
    if(g_bIsCSGO == false && bIsVIP && VIP_IsClientFeatureUse(iClient, VIP_SKINS)) SetClientVIPSkin(iClient);
}

public Event_PlayerSpawn(Handle:hEvent, const String:name[], bool:dontBroadcast)
{
    new iClient = GetClientOfUserId(GetEventInt(hEvent, "userid"));
    if(VIP_IsClientVIP(iClient) && VIP_IsClientFeatureUse(iClient, VIP_SKINS) && IsPlayerAlive(iClient))
    {
        SetClientVIPSkin(iClient);
        SetClientVIPArms(iClient);
    }
}

SetClientVIPSkin(iClient)
{
    if(g_sSkinModel[iClient][0] != '\0')
    {
        SetEntityModel(iClient, g_sSkinModel[iClient]);
    }
}

SetClientVIPArms(iClient)
{
    if(g_sArmsModel[iClient][0] != '\0')
    {
        SetEntDataString(iClient, m_szArmsModel, g_sArmsModel[iClient], sizeof(g_sArmsModel[]));
    }
}

public Action:OnToggleItem(iClient, const String:sFeatureName[], VIP_ToggleState:OldStatus, &VIP_ToggleState:NewStatus)
{
    if(NewStatus == ENABLED)
    {
        if(GetClientTeam(iClient) > 1 && IsPlayerAlive(iClient))
        {
            SetClientVIPSkin(iClient);
            SetClientVIPArms(iClient);
        }
    }
    else
    {
        if(IsPlayerAlive(iClient)) CS_UpdateClientModel(iClient);
        //SetClientDefSkin(iClient);
    }

    return Plugin_Continue;
}#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <clientprefs>
#include <vip_core>
#include <cstrike>

public Plugin:myinfo =
{
    name = "[VIP] Skins",
    author = "R1KO (skype: vova.andrienko1)",
    version = "1.0.5",
    url = "hlmod.ru"
};

#define DEBUG_MODE 0

#if DEBUG_MODE
new String:g_sDebugLogFile[PLATFORM_MAX_PATH];
#endif

#if DEBUG_MODE
stock DebugMsg(const String:sMsg[], any:...)
{
    decl String:sBuffer[250];
    VFormat(sBuffer, sizeof(sBuffer), sMsg, 2);
    LogToFile(g_sDebugLogFile, sBuffer);
}
#define DebugMessage(%0) DebugMsg(%0);
#else
#define DebugMessage(%0)
#endif

new bool:g_bIsCSGO;

#define VIP_SKINS                "Skins"
#define VIP_SKINS_MENU        "Skins_Menu"

new Handle:        g_hKeyValues                    = INVALID_HANDLE,
    Handle:        g_hCookieSkin[2]    = {INVALID_HANDLE, ...},
    bool:        g_bClientPreview[MAXPLAYERS+1],
    String:        g_sSkinModel[MAXPLAYERS+1][PLATFORM_MAX_PATH],
    String:        g_sArmsModel[MAXPLAYERS+1][PLATFORM_MAX_PATH];

new m_szArmsModel = -1;

new const String:g_sTeamNames[][] =
{
    "ALL",
    "TEAM_T",
    "TEAM_CT"
};
   
public VIP_OnVIPLoaded()
{
    VIP_RegisterFeature(VIP_SKINS, STRING, _, OnToggleItem);
    VIP_RegisterFeature(VIP_SKINS_MENU, _, SELECTABLE, OnSelectItem, _, OnDrawItem);

    VIP_HookClientSpawn(OnPlayerSpawn);
}

public OnPluginStart()
{
    #if DEBUG_MODE  
    BuildPath(Path_SM, g_sDebugLogFile, sizeof(g_sDebugLogFile), "logs/VIP_Skins_Debug.log");
    #endif

    g_bIsCSGO = bool:(GetEngineVersion() == Engine_CSGO);
   
    g_hCookieSkin[0] = RegClientCookie("VIP_Skin_T", "VIP_Skin_T", CookieAccess_Public);
    g_hCookieSkin[1] = RegClientCookie("VIP_Skin_CT", "VIP_Skin_CT", CookieAccess_Public);
    /*
    RegConsoleCmd("sm_skins", SkinsMenu_CMD);
    RegConsoleCmd("sm_models", SkinsMenu_CMD);
    */
    HookEvent("player_team", Event_PlayerTeam);
    if(g_bIsCSGO)
    {
        m_szArmsModel = FindSendPropOffs("CCSPlayer", "m_szArmsModel");
        HookEvent("player_spawn", Event_PlayerSpawn);
    }

    LoadTranslations("vip_skins.phrases");
    LoadTranslations("vip_core.phrases");
    LoadTranslations("vip_modules.phrases");
}

public OnMapStart()
{
    if(g_hKeyValues != INVALID_HANDLE)
    {
        CloseHandle(g_hKeyValues);
    }

    g_hKeyValues = CreateKeyValues("Skins");
   
    decl String:sBuffer[PLATFORM_MAX_PATH];
    BuildPath(Path_SM, sBuffer, sizeof(sBuffer), "data/vip/modules/skins.txt");

    if (!FileToKeyValues(g_hKeyValues, sBuffer)) SetFailState("Couldn't parse file %s", sBuffer);
   
    KvRewind(g_hKeyValues);
    if(KvGotoFirstSubKey(g_hKeyValues))
    {
        do
        {
            KvSetNum(g_hKeyValues, "loaded", 0);
            KvSetNum(g_hKeyValues, "arms_loaded", 0);
        //    KvGetSectionName(g_hKeyValues, sBuffer, sizeof(sBuffer));
            KvGetString(g_hKeyValues, "model", sBuffer, sizeof(sBuffer));
            DebugMessage("Read model: '%s'", sBuffer)
            if(sBuffer[0] && LoadSkin(sBuffer, true))
            {
                if(g_bIsCSGO)
                {
                    KvGetString(g_hKeyValues, "arms_model", sBuffer, sizeof(sBuffer));
                    DebugMessage("Read arms_model: '%s'", sBuffer)
                    if(sBuffer[0] && LoadSkin(sBuffer, false))
                    {
                        KvSetNum(g_hKeyValues, "arms_loaded", 1);
                    }
                }
                KvSetNum(g_hKeyValues, "loaded", 1);
            }
        } while (KvGotoNextKey(g_hKeyValues));
    }
}

bool:LoadSkin(const String:sModel[], bool:bNecessarily)
{
    DebugMessage("LoadSkin %b: '%s' -> Exists: %b", bNecessarily, sModel, FileExists(sModel))
    if(FileExists(sModel, true))
    {
        PrecacheModel(sModel, true);
        if(IsModelPrecached(sModel))
        {
            AddFileToDownloadsTable(sModel);
            return true;
        }
        else
        {
            LogError("Model '%s' doesn't pass precache", sModel);
        }
    }
    else if(bNecessarily)
    {
        LogError("File '%s' does not exist", sModel);
    }
    return false;
}

public OnClientPutInServer(iClient)
{
    g_sSkinModel[iClient][0] = '\0';
    if(g_bIsCSGO)
    {
        g_sArmsModel[iClient][0] = '\0';
    }
}

public OnClientDisconnect(iClient)
{
    g_sSkinModel[iClient][0] = '\0';
    if(g_bIsCSGO)
    {
        g_sArmsModel[iClient][0] = '\0';
    }
}

public bool:OnSelectItem(iClient, const String:sFeatureName[])
{
    if(GetClientTeam(iClient) <= 1)
    {
        VIP_PrintToChatClient(iClient, "%t", "JOIN_TEAM");
        return true;
    }
    DisplayMenu(CreateSkinsMenu(iClient), iClient, MENU_TIME_FOREVER);
    return false;
}

public OnDrawItem(iClient, const String:sFeatureName[], iStyle)
{
    switch(VIP_GetClientFeatureStatus(iClient, VIP_SKINS))
    {
        case ENABLED: return ITEMDRAW_DEFAULT;
        case DISABLED: return ITEMDRAW_DISABLED;
        case NO_ACCESS: return ITEMDRAW_RAWLINE;
    }

    return iStyle;
}

Handle:CreateSkinsMenu(iClient)
{
    new Handle:hMenu = CreateMenu(SkinsMenu_Handler);
    SetMenuExitBackButton(hMenu, true);
    SetMenuTitle(hMenu, "%T\n \n", "SKINS", iClient);
   
    decl String:sClientSkins[128];
    FormatEx(sClientSkins, sizeof(sClientSkins), "%T\n \n", "DISABLE_SKIN", iClient);

    AddMenuItem(hMenu, "", sClientSkins);

    KvRewind(g_hKeyValues);
    if(KvGotoFirstSubKey(g_hKeyValues))
    {
        decl String:sBuffer[256], String:sName[128], bool:bAll, iSkinTeam, iTeam;
        VIP_GetClientFeatureString(iClient, VIP_SKINS, sClientSkins, sizeof(sClientSkins));
        bAll = StrEqual(sClientSkins, "all", false);
        iTeam = GetClientTeam(iClient);
        SetTrieValue(VIP_GetVIPClientTrie(iClient), "SkinTeam", iTeam);
        iTeam--;
        do
        {
            if(KvGetNum(g_hKeyValues, "loaded") == 0) continue;

            KvGetSectionName(g_hKeyValues, sBuffer, sizeof(sBuffer));

            KvGetString(g_hKeyValues, "team", sName, sizeof(sName));
            iSkinTeam = GetTeamFromString(sName);
            if(iSkinTeam == iTeam || iSkinTeam == 0)
            {
                KvGetString(g_hKeyValues, "name", sName, sizeof(sName), sBuffer);
                AddMenuItem(hMenu, sBuffer, sName, (bAll == false && StrContains(sClientSkins, sBuffer, false) == -1) ? ITEMDRAW_DISABLED:ITEMDRAW_DEFAULT);
            }
        } while (KvGotoNextKey(g_hKeyValues));
    }
   
    KvRewind(g_hKeyValues);
   
    if(GetMenuItemCount(hMenu) < 2)
    {
        FormatEx(sClientSkins, sizeof(sClientSkins), "%T", "NO_SKINS_AVAILABLE", iClient);
        AddMenuItem(hMenu, "", sClientSkins, ITEMDRAW_DISABLED);
    }

    return hMenu;
}

GetTeamFromString(const String:sBuffer[])
{
    switch(sBuffer[0])
    {
        case 'C', 'c':    return 2;
        case 'T', 't':    return 1;
        case 'A', 'a':    return 0;
        case '\0':        return -1;
    }
    return -1;
}

public SkinsMenu_Handler(Handle:hMenu, MenuAction:action, iClient, Item)
{
    switch(action)
    {
        case MenuAction_End:
        {
            CloseHandle(hMenu);
        }
        case MenuAction_Cancel:
        {
            if(Item == MenuCancel_ExitBack) VIP_SendClientVIPMenu(iClient);
        }
        case MenuAction_Select:
        {
            new iTeam = GetClientTeam(iClient), iSkinTeam;
            GetTrieValue(VIP_GetVIPClientTrie(iClient), "SkinTeam", iSkinTeam);
            if(iSkinTeam != 0 && iTeam != iSkinTeam)
            {
                VIP_PrintToChatClient(iClient, "%t", "ERROR");
                VIP_SendClientVIPMenu(iClient);
                return;
            }

            if(iTeam <= 1)
            {
                VIP_PrintToChatClient(iClient, "%t", "JOIN_TEAM");
                VIP_SendClientVIPMenu(iClient);
                return;
            }

            if(Item == 0)
            {
                g_sSkinModel[iClient][0] = '\0';
                if(g_bIsCSGO)
                {
                    g_sArmsModel[iClient][0] = '\0';
                }
                //SetClientDefSkin(iClient);
                CS_UpdateClientModel(iClient);
                VIP_SendClientVIPMenu(iClient);
                return;
            }
   
            decl String:sInfo[64];
            GetMenuItem(hMenu, Item, sInfo, sizeof(sInfo));

            DisplayMenu(CreateSkinInfoMenu(iClient, sInfo), iClient, MENU_TIME_FOREVER);
        }
    }
}

Handle:CreateSkinInfoMenu(iClient, const String:sKey[])
{
    new Handle:hMenu;
    KvRewind(g_hKeyValues);
    if(KvJumpToKey(g_hKeyValues, sKey, false))
    {
        hMenu = CreateMenu(SkinInfoMenu_Handler);
        SetMenuExitBackButton(hMenu, true);
        decl String:sName[64], iTeam;
        KvGetString(g_hKeyValues, "team", sName, sizeof(sName));
        iTeam = GetTeamFromString(sName);
        KvGetString(g_hKeyValues, "name", sName, sizeof(sName));
        SetMenuTitle(hMenu, "%T\n \n%T %s\n%T %T\n \n", "INFO", iClient, "NAME", iClient, sName, "TEAM", iClient, g_sTeamNames[iTeam], iClient);
       
        FormatEx(sName, sizeof(sName), "%T", g_bClientPreview[iClient] ? "DISABLE_PREVIEW":"ENABLE_PREVIEW", iClient);
        AddMenuItem(hMenu, sKey, sName, (GetClientTeam(iClient) > 1 && IsPlayerAlive(iClient)) ? ITEMDRAW_DEFAULT:ITEMDRAW_DISABLED);
       
        FormatEx(sName, sizeof(sName), "%T", "SET", iClient);
        AddMenuItem(hMenu, sKey, sName);
       
        AddMenuItem(hMenu, "", "", ITEMDRAW_NOTEXT);
        AddMenuItem(hMenu, "", "", ITEMDRAW_NOTEXT);
        AddMenuItem(hMenu, "", "", ITEMDRAW_NOTEXT);
        AddMenuItem(hMenu, "", "", ITEMDRAW_NOTEXT);
    }

    return hMenu;
}

public SkinInfoMenu_Handler(Handle:hMenu, MenuAction:action, iClient, Item)
{
    switch(action)
    {
        case MenuAction_End: CloseHandle(hMenu);
        case MenuAction_Cancel:
        {
            ClientPreview(iClient, _, false);
            if(Item == MenuCancel_ExitBack) DisplayMenu(CreateSkinsMenu(iClient), iClient, MENU_TIME_FOREVER);
        }
        case MenuAction_Select:
        {
            new iTeam = GetClientTeam(iClient), iSkinTeam;
            GetTrieValue(VIP_GetVIPClientTrie(iClient), "SkinTeam", iSkinTeam);
            if(iSkinTeam != 0 && iTeam != iSkinTeam)
            {
                VIP_PrintToChatClient(iClient, "%t", "ERROR");
                VIP_SendClientVIPMenu(iClient);
                return;
            }

            if(iTeam <= 1)
            {
                VIP_PrintToChatClient(iClient, "%t", "JOIN_TEAM");
                VIP_SendClientVIPMenu(iClient);
                return;
            }
   
            decl String:sInfo[64];
            GetMenuItem(hMenu, Item, sInfo, sizeof(sInfo));
            KvRewind(g_hKeyValues);
            if(KvJumpToKey(g_hKeyValues, sInfo, false))
            {
               
                switch(Item)
                {
                    case 0:
                    {
                        if(IsPlayerAlive(iClient))
                        {
                            if(g_bClientPreview[iClient])
                            {
                                ClientPreview(iClient, _, false);
                            }
                            else
                            {
                                decl String:sBuffer[PLATFORM_MAX_PATH];
                                KvGetString(g_hKeyValues, "model", sBuffer, sizeof(sBuffer));
                                ClientPreview(iClient, sBuffer, true);
                            }
                            DisplayMenu(CreateSkinInfoMenu(iClient, sInfo), iClient, MENU_TIME_FOREVER);
                        }
                        else
                        {
                            VIP_PrintToChatClient(iClient, "%t", "ERROR");
                            VIP_SendClientVIPMenu(iClient);
                        }
                       
                    }
                    case 1:
                    {
                        ClientPreview(iClient, _, false);
                        decl String:sName[64], String:sBuffer[64];
                        KvGetString(g_hKeyValues, "name", sName, sizeof(sName));
                        FormatEx(sBuffer, sizeof(sBuffer), "%T", g_sTeamNames[iTeam-1], iClient);
                        VIP_PrintToChatClient(iClient, "%t", "YOU_SET_SKIN", sName, sBuffer);
                        KvGetSectionName(g_hKeyValues, g_sSkinModel[iClient], sizeof(g_sSkinModel[]));
                        SetClientCookie(iClient, g_hCookieSkin[iTeam-2], g_sSkinModel[iClient]);
                        KvGetString(g_hKeyValues, "model", g_sSkinModel[iClient], sizeof(g_sSkinModel[]));
                        if(g_bIsCSGO && KvGetNum(g_hKeyValues, "arms_loaded") == 1)
                        {
                            KvGetString(g_hKeyValues, "arms_model", g_sArmsModel[iClient], sizeof(g_sArmsModel[]));
                        }

                        if(IsPlayerAlive(iClient))
                        {
                            SetClientVIPSkin(iClient);
                            SetClientVIPArms(iClient);
                        }

                        VIP_SendClientVIPMenu(iClient);
                    }
                }
            }  

           
        }
    }
}

ClientPreview(iClient, const String:sModel[] = "", bool:bEnabled = true)
{
    g_bClientPreview[iClient] = bEnabled;
    //static String:sOriginalModel[MAXPLAYERS+1][PLATFORM_MAX_PATH];
    if(IsClientInGame(iClient))
    {
        if (g_bClientPreview[iClient])
        {
            //GetClientModel(iClient, sOriginalModel[iClient], sizeof(sOriginalModel[]));
            SetEntityModel(iClient, sModel);
            SetEntPropEnt(iClient, Prop_Send, "m_hObserverTarget", 0);
            SetEntProp(iClient, Prop_Send, "m_iObserverMode", 1);
            SetEntProp(iClient, Prop_Send, "m_bDrawViewmodel", false);
            SetEntProp(iClient, Prop_Send, "m_iFOV", 120);
        } else
        {
            //PrecacheModel(sOriginalModel[iClient]);
            //SetEntityModel(iClient, sOriginalModel[iClient]);
            CS_UpdateClientModel(iClient);
            SetEntPropEnt(iClient, Prop_Send, "m_hObserverTarget", -1);
            SetEntProp(iClient, Prop_Send, "m_iObserverMode", 0);
            SetEntProp(iClient, Prop_Send, "m_bDrawViewmodel", true);
            SetEntProp(iClient, Prop_Send, "m_iFOV", 90);
        }
    }
}

public Event_PlayerTeam(Handle:hEvent, const String:name[], bool:dontBroadcast)
{
    new iClient = GetClientOfUserId(GetEventInt(hEvent, "userid"));
    if(g_bClientPreview[iClient])
    {
        ClientPreview(iClient, _, false);
    }
    if(iClient && VIP_IsClientVIP(iClient) && VIP_GetClientFeatureStatus(iClient, VIP_SKINS) != NO_ACCESS)
    {
        new iTeam = GetEventInt(hEvent, "team");
        if (iTeam > 1 && iTeam != GetEventInt(hEvent, "oldteam"))
        {
            GetClientCookie(iClient, g_hCookieSkin[iTeam-2], g_sSkinModel[iClient], sizeof(g_sSkinModel[]));
            KvRewind(g_hKeyValues);
            if(KvJumpToKey(g_hKeyValues, g_sSkinModel[iClient], false))
            {
                if(KvGetNum(g_hKeyValues, "loaded") == 1)
                {
                    decl String:sTeam[10], iSkinTeam;
                    KvGetString(g_hKeyValues, "team", sTeam, sizeof(sTeam));
                    iSkinTeam = GetTeamFromString(sTeam);
                    if(iSkinTeam == 0 || iSkinTeam == iTeam-1)
                    {
                        KvGetString(g_hKeyValues, "model", g_sSkinModel[iClient], sizeof(g_sSkinModel[]));
                        if(g_bIsCSGO && KvGetNum(g_hKeyValues, "arms_loaded") == 1)
                        {
                            KvGetString(g_hKeyValues, "arms_model", g_sArmsModel[iClient], sizeof(g_sArmsModel[]));
                        }
                        return;
                    }
                }
            }

            g_sSkinModel[iClient][0] = '\0';
            if(g_bIsCSGO)
            {
                g_sArmsModel[iClient][0] = '\0';
            }
        }
    }
}

public OnPlayerSpawn(iClient, iTeam, bool:bIsVIP)
{
    if(g_bIsCSGO == false && bIsVIP && VIP_IsClientFeatureUse(iClient, VIP_SKINS)) SetClientVIPSkin(iClient);
}

public Event_PlayerSpawn(Handle:hEvent, const String:name[], bool:dontBroadcast)
{
    new iClient = GetClientOfUserId(GetEventInt(hEvent, "userid"));
    if(VIP_IsClientVIP(iClient) && VIP_IsClientFeatureUse(iClient, VIP_SKINS) && IsPlayerAlive(iClient))
    {
        SetClientVIPSkin(iClient);
        SetClientVIPArms(iClient);
    }
}

SetClientVIPSkin(iClient)
{
    if(g_sSkinModel[iClient][0] != '\0')
    {
        SetEntityModel(iClient, g_sSkinModel[iClient]);
    }
}

SetClientVIPArms(iClient)
{
    if(g_sArmsModel[iClient][0] != '\0')
    {
        SetEntDataString(iClient, m_szArmsModel, g_sArmsModel[iClient], sizeof(g_sArmsModel[]));
    }
}

public Action:OnToggleItem(iClient, const String:sFeatureName[], VIP_ToggleState:OldStatus, &VIP_ToggleState:NewStatus)
{
    if(NewStatus == ENABLED)
    {
        if(GetClientTeam(iClient) > 1 && IsPlayerAlive(iClient))
        {
            SetClientVIPSkin(iClient);
            SetClientVIPArms(iClient);
        }
    }
    else
    {
        if(IsPlayerAlive(iClient)) CS_UpdateClientModel(iClient);
        //SetClientDefSkin(iClient);
    }

    return Plugin_Continue;
}
 
Последнее редактирование:
Статус
В этой теме нельзя размещать новые ответы.
Сверху Снизу