• 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.4 HELP ADDON DOLL

VagosClubTM

Active Member
Joined
Aug 16, 2019
Messages
219
Reaction score
32
Location
Chile
hello friends, I am trying to use this talkaction to be able to grant skins to other users, they are custom skins added to the outfit.xml but it does not grant them, it is version 772 TFS 1.4 I will leave the script here, when I use the command it tells me that it is I give myself the skin but at the time of checking I have nothing from now, thank you very much to those who take the time.

Lua:
local femaleOutfits = {
   ["Itachi"] = {167,},
   ["Itachi"] = {167,},
}

local maleOutfits = {
   ["Itachi"] = {167,},
   ["Itachi"] = {167,},
}

function onSay(cid, words, param)
   local outfitName = string.lower(param)
   if string.len(outfitName) == 0 then
      return doPlayerSendCancel(cid, "NECESITAS PONER EL NOMBRE DEL ADDON.")
   end
   local dollCount = getPlayerItemCount(cid, 2108)
   if dollCount == 0 then
      return doPlayerSendCancel(cid, "NECESITAS EL ITEM ADDON DOLL.")
   end
   local outfitList = getPlayerSex(cid) == 0 and femaleOutfits or maleOutfits
   local outfitId = outfitList[outfitName]
   if not outfitId then
      return doPlayerSendCancel(cid, "EL NOMBRE DE ESTE OUTFIT NO EXISTE.")
   end
   if canPlayerWearOutfit(cid, outfitId[0], 0) then
      return doPlayerSendCancel(cid, string.format("Tu ya tienes este outfit.", outfitName))
   end
   doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
   doPlayerRemoveItem(cid, 2108, 1)
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string.format("tu ya obtuviste esta outfit completo.", outfitName))
   doPlayerAddOutfit(cid, outfitId[0], 0)
   return true
end
 
The script is trying to index [0] on an array while lua is 1-based array, so just change to outfitId[1]
 
That line is also checking if they CAN wear the outfit, versus whether or not they own the outfit.

key difference.

use player:hasOutfit(lookType[, addon = 0]) instead.
 
That line is also checking if they CAN wear the outfit, versus whether or not they own the outfit.

key difference.

use player:hasOutfit(lookType[, addon = 0]) instead.
sorry, what line? try it on this

if canPlayerWearOutfit(cid, outfitId[0], 0) then
but it throws me errors.
Post automatically merged:

The script is trying to index [0] on an array while lua is 1-based array, so just change to outfitId[1]
I had it in 1 but still it does not grant the outfit
 
but it throws me errors.

Lua:
local outfits = {
   ["itachi"] = {male = 167, female = 167}
}

function onSay(player, words, param)
   local outfitName = param:lower():gsub("%A", "") -- in case the player use quotes/special characters
   if #param == 0 then
      return player:sendCancelMessage("NECESITAS PONER EL NOMBRE DEL ADDON.")
   end
     
   local outfitDoll = 2108
   if player:getItemCount(outfitDoll) == 0 then
      return player:sendCancelMessage("NECESITAS EL ITEM ADDON DOLL.")
   end

   local outfitList = outfits[outfitName]
   if not outfitList then
      return player:sendCancelMessage("EL NOMBRE DE ESTE OUTFIT NO EXISTE.")
   end

   local outfitId = player:getSex() ~= 1 and outfitList.female or outfitList.male
   if player:hasOutfit(outfitId) then
      return player:sendCancelMessage("Ya tienes el outfit de "..outfitName..".")
   end

   player:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS)
   player:removeItem(outfitDoll, 1)
   player:sendTextMessage(MESSAGE_INFO_DESCR, "Has obtenido el outfit de "..outfitName..".")
   player:addOutfit(outfitId)
   return true
end
 
Lua:
local outfits = {
   ["itachi"] = {male = 167, female = 167}
}

