Drakkhan
Illuria Project Lead
- Joined
- Oct 3, 2013
- Messages
- 141
- Reaction score
- 22
TFS 0.2.15 (Mystic Spirit) didn't have !invite functionality for my guildleader.. sooo.. I made a couple talkactions to replace that feature. Maybe someone else needs these? If nothing else, there's some informative use of functions!
This in global.lua:
This in talkactions.xml:
New script "data/talkactions/scripts/invite.lua":
New script "data/talkactions/scripts/joinguild.lua":
And BOOM you have "!invitetoguild" and "!join" to replace "!invite" and "!joinguild"!!!
Regards,
Drakkhan
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"!!!
Regards,
Drakkhan