• 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!

Outfit Doll = 1 use

God Mythera

Veteran OT User
Joined
Aug 11, 2012
Messages
2,048
Solutions
2
Reaction score
256
Location
United States
Hello and i am trying to get help with a script, i need it to give Jersey outfit for male & female and i need it so it is only 1 use only, also i am using TFS 1.0

The script i have:
Code:
local config = {
looktype_male = 620, -- looktype of the outfit for male.
looktype_female = 619, -- looktype of the outfit for female
addons = 0, -- how many addons you get.
storage = 5012 -- storage value used.
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid,config.storage) < 1 then
if getPlayerSex(cid) == 0 then
doPlayerAddOutfit(cid,config.looktype_female,config.addons)
doPlayerSendTextMessage(cid,20,'You got an outfit.')
doSendMagicEffect(getThingPos(cid),12)
elseif getPlayerSex(cid) == 1 then
doPlayerAddOutfit(cid,config.looktype_male,config.addons)
doPlayerSendTextMessage(cid,20,'You got an outfit.')
doSendMagicEffect(getThingPos(cid),12)
end
else
doPlayerSendTextMessage(cid,20,'You already have this outfit.')
doSendMagicEffect(getThingPos(cid),2)
end
return true
end
 
in 0.4 you can use doRemoveItem
must be something similar in tfs 1.0

change ID to the item ID

Code:
local config = {
looktype_male = 620, -- looktype of the outfit for male.
looktype_female = 619, -- looktype of the outfit for female
addons = 0, -- how many addons you get.
storage = 5012 -- storage value used.
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid,config.storage) < 1 then
if getPlayerSex(cid) == 0 then
doPlayerAddOutfit(cid,config.looktype_female,config.addons)
doPlayerSendTextMessage(cid,20,'You got an outfit.')
doSendMagicEffect(getThingPos(cid),12)
doRemoveItem(cid, ID, 1)
elseif getPlayerSex(cid) == 1 then
doPlayerAddOutfit(cid,config.looktype_male,config.addons)
doPlayerSendTextMessage(cid,20,'You got an outfit.')
doSendMagicEffect(getThingPos(cid),12)
doRemoveItem(cid, ID, 1)
end
else
doPlayerSendTextMessage(cid,20,'You already have this outfit.')
doSendMagicEffect(getThingPos(cid),2)
end
return true
end
 
Last edited by a moderator:
Code:
local c = {
    male = 620, -- looktype of the outfit for male.
    female = 619, -- looktype of the outfit for female
    addons = 0, -- how many addons you get.
    storage = 5012, -- storage value used.
    removeAmount = 1
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local player = Player(cid)
    local msg = ''
    if player:getStorageValue(c.storage) < 1 then
        player:addOutfitAddon(player:getSex() == 0 and c.male or c.female, c.addons)
        msg = 'You got an outfit.'
        item:remove(c.removeAmount)
        player:setStorageValue(c.storage, 1)
    else
        msg = 'You already have this outfit.'
    end
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, msg)
    player:getPosition():sendMagicEffect(CONST_ME_ENERGYHIT)
    return true
end
 
Code:
local c = {
    male = 620, -- looktype of the outfit for male.
    female = 619, -- looktype of the outfit for female
    addons = 0, -- how many addons you get.
    storage = 5012, -- storage value used.
    removeAmount = 1
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local player = Player(cid)
    local msg = ''
    if player:getStorageValue(c.storage) < 1 then
        player:addOutfitAddon(player:getSex() == 0 and c.male or c.female, c.addons)
        msg = 'You got an outfit.'
        item:remove(c.removeAmount)
        player:setStorageValue(c.storage, 1)
    else
        msg = 'You already have this outfit.'
    end
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, msg)
    player:getPosition():sendMagicEffect(CONST_ME_ENERGYHIT)
    return true
end
Didn't work :(
 
in 0.4 you can use doRemoveItem
must be something similar in tfs 1.0

change ID to the item ID


local config = {
looktype_male = 620, -- looktype of the outfit for male.
looktype_female = 619, -- looktype of the outfit for female
addons = 0, -- how many addons you get.
storage = 5012 -- storage value used.
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid,config.storage) < 1 then
if getPlayerSex(cid) == 0 then
doPlayerAddOutfit(cid,config.looktype_female,config.addons)
doPlayerSendTextMessage(cid,20,'You got an outfit.')
doSendMagicEffect(getThingPos(cid),12)
doRemoveItem(cid, ID, 1)
elseif getPlayerSex(cid) == 1 then
doPlayerAddOutfit(cid,config.looktype_male,config.addons)
doPlayerSendTextMessage(cid,20,'You got an outfit.')
doSendMagicEffect(getThingPos(cid),12)
doRemoveItem(cid, ID, 1)
end
else
doPlayerSendTextMessage(cid,20,'You already have this outfit.')
doSendMagicEffect(getThingPos(cid),2)
end
return true
end

In this situation it's better use:
doRemoveItem(cid, item.uid, 1)
than
doRemoveItem(cid, ID, 1)
 
Haven't scripted in 2ys. Wont you need item = X in script config then?
doRemoveItem should remove an item based on unique id :p
item.uid mention the unique id and the remove function delet the exact same item :p
you only need to mention item id in config if there's several types of items using the same script, but either way he wont need the ID to remove the item upon use, only if there's slight differ between different items.
and if so he just split the script up with "if" statements like

if item.itemid == c.itemid then


sorry if I write anything unclear, getting pretty messed up in my head atm, have been one damn long day in my codes xD
 
Back
Top