• 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 [SQLite] -=[TFS]=- 0.4 8.60 Use 'x' item the gain outfit newtype 253 It is 255

if you're working with TFS 0.4, the syntax could be different compared to newer versions. You can use isPlayer(cid) to check if the cid belongs to a player. Here's how the modified use_item.lua script would look:

Lua:
-- use_item.lua


function onUse(cid, item, fromPosition, itemEx, toPosition)
    if not isPlayer(cid) then
        return true
    end
    
    -- Check if player has completed quest with ID 19537
    local questStatus = getPlayerStorageValue(cid, 19537)
    if questStatus == -1 then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You have not completed the required quest.")
        return true
    end
    
    -- Change outfit
    local newOutfit = {lookType = 253, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0}
    doCreatureChangeOutfit(cid, newOutfit)
    
    -- Remove the used item
    doRemoveItem(item.uid, 1)
    
    -- Send message
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You've changed into a VIP outfit.")
    
    return true
end
 
XML:
</outfit>
<outfit id="25" quest="19537">
<list gender="0" lookType="253" name="VIP"/>
<list gender="1" lookType="255" name="VIP"/>
</outfit>
</outfits>



Actions.
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local sto = 19537
local outname = "VIP"

if getPlayerStorageValue(cid, sto) >= 1 then
    doPlayerSendCancel(cid, "Voce ja tem esta outfit!!")
    return true
elseif getPlayerStorageValue(cid, sto) <= 0 then
    setPlayerStorageValue(cid, sto, 1)
    doPlayerSendCancel(cid, "Voce acaba de obter a outfit ".. outname .."!")
    doRemoveItem(item.uid, 1)
    return true
end
end
 
ACTION.LUA:

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local sto = 19537 ---       <<< NUMERO DA STORAGE QUE VC COLOCOU NO OUTFITS.XML
local outname = "VIP" ---  <<< COLOQUE O NOME DA OUTFIT ALI

if getPlayerStorageValue(cid, sto) >= 1 then
    doPlayerSendCancel(cid, "Voce ja tem esta outfit!!")
    return true
elseif getPlayerStorageValue(cid, sto) <= 0 then
    setPlayerStorageValue(cid, sto, 1)
    doPlayerSendCancel(cid, "Voce acaba de obter a outfit ".. outname .."!")
    doRemoveItem(item.uid, 1)
    return true
end
end

VOCATION.XML QUEST"= NO FUNCTION I USE STORAGE

Lua:
  <outfit id="25" storage="19537" premium="yes">
             <list gender="0" lookType="253" name="VIP"/>
        </outfit>
             <outfit id="26" storage="19537" premium="yes">
             <list gender="0" lookType="255" name="VIP"/>
        </outfit>
</outfits>

@claws2012

How do I add 2 outfit newtype 253 and 255
Lua:
-- use_item.lua


function onUse(cid, item, fromPosition, itemEx, toPosition)
    if not isPlayer(cid) then
        return true
    end
    
    -- Check if player has completed quest with ID 19537
    local questStatus = getPlayerStorageValue(cid, 19537)
    if questStatus == -1 then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You have not completed the required quest.")
        return true
    end
    
    -- Change outfit
    local newOutfit = {lookType = 253, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0}
    doCreatureChangeOutfit(cid, newOutfit)
    
    -- Remove the used item
    doRemoveItem(item.uid, 1)
    
    -- Send message
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You've changed into a VIP outfit.")
    
    return true
end
 
Last edited:
Here's an example modification:

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if not isPlayer(cid) then
        return true
    end
    
    -- Check if player has completed quest with ID 19537
    local questStatus = getPlayerStorageValue(cid, 19537)
    if questStatus == -1 then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You have not completed the required quest.")
        return true
    end
    
    local newOutfit
    
    -- Condition to check the item used for outfit change
    if item.itemid == SOME_ITEM_ID_FOR_253 then
        newOutfit = {lookType = 253, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0}
    elseif item.itemid == SOME_ITEM_ID_FOR_255 then
        newOutfit = {lookType = 255, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0}
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "Invalid item.")
        return true
    end


    -- Change outfit
    doCreatureChangeOutfit(cid, newOutfit)
    
    -- Remove the used item
    doRemoveItem(item.uid, 1)
    
    -- Send message
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You've changed into a VIP outfit.")
    
    return true
end
 
no functon I use this when I put 2 vip debug addon I have this one when I use 2 debug plugins when I use all plugins released


Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local sto = 19537  ---       <<< NUMERO DA STORAGE QUE VC COLOCOU NO OUTFITS.XML
local outname = "[VIP]" ---  <<< COLOQUE O NOME DA OUTFIT ALI

