shop_ped_apparel.meta

INFO

Registra i vestiti nei negozi di GTA V. Senza questo file, i capi esistono nel gioco ma non sono acquistabili in nessun negozio.

ObiettivoDettagli
Cosa imparerai• Struttura completa del file shop_ped_apparel.meta
• Come registrare vestiti, cappelli, pantaloni e scarpe nei negozi
• Prezzi, stock e restrizioni di sesso
• Collegamento con pedvariation.meta e fxmanifest
Prerequisiti• Aver registrato i drawable in pedvariation.meta
• Conoscenza base di XML
• Una risorsa FiveM configurata

A Cosa Serve

shop_ped_apparel.meta dice al gioco:

  • Quali capi d’abbigliamento sono disponibili nei negozi
  • In quali categorie di negozio appaiono (sportivo, lavoro, etc.)
  • Quanto costano e quanti ne sono in magazzino
  • Quali restrizioni si applicano (sesso, ped specifico)

Senza questo file, i vestiti sono accessibili solo via script (SetPedComponentVariation).


Struttura XML Completa

<?xml version="1.0" encoding="UTF-8"?>
<CShopPedApparel>
    <Shops>
        <!-- NEGOZIO PRINCIPALE -->
        <Item>
            <ShopName>clothes</ShopName>
            <Categories>
                <Item>
                    <Category>CAT_SPORT</Category>
                    <Items>
                        <Item>
                            <ComponentData>
                                <ComponentType>3</ComponentType>
                                <ComponentId>3</ComponentId>
                                <DrawableIndex>0</DrawableIndex>
                                <TextureIndex>0</TextureIndex>
                            </ComponentData>
                            <Price>200</Price>
                            <Stock>999</Stock>
                            <PlayerRestriction>MALE</PlayerRestriction>
                            <LocTranslate>MAGLIETTA_SPORT_01</LocTranslate>
                        </Item>
                    </Items>
                </Item>
            </Categories>
        </Item>
    </Shops>
</CShopPedApparel>

Nodo Principale: Shops

Contiene uno o più negozi. Ogni negozio ha un ShopName che corrisponde all’interno del gioco.

ShopNameNegozio
clothesNegozio di vestiti normale (Binco, SubUrban)
accessoriesAccessori (maschere, cappelli)
watchesOrologi
jewelryGioielli

Categories

Ogni categoria raggruppa capi simili. Le categorie più comuni:

CategoriaDescrizione
CAT_SPORTAbbigliamento sportivo
CAT_WORKAbbigliamento da lavoro
CAT_OUTDOORAbbigliamento outdoor
CAT_FORMALAbbigliamento formale
CAT_CASUALAbbigliamento casual
CAT_SHOESScarpe
CAT_HATSCappelli
CAT_GLASSESOcchiali
CAT_WATCHESOrologi
CAT_ACCESSORIESAccessori vari
CAT_BAGSBorse e zaini
CAT_JEANSJeans
CAT_SHIRTSCamicie
CAT_T_SHIRTSMagliette
CAT_JACKETSGiacche
CAT_SHORTSShorts
CAT_SWIMWEARCostumi da bagno
CAT_UNDERWEARIntimo
CAT_MISCAltro

Nota: Le categorie disponibili dipendono dal negozio. Un orologio non può stare in CAT_HATS.


Item

Ogni capo nel negozio ha questi campi:

CampoObbligatorioDescrizione
ComponentData✅Riferimento al componente/accessorio
Price✅Prezzo in $
Stock❌Quantità in magazzino (default: infinite)
PlayerRestriction❌MALE, FEMALE o ometti per entrambi
LocTranslate❌Chiave per traduzione nome

ComponentData

Per componenti del corpo (vestiti):

<ComponentData>
    <ComponentType>3</ComponentType>  <!-- Sempre 3 per vestiti -->
    <ComponentId>3</ComponentId>      <!-- ID componente (0-11) -->
    <DrawableIndex>0</DrawableIndex>  <!-- Quale drawable -->
    <TextureIndex>0</TextureIndex>    <!-- Quale texture -->
</ComponentData>

Per props (accessori):

<ComponentData>
    <ComponentType>0</ComponentType>  <!-- Sempre 0 per props -->
    <ComponentId>0</ComponentId>      <!-- ID prop (0-6) -->
    <DrawableIndex>0</DrawableIndex>  <!-- Quale prop -->
    <TextureIndex>0</TextureIndex>    <!-- Quale texture -->
</ComponentData>
ComponentTypeTipo
3Componente del corpo (vestito)
0Prop / Accessorio

Price, Stock, PlayerRestriction

Price

Prezzo in dollari del gioco. Qualsiasi intero positivo:

<Price>500</Price>     <!-- 500$ -->
<Price>0</Price>       <!-- Gratis -->
<Price>10000</Price>   <!-- Costoso -->

Stock

Quantità disponibile. Quando arriva a 0, il capo non è più acquistabile (fino al reset del negozio):

<Stock>999</Stock>     <!-- Quasi infinito -->
<Stock>1</Stock>       <!-- Pezzo unico -->
<Stock>-1</Stock>      <!-- Infinito (default se omesso) -->

PlayerRestriction

Limita il capo a un sesso specifico:

ValoreEffetto
MALESolo personaggi maschili
FEMALESolo personaggi femminili
(omesso)Entrambi

Collegamento a Pedvariation.meta

Il ComponentData in shop_ped_apparel.meta deve corrispondere esattamente a un drawable definito in pedvariation.meta.

pedvariation.meta definisce:

  • Che drawables e textures esistono per un ped

shop_ped_apparel.meta definisce:

  • Quali di quei drawables sono acquistabili in negozio

Esempio di corrispondenza

In pedvariation.meta:

<!-- Torso: Component 3 -->
<Item>
    <ComponentId>3</ComponentId>
    <Drawable>
        <DrawableIndex>0</DrawableIndex>  <!-- Maglietta basic -->
        <TextureIndex>0</TextureIndex>    <!-- Bianca -->
        <TextureIndex>1</TextureIndex>    <!-- Nera -->
    </Drawable>
</Item>

In shop_ped_apparel.meta (stesso drawable, stessa texture):

<Item>
    <ComponentData>
        <ComponentType>3</ComponentType>
        <ComponentId>3</ComponentId>
        <DrawableIndex>0</DrawableIndex>
        <TextureIndex>0</TextureIndex>
    </ComponentData>
    <Price>200</Price>
</Item>

Se il drawable o texture non esiste in pedvariation.meta, il gioco ignora l’item — senza crash ma senza apparire.


Esempio Completo: Aggiungere una Maglietta

1. In pedvariation.meta

Registra il nuovo drawable:

<Item>
    <ComponentId>3</ComponentId>
    <Drawable>
        <DrawableIndex>5</DrawableIndex>
        <TextureIndex>0</TextureIndex>
        <TextureIndex>1</TextureIndex>
    </Drawable>
</Item>

2. In shop_ped_apparel.meta

Aggiungi al negozio:

<Item>
    <ComponentData>
        <ComponentType>3</ComponentType>
        <ComponentId>3</ComponentId>
        <DrawableIndex>5</DrawableIndex>
        <TextureIndex>0</TextureIndex>
    </ComponentData>
    <Price>350</Price>
    <Stock>999</Stock>
    <PlayerRestriction>MALE</PlayerRestriction>
    <LocTranslate>TSHIRT_CUSTOM_01</LocTranslate>
</Item>

Risultato: maglietta acquistabile a 350$, solo maschile, con scorta illimitata, nella categoria sportiva.


Esempio Cappelli, Pantaloni, Scarpe

Cappello (Prop 0)

<Category>CAT_HATS</Category>
<Item>
    <ComponentData>
        <ComponentType>0</ComponentType>
        <ComponentId>0</ComponentId>      <!-- PropID 0 = cappelli -->
        <DrawableIndex>2</DrawableIndex>
        <TextureIndex>0</TextureIndex>
    </ComponentData>
    <Price>150</Price>
    <Stock>999</Stock>
</Item>

Pantaloni (Component 4)

<Category>CAT_JEANS</Category>
<Item>
    <ComponentData>
        <ComponentType>3</ComponentType>
        <ComponentId>4</ComponentId>      <!-- Gambe -->
        <DrawableIndex>0</DrawableIndex>
        <TextureIndex>1</TextureIndex>
    </ComponentData>
    <Price>400</Price>
    <Stock>999</Stock>
</Item>

Scarpe (Component 6)

<Category>CAT_SHOES</Category>
<Item>
    <ComponentData>
        <ComponentType>3</ComponentType>
        <ComponentId>6</ComponentId>      <!-- Scarpe -->
        <DrawableIndex>1</DrawableIndex>
        <TextureIndex>0</TextureIndex>
    </ComponentData>
    <Price>250</Price>
    <Stock>999</Stock>
</Item>

Occhiali (Prop 1)

<Category>CAT_GLASSES</Category>
<Item>
    <ComponentData>
        <ComponentType>0</ComponentType>
        <ComponentId>1</ComponentId>      <!-- PropID 1 = occhiali -->
        <DrawableIndex>3</DrawableIndex>
        <TextureIndex>0</TextureIndex>
    </ComponentData>
    <Price>500</Price>
    <Stock>999</Stock>
</Item>

Più Categorie, Stesso Categoria

