• 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 change color outfit

gmstrikker

Well-Known Member
Joined
Jul 30, 2014
Messages
458
Solutions
1
Reaction score
50
I have two commands that the party leaders and guild use to change clothes of all members along with the colors
I wanted to disable the function to change clothes, to change only the color and longer keep the outfit that the player was using

partyoutifit

Code:
  local config =
  {
  sexChangeable = false,
  copyOutfitAndAddonsEverytime = false
  }
   
  function onSay(cid, words, param, channel)
  party = getPlayerParty(cid)
  if (config.sexChangeable == true) then
  sex = getPlayerSex(cid)
  end
  if (party) then
  if (party == cid) then
  outfit = getCreatureOutfit(cid)
  members = getPartyMembers(party)
  if (#members >= 1) then   
  tmp = outfit
  for i=1,#members do   
  if (config.sexChangeable == true) then
  if (sex ~= getPlayerSex(members[i])) then
  doPlayerSetSex(members[i], sex)
  end
  end
  if(config.copyOutfitAndAddonsEverytime == false and canPlayerWearOutfit(members[i], tmp.lookType, tmp.lookAddons) ~= true) then
  local tmpOutfit = getCreatureOutfit(members[i])
  tmp.lookType = tmpOutfit.lookType
  tmp.lookAddons = tmpOutfit.lookAddons
  end
  doCreatureChangeOutfit(members[i], tmp)
  doSendMagicEffect(getCreaturePosition(members[i]), 66)
  end
  end
  else
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This command can use only leader of a party!")
  end
  else
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You must be in a party!")
  end
  return true
  end


guildoutifit

Code:
  ---- Script By Daian ----
  local config = {
  exhaustionInSeconds = 30,
  storage = 34534
  }
   
  function onSay(cid, words, param)
  if(exhaustion.check(cid, config.storage) == TRUE) then
  doPlayerSendCancel(cid, "Voçê só pode alterar o Outfit da guild a cada " .. config.exhaustionInSeconds .. " segundos.")
  return TRUE
  end
   
  local playerGuild = getPlayerGuildId(cid)
  if(playerGuild == FALSE) then
  doPlayerSendCancel(cid, "Desculpe, mais voçê não tem guild.")
  return TRUE
  end
   
  local playerGuildLevel = getPlayerGuildLevel(cid)
  if(playerGuildLevel < GUILDLEVEL_LEADER) then
  doPlayerSendCancel(cid, "Voçê tem que ser Lider de uma guild para executar este comando!")
  return TRUE
  end
   
  local players = getPlayersOnline()
  local outfit = getCreatureOutfit(cid)
  local message = "*Guild* Seu Outfit foi mudado pelo lider da guild. (" .. getCreatureName(cid) .. ")"
  local members = 0
  local tmp = {}
  for i, tid in ipairs(players) do
  if(getPlayerGuildId(tid) == playerGuild and cid ~= tid) then
  tmp = outfit
  if(canPlayerWearOutfit(tid, outfit.lookType, outfit.lookAddons) ~= TRUE) then
  local tidOutfit = getCreatureOutfit(tid)
  tmp.lookType = tidOutfit.lookType
  tmp.lookAddons = tidOutfit.lookAddons
  end
   
  doSendMagicEffect(getCreaturePosition(tid), 66)
  doCreatureChangeOutfit(tid, tmp)
  doPlayerSendTextMessage(tid, MESSAGE_INFO_DESCR, message)
  members = members + 1
  end
  end
   
  exhaustion.set(cid, config.storage, config.exhaustionInSeconds)
  doPlayerSendCancel(cid, "Outfit da guild foi mudado com sucesso. (Total members: " .. members .. ")")
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You can use !po to use in a party!")
  return TRUE
   
  end
 
Solution
Any fix for this on tfs 1.2? added it and it just says

19:02 This command can use only leader of a party!

Even if u are the leader of the party?
Code:
function onSay(player, words, param)
    local party = player:getParty()
    if not party then
        return player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'You do not have a party.')
    end

    if party:getLeader() ~= player then
        return player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'You are not the party leader.')
    end
   
    local outfit = player:getOutfit()
    for _, target in ipairs(party:getMembers()) do
        target:setOutfit(outfit)
    end
    return true