if getPlayerStorageValue(cid, sto) >= 1 then
    doPlayerSendCancel(cid, "Voce ja tem esta outfit!!")
    return true
elseif getPlayerStorageValue(cid, sto) <= 0 then
    setPlayerStorageValue(cid, sto, 1)
    doPlayerSendCancel(cid, "Voce acaba de obter a outfit ".. outname .."!")
    doRemoveItem(item.uid, 1)
    return true
end
end

and

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local sto = 19537  ---       <<< NUMERO DA STORAGE QUE VC COLOCOU NO OUTFITS.XML
local outname = "[VIP-2]" ---  <<< COLOQUE O NOME DA OUTFIT ALI

if getPlayerStorageValue(cid, sto) >= 1 then
    doPlayerSendCancel(cid, "Voce ja tem esta outfit!!")
    return true
elseif getPlayerStorageValue(cid, sto) <= 0 then
    setPlayerStorageValue(cid, sto, 1)
    doPlayerSendCancel(cid, "Voce acaba de obter a outfit ".. outname .."!")
    doRemoveItem(item.uid, 1)
    return true
end
end

Outfit .XML

XML:
<outfit id="25"  quest="19537" premium="yes">
             <list gender="0" lookType="253" name="[VIP]"/>
             <list gender="1" lookType="253" name="[VIP]"/>
              </outfit>
<outfit id="26"  quest="19537" premium="yes">
             <list gender="0" lookType="255" name="[VIP-2]"/>
             <list gender="1" lookType="255" name="[VIP-2]"/>
        </outfit>
</outfits>
 
Here's an example with separate storage numbers:

For the first outfit:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local sto = 19537  -- Storage for the first outfit
    local outname = "[VIP]" -- Name of the first outfit


    if getPlayerStorageValue(cid, sto) >= 1 then
        doPlayerSendCancel(cid, "Voce ja tem esta outfit!!")
        return true
    elseif getPlayerStorageValue(cid, sto) <= 0 then
        setPlayerStorageValue(cid, sto, 1)
        doPlayerSendCancel(cid, "Voce acaba de obter a outfit " .. outname .. "!")
        doRemoveItem(item.uid, 1)
        return true
    end
end

For the second outfit:

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local sto = 19538  -- Storage for the second outfit
    local outname = "[VIP-2]" -- Name of the second outfit


    if getPlayerStorageValue(cid, sto) >= 1 then
        doPlayerSendCancel(cid, "Voce ja tem esta outfit!!")
        return true
    elseif getPlayerStorageValue(cid, sto) <= 0 then
        setPlayerStorageValue(cid, sto, 1)
        doPlayerSendCancel(cid, "Voce acaba de obter a outfit " .. outname .. "!")
        doRemoveItem(item.uid, 1)
        return true
    end
end

Try it then tell me good are they not?
no functon I use this when I put 2 vip debug addon I have this one when I use 2 debug plugins when I use all plugins released


Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local sto = 19537  ---       <<< NUMERO DA STORAGE QUE VC COLOCOU NO OUTFITS.XML
local outname = "[VIP]" ---  <<< COLOQUE O NOME DA OUTFIT ALI

if getPlayerStorageValue(cid, sto) >= 1 then
    doPlayerSendCancel(cid, "Voce ja tem esta outfit!!")
    return true
elseif getPlayerStorageValue(cid, sto) <= 0 then
    setPlayerStorageValue(cid, sto, 1)
    doPlayerSendCancel(cid, "Voce acaba de obter a outfit ".. outname .."!")
    doRemoveItem(item.uid, 1)
    return true
end
end

and

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local sto = 19537  ---       <<< NUMERO DA STORAGE QUE VC COLOCOU NO OUTFITS.XML
local outname = "[VIP-2]" ---  <<< COLOQUE O NOME DA OUTFIT ALI

if getPlayerStorageValue(cid, sto) >= 1 then
    doPlayerSendCancel(cid, "Voce ja tem esta outfit!!")
    return true
elseif getPlayerStorageValue(cid, sto) <= 0 then
    setPlayerStorageValue(cid, sto, 1)
    doPlayerSendCancel(cid, "Voce acaba de obter a outfit ".. outname .."!")
    doRemoveItem(item.uid, 1)
    return true
end
end

Outfit .XML

XML:
<outfit id="25"  quest="19537" premium="yes">
             <list gender="0" lookType="253" name="[VIP]"/>
             <list gender="1" lookType="253" name="[VIP]"/>
              </outfit>
<outfit id="26"  quest="19537" premium="yes">
             <list gender="0" lookType="255" name="[VIP-2]"/>
             <list gender="1" lookType="255" name="[VIP-2]"/>
        </outfit>
</outfits>
 
Back
Top