Skip to content

Can you convert this Shop Core plugin to Zephyrus Store? i want to add buy vip core to this shop #154

Open
@umbr1X

Description

@umbr1X

#include
#include
#include <vip_core>

#define PLUGIN_AUTHOR "Pr[E]fix | vk.com/cyxaruk1337"
#define PLUGIN_NAME "[Shop] Buy ViP"
#define PLUGIN_VERSION "2.0"
#define PLUGIN_DESCRIPTION "Возможность добавить покупку vip за кредиты в shop"

KeyValues kv;

public Plugin:myinfo =
{
name = PLUGIN_NAME,
author = PLUGIN_AUTHOR,
description = PLUGIN_DESCRIPTION,
version = PLUGIN_VERSION,
url = "hlmod.ru/members/pr-e-fix.110719"
};

public void OnPluginStart()
{
if (Shop_IsStarted())
Shop_Started();
}

public void OnPluginEnd()
{
Shop_UnregisterMe();
}

public void Shop_Started()
{
CategoryId category = Shop_RegisterCategory("vip", "Покупка VIP", "");

if(kv)
    delete kv;
kv = new KeyValues("Shop_Vip");

char path[PLATFORM_MAX_PATH];
BuildPath(Path_SM, path, PLATFORM_MAX_PATH, "configs/shop/shop_vip.ini");

if (!kv.ImportFromFile(path) || !kv.GotoFirstSubKey()) SetFailState("(%s) is not found", path);

char buffer[64];

do 
{
    kv.GetString("vip_group", buffer, sizeof(buffer));

    if (VIP_IsValidVIPGroup(buffer))
    {
        kv.GetSectionName(buffer, sizeof(buffer))

        if(Shop_StartItem(category, buffer))
        {
            kv.GetString("name", buffer, sizeof(buffer));
            Shop_SetLuckChance(kv.GetNum("luckchance", 10));
            if(buffer[0])
            {
                Shop_SetInfo(buffer, "", kv.GetNum("price"), -1, Item_BuyOnly);
                Shop_SetCallbacks(_, _, _, _, _, _, CallBack_Shop_OnBuy);
                Shop_EndItem();
            }
        }
    }
}
while (kv.GotoNextKey());

}

public bool CallBack_Shop_OnBuy(int client, CategoryId category_id, const char[] category, ItemId item_id, const char[] item, ItemType type, int price, int sell_price, int value)
{
if (VIP_IsClientVIP(client))
{
PrintToChat(client, "У вас уже имеется VIP Статус");
return false;
}
else
{
char buff[64];
kv.Rewind();
if(kv.JumpToKey(item))
{
kv.GetString("vip_group", buff, sizeof(buff));
VIP_GiveClientVIP(_, client, kv.GetNum("duration"), buff);
}
}

return true;

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions