⁉️como usar ( exemplos )

Acompanhe abaixo as nossas exports juntamente com exemplos de funcionamento e as instruções precisas para realizar a exportação de forma correta.

Exemplos de utilização: ( aplicar roupa )

addCommandHandler( 'setclothe', function( player, cmd, bodyPart, clotheType, textureType, shared, margeFace )
     if not bodyPart and not clotheType and not textureType then
          return print( 'digite /'..cmd..' + bodyPart + clotheType + textureType' )
     end
     local custom = exports['[HS]Custom_Clothes']
     local clothes = custom:getClothesPlayer( player )
     if not clothes then
          print( 'Você não possui registro, dê reconnect.' )
         return
     end
     local gender = custom:getPlayerGender( player )
     custom:setClothesPlayer( player, getElementsByType( 'player' ), {
          bodyPart = bodyPart,
          clotheType = clotheType,
          textureType = tonumber( textureType ),
          shared = shared,
          margeFace = margeFace,
          gender = gender
     } )
     print( 'Roupa '..clotheType..' aplicada com sucesso.' )
end)

Observação: para remover a peça de roupa, altere apenas o argumento textureType para 0.

Useitem para inventário:

O exemplo abaixo foi desenvolvido no inventário (v1) da Hyper Scripts, mas a lógica pode ser aplicada da mesma forma em qualquer outro sistema de inventário.

Config do item ( Hyper_G.lua ):

['tenis1'] = {item = 'tenis1', category = 'clothes', kg = 0.1, bodyPart = 'shoes', clotheType = 'hyper.sapato1', textureType = 1, shared = true, wasted = false, drop = false, send = false};

Useitem ( use_item.lua ):

     elseif category == 'clothes' then
          local custom = exports['[HS]Custom_Clothes']
          local gender = custom:getPlayerGender( player )
          custom:setClothesPlayer( player, getElementsByType( 'player' ), {
               bodyPart = item_config.bodyPart,
               clotheType = item_config.clotheType,
               textureType = tonumber( item_config.textureType ),
               shared = item_config.shared,
               gender = gender
          } )
          closeInventory( player )
          exports['[HS]Assets']:outputMessage( player, 'Você aplicou a textura '..item_config.clotheType..' com sucesso.', 'success')

Last updated