function onSay(player, words, param)
   local outfitName = param:lower():gsub("%A", "") -- in case the player use quotes/special characters
   if #param == 0 then
      return player:sendCancelMessage("NECESITAS PONER EL NOMBRE DEL ADDON.")
   end
    
   local outfitDoll = 2108
   if player:getItemCount(outfitDoll) == 0 then
      return player:sendCancelMessage("NECESITAS EL ITEM ADDON DOLL.")
   end

   local outfitList = outfits[outfitName]
   if not outfitList then
      return player:sendCancelMessage("EL NOMBRE DE ESTE OUTFIT NO EXISTE.")
   end

   local outfitId = player:getSex() ~= 1 and outfitList.female or outfitList.male
   if player:hasOutfit(outfitId) then
      return player:sendCancelMessage("Ya tienes el outfit de "..outfitName..".")
   end

   player:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS)
   player:removeItem(outfitDoll, 1)
   player:sendTextMessage(MESSAGE_INFO_DESCR, "Has obtenido el outfit de "..outfitName..".")
   player:addOutfit(outfitId)
   return true
end
I tried it and it doesn't give me the outfit, maybe it's because of version 772?
 
I tried it and it doesn't give me the outfit, maybe it's because of version 772?
It should work anyways, i suppose "Itachi" is a new looktype you added? If yes then try with an already existing looktype/outfit

Talkaction on xml should have the separator parameter:
Lua:
<talkaction words="!addon" separator=" " script="script.lua" />

Also the outfit must be register and enabled on outfits.xml
 
It should work anyways, i suppose "Itachi" is a new looktype you added? If yes then try with an already existing looktype/outfit

Talkaction on xml should have the separator parameter:
Lua:
<talkaction words="!addon" separator=" " script="script.lua" />

Also the outfit must be register and enabled on outfits.xml
I have it with the separator bro but it still doesn't give me the outfit, I removed the item but it doesn't give me anything.

maybe as I say it is for version 772
 
It a simple talkaction :p
It doesn't work when executing the command it says it doesn't exist, I want the players to get permanent skins but it doesn't work in any way, not with a doll, not with commands, not with storage. when I try to make the skin permanent in their accounts so that they can freely change their clothes. but nothing works.
 
Lua:
    <talkaction words="!outfit" separator=" " script="alloutfits.lua" />

!outfit rat

So how you want to add the outfit? You mean you want make player to buy outfit from site and parse it to OT and save it?
 
Lua:
    <talkaction words="!outfit" separator=" " script="alloutfits.lua" />

!outfit rat

So how you want to add the outfit? You mean you want make player to buy outfit from site and parse it to OT and save it?
I don't want the outfit to be temporary, I want the player to get it permanently like a wizard's outfit, for example when you start on any server you can unlock new outfits permanently that's what I want
 
You can do it just with action script

Lua:
local config = {
    storage = 535924,
    effect = 4,
    text1 = "You have gained your new outfit!",
    text2 = "You already have this outfit!",
    looktype = 317
}
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

There is a lot of possibilites to do it with storages honestly.
 
You can do it just with action script

Lua:
local config = {
    storage = 535924,
    effect = 4,
    text1 = "You have gained your new outfit!",
    text2 = "You already have this outfit!",
    looktype = 317
}
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

There is a lot of possibilites to do it with storages honestly.
I'll try with this
 
You can do it just with action script

Lua:
local config = {
    storage = 535924,
    effect = 4,
    text1 = "You have gained your new outfit!",
    text2 = "You already have this outfit!",
    looktype = 317
}
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

There is a lot of possibilites to do it with storages honestly.


no bro it didn't work, it declares the storage but it doesn't give me a new outfit.
 
Then you're doing something wrong then
Post automatically merged:

You sure your new outfit is enabled on outfits.xml?
 
Then you're doing something wrong then
like what? I've been trying for months, I use TFS 1.4 VERSION 772 maybe that's why adding new clothes to the players doesn't work
Post automatically merged:

Then you're doing something wrong then
Post automatically merged:

You sure your new outfit is enabled on outfits.xml?
yes enabled
 
Back
Top