Pifafa
Active Member
- Joined
- Nov 9, 2010
- Messages
- 100
- Reaction score
- 39
Hello friends, I come today to ask everyone for help, when trying to use looktype, they simply turn others wrong, I can't understand the cause of the problem at all.

example, when trying to use the command for a /looktype 297 instead of turning what is in 297 will I turn into a lion?

There seems to be a limitation so that I can put these clothes into the game, I want the person to use x item and get x outfit, in fact token just for him to transform into that for some time.
I'm going to leave my GM looktype script and the script I made as an action.
ADM:
Player action:

example, when trying to use the command for a /looktype 297 instead of turning what is in 297 will I turn into a lion?

There seems to be a limitation so that I can put these clothes into the game, I want the person to use x item and get x outfit, in fact token just for him to transform into that for some time.
I'm going to leave my GM looktype script and the script I made as an action.
ADM:
LUA:
function onSay(player, words, param)
-- Verifica se o jogador é um administrador
if player:getGroup():getAccess() then
local lookType = tonumber(param)
if lookType and lookType >= 0 then
local playerOutfit = player:getOutfit()
playerOutfit.lookType = lookType
player:setOutfit(playerOutfit)
else
player:sendCancelMessage("Invalid look type.")
end
else
-- Caso o jogador não seja admin, verifica a lista de lookTypes permitidos
local lookType = tonumber(param)
if (lookType >= 0 and lookType ~= 1 and lookType ~= 135 and lookType ~= 411 and lookType ~= 415 and lookType ~= 424
and (lookType <= 160 or lookType >= 192) and lookType ~= 439 and lookType ~= 440 and lookType ~= 468 and lookType ~= 469
and (lookType < 474 or lookType > 485) and lookType ~= 501 and lookType ~= 518 and lookType ~= 519 and lookType ~= 520
and lookType ~= 524 and lookType ~= 525 and lookType ~= 536 and lookType ~= 543 and lookType ~= 549 and lookType ~= 576
and lookType ~= 581 and lookType ~= 582 and lookType ~= 597 and lookType ~= 616 and lookType ~= 623 and lookType ~= 625
and (lookType <= 637 or lookType >= 644) and (lookType <= 644 or lookType >= 647) and (lookType <= 651 or lookType >= 664)
and lookType <= 699) or (lookType >= 161 and lookType <= 193) then
local playerOutfit = player:getOutfit()
playerOutfit.lookType = lookType
player:setOutfit(playerOutfit)
else
player:sendCancelMessage("A look type with that id does not exist.")
end
end
return false
end
Player action:
LUA:
-- Item Script for Outfit Changer
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local maleOutfitID = 513 -- Outfit ID para sexo masculino
local femaleOutfitID = 184 -- Outfit ID para sexo feminino
local universalOutfitID = 513 -- Outfit ID universal para ambos os sexos
-- Define a lista de opções possíveis de outfits
local outfitOptions = {maleOutfitID, femaleOutfitID, universalOutfitID}
-- Escolhe um outfit aleatoriamente
local randomIndex = math.random(#outfitOptions)
local selectedOutfitID = outfitOptions[randomIndex]
-- Verifica o sexo do jogador para aplicar a lógica correta
local outfitID
if selectedOutfitID == maleOutfitID or selectedOutfitID == femaleOutfitID then
outfitID = player:getSex() == PLAYERSEX_MALE and maleOutfitID or femaleOutfitID
else
outfitID = universalOutfitID
end
-- Aplica o outfit ao jogador
local playerOutfit = player:getOutfit()
playerOutfit.lookType = outfitID
player:setOutfit(playerOutfit)
-- Adiciona efeito visual e mensagem
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
player:sendTextMessage(MESSAGE_INFO_DESCR, "Your outfit has been randomly changed!")
-- Remove 1 unidade do item após o uso
item:remove(1)
return true
end