local config = {
exhaustionInSeconds = 30,
storage = 34534
}
function onSay(cid, words, param)
if(exhaustion.check(cid, config.storage) == TRUE) then
doPlayerSendCancel(cid, "You can change outfit only every " .. config.exhaustionInSeconds .. " seconds.")
return TRUE
end
local members = getPartyMembers(cid)
if(members == nil or type(members) ~= 'table' or table.maxn(members) <= 1) then
doPlayerSendCancel(cid, "No Party members in range.")
return TRUE
end
local inParty = isInParty(cid)
if(inParty == FALSE) then
doPlayerSendCancel(cid, "Sorry, you're not in a party.")
return TRUE
end
local playerLeader = getPartyLeader(cid)
if(playerLeader == FALSE) then
doPlayerSendCancel(cid, "You have to be party leader.")
return TRUE
end
local outfit = getCreatureOutfit(cid)
local message = "*Party* Your outfit has been changed by party leader. (" .. getCreatureName(cid) .. ")"
local members = 0
local tmp = {}
for i, tid in ipairs(members) do
tmp = outfit
if(canPlayerWearOutfit(tid, outfit.lookType, outfit.lookAddons) ~= TRUE) then
local tidOutfit = getCreatureOutfit(tid)
tmp.lookType = tidOutfit.lookType
tmp.lookAddons = tidOutfit.lookAddons
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, "Party members outfit has been changed. (Total: " .. members .. ")")
return TRUE
end