end
Try finding this part:
Code:
if(config.copyOutfitAndAddonsEverytime == false and canPlayerWearOutfit(members[i], tmp.lookType, tmp.lookAddons) ~= true) then
local tmpOutfit = getCreatureOutfit(members[i])
tmp.lookType = tmpOutfit.lookType
tmp.lookAddons = tmpOutfit.lookAddons
end

... and replace it with:
Code:
--if(config.copyOutfitAndAddonsEverytime == false and canPlayerWearOutfit(members[i], tmp.lookType, tmp.lookAddons) ~= true) then
local tmpOutfit = getCreatureOutfit(members[i])
tmp.lookType = tmpOutfit.lookType
tmp.lookAddons = tmpOutfit.lookAddons
--end

If that works for the party, you can do the same in the guild, finding this part:
Code:
if(canPlayerWearOutfit(tid, outfit.lookType, outfit.lookAddons) ~= TRUE) then
local tidOutfit = getCreatureOutfit(tid)
tmp.lookType = tidOutfit.lookType
tmp.lookAddons = tidOutfit.lookAddons
end

.. and replace it with:
Code:
--if(canPlayerWearOutfit(tid, outfit.lookType, outfit.lookAddons) ~= TRUE) then
local tidOutfit = getCreatureOutfit(tid)
tmp.lookType = tidOutfit.lookType
tmp.lookAddons = tidOutfit.lookAddons
--end

Let me know if it works!

Ignazio
 
Try finding this part:
Code:
if(config.copyOutfitAndAddonsEverytime == false and canPlayerWearOutfit(members[i], tmp.lookType, tmp.lookAddons) ~= true) then
local tmpOutfit = getCreatureOutfit(members[i])
tmp.lookType = tmpOutfit.lookType
tmp.lookAddons = tmpOutfit.lookAddons
end

... and replace it with:
Code:
--if(config.copyOutfitAndAddonsEverytime == false and canPlayerWearOutfit(members[i], tmp.lookType, tmp.lookAddons) ~= true) then
local tmpOutfit = getCreatureOutfit(members[i])
tmp.lookType = tmpOutfit.lookType
tmp.lookAddons = tmpOutfit.lookAddons
--end

If that works for the party, you can do the same in the guild, finding this part:
Code:
if(canPlayerWearOutfit(tid, outfit.lookType, outfit.lookAddons) ~= TRUE) then
local tidOutfit = getCreatureOutfit(tid)
tmp.lookType = tidOutfit.lookType
tmp.lookAddons = tidOutfit.lookAddons
end

.. and replace it with:
Code:
--if(canPlayerWearOutfit(tid, outfit.lookType, outfit.lookAddons) ~= TRUE) then
local tidOutfit = getCreatureOutfit(tid)
tmp.lookType = tidOutfit.lookType
tmp.lookAddons = tidOutfit.lookAddons
--end

Let me know if it works!

Ignazio

Ty brother its work!!!!

this looks cool, how can i implement this?

Edit u talkactions.xml
And put this line
Code:
  <talkaction words="!guildoutfit" script="guildoutifit.lua"/>
   <talkaction words="!partyoutfit" script="partyoutifit.lua"/>
 
ds7mvMY.png


I'm using https://github.com/TwistedScorpio/OTHire
 
Any fix for this on tfs 1.2? added it and it just says

19:02 This command can use only leader of a party!

Even if u are the leader of the party?
 
Any fix for this on tfs 1.2? added it and it just says

19:02 This command can use only leader of a party!

Even if u are the leader of the party?
Code:
function onSay(player, words, param)
    local party = player:getParty()
    if not party then
        return player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'You do not have a party.')
    end

    if party:getLeader() ~= player then
        return player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'You are not the party leader.')
    end
   
    local outfit = player:getOutfit()
    for _, target in ipairs(party:getMembers()) do
        target:setOutfit(outfit)
    end
    return true
end
 
Solution
Back
Top