Кто может переделать модуль attributes для shop core

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

Иннова

Участник
Сообщения
226
Реакции
24
Кто может переделать модуль attributes с store by zephyrus в shop core
C-подобный:
#if defined STANDALONE_BUILD
#include <sourcemod>
#include <sdktools>

#include <store>
#include <zephstocks>
#endif

#if defined STANDALONE_BUILD
public OnPluginStart()
#else
public Attributes_OnPluginStart()
#endif
{
    HookEvent("player_spawn", Attributes_PlayerSpawn);
}

public Action:Attributes_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new client = GetClientOfUserId(GetEventInt(event, "userid"));

    if(!client || !IsClientInGame(client) || !IsPlayerAlive(client))
        return Plugin_Continue;

    // Reset client
    SetEntityGravity(client, 1.0);

    new idx = -1;
    new item_idx = -1;
    new item[Store_Item];
    decl String:m_szValue[16];
    while((item_idx=Store_IterateEquippedItems(client, idx, true))!=-1)
    {
        Store_GetItem(item_idx, item);

        if(GetTrieString(item[hAttributes], "health", STRING(m_szValue)))
        {
            SetEntityHealth(client, GetClientHealth(client)+StringToInt(m_szValue));
        }

        if(GetTrieString(item[hAttributes], "gravity", STRING(m_szValue)))
        {
            SetEntityGravity(client, StringToFloat(m_szValue));
        }

        if(GetTrieString(item[hAttributes], "armor", STRING(m_szValue)))
        {
            SetEntProp(client, Prop_Send, "m_ArmorValue", GetEntProp(client, Prop_Send, "m_ArmorValue")+StringToInt(m_szValue));
        }
    }

    return Plugin_Continue;
}
 

White Wolf

🍉
Сообщения
2,382
Реакции
2,187
  • Команда форума
  • #2
@Иннова, вот сниппет кода, как определить активные предметы, типа ItemType_Togglable
[hide=200]
PHP:
#include <shop>

ArrayList gItems;

public void OnPluginStart()
{  
   RegConsoleCmd("sm_gettoggleditems", Command_GetToggledItems, "Show your toggled on items in shop.");
   if (Shop_IsStarted()) Shop_Started();
}

public void Shop_Started()
{
   Shop_FillArrayByItems(gItems);
}

public Action Command_GetToggledItems(int client, int args)
{
   if (client && IsClientInGame(client) && Shop_IsAuthorized(client))
   {
       ArrayList toggledItems = new ArrayList(1);
       for (int i = 0; i < gItems.Length; ++i)
       {
           ItemId id = Shop_GetArrayItem(gItems, i);
           if (id != INVALID_ITEM)
           {
               if (Shop_IsClientHasItem(client, id))
               {
                   if (Shop_IsClientItemToggled(client, id))
                   {
                       toggledItems.Push(id);
                   }
               }
           }
       }
      
       /* Array with toggled items */
       char cName[24];
       for (int i = 0; i < toggledItems.Length; ++i)
       {
           ItemId id = Shop_GetArrayItem(toggledItems, i);
           Shop_GetItemById(id, cName, sizeof(cName));
                  
           PrintToConsole(client, "Item %s toggled", cName);
       }
      
       delete toggledItems;
   }
  
   return Plugin_Handled;
}
[/hide]
 
Последнее редактирование:

Иннова

Участник
Сообщения
226
Реакции
24
@White Wolf, я не очень понял как мне это поможет ?? мне надо чтобы можно было прописать на пример к шапкам дополнительное хп например +5 к 100 хп
 
Статус
В этой теме нельзя размещать новые ответы.
Сверху Снизу