PL/getClothesByTypeIndex

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Ta funkcja pozwala na pobranie tekstury i modelu ciuchu na podstawie typu i indeksu (skanuje listę ubrań w poszukiwaniu wybranego ubrania)

Składnia

string string getClothesByTypeIndex ( int clothesType, int clothesIndex )

Wymagane argumenty

  • clothesType: Liczba całkowita reprezentująca typ/slot ubrań do znalezienia.
Clothing Types
  • 0: SHIRT
  • 1: HEAD
  • 2: TROUSERS
  • 3: SHOES
  • 4: TATTOOS_LEFT_UPPER_ARM
  • 5: TATTOOS_LEFT_LOWER_ARM
  • 6: TATTOOS_RIGHT_UPPER_ARM
  • 7: TATTOOS_RIGHT_LOWER_ARM
  • 8: TATTOOS_BACK
  • 9: TATTOOS_LEFT_CHEST
  • 10: TATTOOS_RIGHT_CHEST
  • 11: TATTOOS_STOMACH
  • 12: TATTOOS_LOWER_BACK
  • 13: NECKLACE
  • 14: WATCH
  • 15: GLASSES
  • 16: HAT
  • 17: EXTRA
  • clothesIndex: Liczba całkowita reprezentująca indeks ubrań w liście które chcesz przetworzyć. Każdy rodzaj ma inny prawidłowy numer indeksu.

Wartości zwrotne

Funkcja zwraca dwa ciągi znaków, teksturę i model, lub false w przypadku niepowodzenia.

Przykład

Funkcja pobiera ubrania tego samego typu co te które aktualnie ma założone gracz, a następnie zmienia na następne na liście.

function scriptNextClothes ( thePlayer, key, clothesType )
  local currentTexture, currentModel = getPedClothes ( thePlayer, clothesType ) -- pobieramy ubrania na wybranym slocie
  local clothesIndex = -1
  if ( currentTexture ) then -- jeśli ma ubrania tego typu
    local tempA, tempB = getTypeIndexFromClothes ( currentTexture, currentModel ) -- pobieramy ich indeks i typ, będziemy mogli użyć tych wartości do ustawienia następnych ubrań z listy
    if ( tempA and tempB ) then -- jeśli je znajdziemy
      clothesType, clothesIndex = tempA, tempB
    end
  end
  clothesIndex = clothesIndex + 1
  local texture, model = getClothesByTypeIndex ( clothesType, clothesIndex ) -- pobierzmy nową teksturę i model
  if ( texture == false ) then -- jeśli osiągneliśmy koniec listy
    removePedClothes ( thePlayer, clothesType )
  else addPedClothes ( thePlayer, texture, model, clothesType )
  end
end
addCommandHandler ( "nextClothes", scriptNextClothes )

Zobacz także