• 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!

Solved TFS What are the guild commands?

Drakkhan

Illuria Project Lead
Joined
Oct 3, 2013
Messages
141
Reaction score
22
Simple question,

Where does one find a complete list of commands available to a guild leader?

Specifically: How does a guild leader invite other characters to the guild?
 
SOLVED:

I wrote a spell that adds a storage value to players to indicate whether they're invited or not.

I created the a global variable to set the storage ID in it's own special bracket to numbers of the form 9913###:

GUILD_BASELINE = 9913000

Then wrote the following code to invite characters:

Code:
function onCastSpell(cid, var)
    local GuildID = getPlayerGuildId(cid)
    if getPlayerGuildLevel(cid) == 3 then
        setPlayerStorageValue(var.number, (GUILD_BASELINE + GuildID), 1)
        doPlayerSendCancel(cid, string.format("%s is invited to the guild!", getPlayerName(var.number)))
    else
        doPlayerSendCancel(cid, string.format("The player could not be found."))   
    end
end

Next, I will write a similar code to access the storage value when a character tries to join the guild. If the character's storage value corresponding to the guild they are trying to join is 1, they are allowed to join. Otherwise, they are not.
 
Last edited:
Update:

This in global.lua:
Code:
GUILD_BASELINE = 9913000

This in talkactions.xml:
Code:
    <talkaction words="!join" script="joinguild.lua"/>
    <talkaction words="!invitetoguild" script="invite.lua"/>

New script "data/talkactions/scripts/invite.lua":
Code:
function onSay(cid, words, param)

    local GuildID = getPlayerGuildId(cid)
    if getPlayerGuildLevel(cid) == 3 then
        setPlayerStorageValue(getPlayerByName(param), (GUILD_BASELINE + GuildID), 1)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, string.format("%s is invited to the guild!", param))
    else
        doPlayerSendCancel(cid, string.format("The player could not be found."))
    end
end

New script "data/talkactions/scripts/joinguild.lua":
Code:
function onSay(cid, words, param)

    local playerGuildId = getPlayerGuildId(cid)
    local guildToJoin = param

    if(guildToJoin) then
        local guildToJoinId = getGuildId(guildToJoin)
        if(guildToJoinId) then
            if(playerGuildId > 0) then
                doPlayerSendCancel(cid, string.format("You are already in a guild."))
            else
                if getPlayerStorageValue(cid, (GUILD_BASELINE + guildToJoinId)) == 1 then
                    setPlayerStorageValue(cid, (GUILD_BASELINE + guildToJoinId), 2)
                    doPlayerSetGuildId(cid, guildToJoinId)
                    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, string.format("You have been accepted into %s", param))
                elseif getPlayerStorageValue(cid, (GUILD_BASELINE + guildToJoinId)) == 2 then
                    doPlayerSendCancel(cid, string.format("You are in the guild already."))
                else
                    doPlayerSendCancel(cid, string.format("You are not invited."))
                end
            end
        else
            doPlayerSendCancel(cid, string.format("There is no guild with that name."))
        end
       
    else
        doPlayerSendCancel(cid, string.format("You have failed."))
    end
end

And BOOM you have "!invitetoguild" and "!join" to replace "!invite" and "!joinguild"!!!

You're welcome, all those who end up here via search!

Regards,

Drakkhan
 
Back
Top