Puoi avere più Item nello stesso Category:

<Categories>
    <Item>
        <Category>CAT_T_SHIRTS</Category>
        <Items>
            <Item>
                <ComponentData>
                    <ComponentType>3</ComponentType>
                    <ComponentId>3</ComponentId>
                    <DrawableIndex>0</DrawableIndex>
                    <TextureIndex>0</TextureIndex>
                </ComponentData>
                <Price>200</Price>
            </Item>
            <Item>
                <ComponentData>
                    <ComponentType>3</ComponentType>
                    <ComponentId>3</ComponentId>
                    <DrawableIndex>0</DrawableIndex>
                    <TextureIndex>1</TextureIndex>
                </ComponentData>
                <Price>200</Price>
            </Item>
        </Items>
    </Item>
</Categories>

Più Negozi (componentOverrides)

Puoi creare più negozi con ShopName diversi. Per esempio, un negozio separato per accessori:

<Shops>
    <!-- Negozio vestiti -->
    <Item>
        <ShopName>clothes</ShopName>
        <Categories>
            <Item>
                <Category>CAT_SPORT</Category>
                <Items>
                    <!-- ... capi sportivi ... -->
                </Items>
            </Item>
        </Categories>
    </Item>
 
    <!-- Negozio cappelli separato -->
    <Item>
        <ShopName>accessories</ShopName>
        <Categories>
            <Item>
                <Category>CAT_HATS</Category>
                <Items>
                    <!-- ... cappelli ... -->
                </Items>
            </Item>
        </Categories>
    </Item>
</Shops>

Usare un Negozio Personalizzato

Alcuni server aggiungono shop personalizzati. Il nome del negozio corrisponde alla definizione in shops.ymt. I nomi più comuni:

ShopNameTipo
clothesNegozio vestiti normale
accessoriesAccessori
watchesOrologi
jewelryGioielli
masksMaschere

loc_translations

Per dare nomi leggibili ai capi, usa LocTranslate nel shop_ped_apparel.meta. Poi definisci la traduzione in un file di localizzazione.

In shop_ped_apparel.meta

<Item>
    <ComponentData>
        <ComponentType>3</ComponentType>
        <ComponentId>3</ComponentId>
        <DrawableIndex>0</DrawableIndex>
        <TextureIndex>0</TextureIndex>
    </ComponentData>
    <Price>200</Price>
    <LocTranslate>TSHIRT_CUSTOM_01</LocTranslate>
</Item>

In un file translation (.gxt2 o nel __resource.lua)

-- gxt2 keys
AddTextEntry('TSHIRT_CUSTOM_01', 'Maglietta Personalizzata Bianca')
AddTextEntry('PANTS_CUSTOM_01', 'Jeans Personalizzati Blu')

LocTranslate non è obbligatoria: se omessa, il gioco mostra il nome generico del componente.


fxmanifest

fx_version 'cerulean'
game 'gta5'
 
data_file 'SHOP_PED_APPAREL_METAFILE' 'shop_ped_apparel.meta'
 
-- Il file deve stare nella root della risorsa, non in stream/

Il file shop_ped_apparel.meta va nella root della risorsa (non in stream/), a differenza di pedvariation.meta che va dentro stream/.

Se lo metti in stream/, non verrà letto e i capi non appariranno in negozio.


Errori Comuni

ErroreCausaSoluzione
Il capo non appare in negoziodata_file sbagliato o file in stream/Metti il file nella root e usa SHOP_PED_APPAREL_METAFILE
Il capo appare ma è invisibileDrawableIndex non esiste in pedvariation.metaControlla che il drawable sia registrato per quel ped
”Out of stock” subitoStock non impostato o male configuratoMetti Stock>999</Stock>
Capo non acquistabile per il personaggioPlayerRestriction sbagliatoControlla MALE/FEMALE o ometti per entrambi
Categoria vuota nel negozioCategory inesistente o errataUsa una categoria valida (es. CAT_SPORT, non CAT_SPORTS)
Doppioni in vetrinaStesso ComponentData in due ItemsOgni DrawableIndex+TextureIndex deve essere unico per negozio
Nomi in inglese bruttiLocTranslate non impostatoAggiungi LocTranslate + AddTextEntry

┌─────────────────────────────┐
│  pedvariation.meta (stream/)│ ← Definisce i drawable disponibili
│  DrawableIndex 0, 1, 2...   │
└──────────────┬──────────────┘
               │ corrispondenza
               ▼
┌─────────────────────────────┐
│ shop_ped_apparel.meta (root)│ ← Rende i drawable acquistabili
│ Price, Stock, Category      │
│ PlayerRestriction, LocTrans │
└─────────────────────────────┘

Prossimo passo: Torna all’Indice Generale