Hello, could someone guide me? My outfit system is based on the fact that if you are male you will get only the male outfit, and not like in quests that you get both. How could I do to give the female outfit in the sex change? I understand that there is no function in tfs like if player:hasoutfit, thanks in advance.
I already saw that if the function "hasoutfit" exists, how gross I am. Well anyway, could someone help me with the code for that, give the female outfit if you have the male outfit?
Lua:
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
-- Adding outfits
local outfit = player:getOutfit()
if player:getSex() == PLAYERSEX_FEMALE then
outfit.looktype = 128
else
outfit.looktype = 136
end
if player:getId() ~= player:getId() then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have changed "..player:getName().."('s) sex.")
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have changed your sex.")
end
player:setOutfit(outfit)
player:setSex(player:getSex() == PLAYERSEX_FEMALE and PLAYERSEX_MALE or PLAYERSEX_FEMALE)
player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
item:remove(1)
return true
end
Post automatically merged:
I already saw that if the function "hasoutfit" exists, how gross I am. Well anyway, could someone help me with the code for that, give the female outfit if you have the male outfit?