• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua TFS 1.2: Item give outfit. It disappears when player relogging.

cryptomeepo

Member
Joined
Aug 11, 2021
Messages
61
Solutions
4
Reaction score
14
I'm using a simple use item give outfit script:

Lua:
local config = {
    storage = 535923,
    effect = CONST_ME_FIREWORK_RED,
    text1 = "You have gained your new outfit!",
    text2 = "You already have this outfit!",
    looktype = 255
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(config.storage) < 1 then
        player:addOutfit(config.looktype)
        player:sendTextMessage(MESSAGE_INFO_DESCR, config.text1)
        player:setStorageValue(config.storage, 1)
        player:getPosition():sendMagicEffect(config.effect)
        item:remove()
    else
        player:sendTextMessage(MESSAGE_INFO_DESCR, config.text2)
    end
    return true
end

Working fine but outfit disappears when player re-log.
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<outfits>
    <!-- Female outfits -->
    <outfit type="0" looktype="136" name="Citizen" premium="no" unlocked="yes" enabled="yes" />
    <outfit type="0" looktype="137" name="Hunter" premium="no" unlocked="yes" enabled="yes" />
    <outfit type="0" looktype="138" name="Mage" premium="no" unlocked="yes" enabled="yes" />
    <outfit type="0" looktype="139" name="Knight" premium="no" unlocked="yes" enabled="yes" />
    <outfit type="0" looktype="140" name="Noblewoman" premium="yes" unlocked="yes" enabled="yes" />
    <outfit type="0" looktype="141" name="Summoner" premium="yes" unlocked="yes" enabled="yes" />
    <outfit type="0" looktype="142" name="Warrior" premium="yes" unlocked="yes" enabled="yes" />
   
    <!-- Male outfits -->
    <outfit type="1" looktype="128" name="Citizen" premium="no" unlocked="yes" enabled="yes" />
    <outfit type="1" looktype="129" name="Hunter" premium="no" unlocked="yes" enabled="yes" />
    <outfit type="1" looktype="130" name="Mage" premium="no" unlocked="yes" enabled="yes" />
    <outfit type="1" looktype="131" name="Knight" premium="no" unlocked="yes" enabled="yes" />
    <outfit type="1" looktype="132" name="Nobleman" premium="yes" unlocked="yes" enabled="yes" />
    <outfit type="1" looktype="133" name="Summoner" premium="yes" unlocked="yes" enabled="yes" />
    <outfit type="1" looktype="134" name="Warrior" premium="yes" unlocked="yes" enabled="yes" />
    <outfit type="1" looktype="255" name="Dragon Scale Set" premium="no" unlocked="no" enabled="yes" />
</outfits>

Anyone can help me?
 
Idk how it worked at tfs 1.2 ( never used it just tfs 1.3 ) but did u try player:save()

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:getStorageValue(config.storage) < 1 then
player:addOutfit(config.looktype)
player:sendTextMessage(MESSAGE_INFO_DESCR, config.text1)
player:setStorageValue(config.storage, 1)
player:getPosition():sendMagicEffect(config.effect)
item:remove()
player:save()
else
player:sendTextMessage(MESSAGE_INFO_DESCR, config.text2)
end
return true
end
Like that?
Still the same.
 
Thank you thou @Levi999x .
I will wait to see if someone knows what is happening.
Only thing I can think of, is that you are using a female character when unlocking the outfit?
And when you relog, it realises that it's a male outfit..?

Otherwise, everything looks fine.
 
Thats not it. I'm using male character. :(

I'm using nostalrius and I just added the outfit/addon system on my server/otc. Maybe this is related to the bug?
 
Ull have to look at your sorces to check how does that function works, maybe it needs more parameters.
 
Solution
Back
Top