• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction (Guild) Outfit changer (!go)

slaw

Software Developer
Joined
Aug 27, 2007
Messages
3,670
Solutions
125
Reaction score
1,117
Location
Germany
GitHub
slawkens
Nice & useful for guilds, for wars etc.

Will set all guild members same outfit as leader have.

Only leader can use command, but you can simple change it.

Works only with TFS 0.3+

talkactions/scripts/guildoutfit.lua
Code:
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 1 time per " .. config.exhaustionInSeconds .. " seconds.")
        return TRUE
    end

    local playerGuild = getPlayerGuildId(cid)
    if(playerGuild == FALSE) then
        doPlayerSendCancel(cid, "Sorry, you're not in a guild.")
        return TRUE
    end

    local playerGuildLevel = getPlayerGuildLevel(cid)
    if(playerGuildLevel < GUILDLEVEL_LEADER) then
        doPlayerSendCancel(cid, "You have to be Leader of your guild to change outfits!")
        return TRUE
    end

    local players = getPlayersOnline()
    local outfit = getCreatureOutfit(cid)
    local message = "*Guild* Your outfit has been changed by leader. (" .. 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, "Guild members outfit has been changed. (Total: " .. members .. ")")
    return TRUE
end

talkactions.xml
Code:
<talkaction words="!go" event="script" value="guildoutfit.lua"/>

Open data/lib/data.lua and add at end: (Thanks Keraxel)
Code:
dofile(getDataDir() .. "lib/exhaustion.lua")
 
Last edited:
Exhaustion library is disabled by default.

Open data/lib/data.lua and add at end:
Lua:
dofile(getDataDir() .. "lib/exhaustion.lua")
 
Works not for me, i have TFS 0.3.3

this error:

[03/05/2009 22:16:06] Lua Script Error: [TalkAction Interface]
[03/05/2009 22:16:06] data/talkactions/scripts/guildoutfit.lua:eek:nSay

[03/05/2009 22:16:06] data/talkactions/scripts/guildoutfit.lua:7: attempt to call global 'internalParseParam' (a nil value)
[03/05/2009 22:16:06] stack traceback:
[03/05/2009 22:16:06] data/talkactions/scripts/guildoutfit.lua:7: in function <data/talkactions/scripts/guildoutfit.lua:6>
 
Last edited:
lol, sorry guys, I forgot to remove it ;p

Now it should WORK! Please test someone..
 
It's cool to do something like that: When guild leader will use that command then it will change outfit of all guild members, but they can't change their outfit for about 5 minutes.
 
its not working for me, im using tfs 0.3.2, no erros in the console also..:(
 
dont call me like this, got no idea what you got against me -.- but you can help me if you want to :p
 
I edited this script for "Party members": (NOT TESTED REPOR BUGS)

Lua:
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 1 time per " .. 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
 
Last edited:
I edited this script for "Party members": (NOT TESTED REPOR BUGS)

Lua:
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 1 time per " .. 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

Don't work for me (TFS 0.3.4)
Error:
 

Attachments

And what if the guild leader is under a monster illusion spell at the time?
Everyone turns into pandas for ages? All males turn female?

It's a nice idea, but you need to look into it further.
 
@Up
It's not working like that, when the guild leader have monster outfit (utevo res ina or w/e) then this command is changing guild members outfits to a normal outfit.

@Topic
This system have a little bug :S When a guild leader have outfit with addons and guild members don't have this addons then it's changing only their outfit colors but not the outfit :d
 
Back
Top