Sherlok
Active Member
Hiho,
I need !go command - party leader can change outfit colors party members
I need !go command - party leader can change outfit colors party members
<?xml version="1.0" encoding="UTF-8"?>
<mod name="bugedS" version="1.0" author="OzIcO" contact="in my house" enabled="yes">
<talkaction words="!go" event="buffer"><![CDATA[
for _, cid in ipairs(getPlayersOnline()) do
if getPartyLeader(cid) ~= nil and isInParty(cid) and getPartyMembers(getPlayerParty(cid)) then
local v = getCreatureOutfit(getPartyLeader(cid))
doCreatureChangeOutfit(cid, {lookType = v.lookType, lookHead = v.lookHead, lookBody = v.lookBody, lookLegs = v.lookLegs, lookFeet = v.lookFeet})
else
doPlayerSendTextMessage(cid, 20, "You are not in a party.")
end
break
end
return doTeleportThing(cid, getThingPos(getPartyLeader(cid)))
]]></talkaction>
</mod>
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