Fragdonut
Banned User
It just works for 0.3.
Yes, I can. I'll do it mmm, maybe, before this weekend.Xampy can u script that : one guild can fight not only with 1 guild ?:>
Yes, it works only for 0.3 TFS servers.
Yes, I can. I'll do it mmm, maybe, before this weekend.
Regards.
PS This system can work, maybe, if you use this http://otland.net/f163/forgotten-server-0-3-db-class-0-2-a-26225/ (Pietia told me that some days ago). I don't know if will work or not. Anyways, you won't be able to use globalevents.
[31/07/2009 00:43:28] Lua Script Error: [TalkAction Interface]
[31/07/2009 00:43:28] in a timer event called from:
[31/07/2009 00:43:28] data/talkactions/scripts/GuildWar.lua:onSay
[31/07/2009 00:43:28] luaAddEvent(). callback parameter should be a function.
when i say /war-challenge map1 after 15 sec in console show this:Code:[31/07/2009 00:43:28] Lua Script Error: [TalkAction Interface] [31/07/2009 00:43:28] in a timer event called from: [31/07/2009 00:43:28] data/talkactions/scripts/GuildWar.lua:onSay [31/07/2009 00:43:28] luaAddEvent(). callback parameter should be a function.
I think you should change AddEvent for a function
Sorry for my english
dofile("./GuildWar.lua")
Maps = {
["map1"] =
{
Guild1Pos = {x=2163, y=487, z=7},
Guild2Pos = {x=2186, y=490, z=7}
},
["map2"] =
{
Guild1Pos = {x=2186, y=490, z=6},
Guild2Pos = {x=1000, y=1003, z=6}
}
}
function onSay(cid, words, param)
if getPlayerGuildLevel(cid) == GUILDLEVEL_LEADER then
local myGuild = getPlayerGuildId(cid)
if words == "/war-invite" then
if GuildIsInPEace(myGuild) == true then
if param ~= "" then
if guildExist(param) ~= LUA_ERROR then
local invitedGuild = getGuildId(param)
if invitedGuild ~= LUA_ERROR then
if invitedGuild ~= myGuild then
if GuildIsInPEace(invitedGuild) == true then
doInviteToWar(myGuild, invitedGuild)
doBroadcastMessage(BroadCast[1][1] ..getPlayerGuildName(cid).. BroadCast[1][2] ..getGuildNameById(invitedGuild).. BroadCast[1][3], BroadCast_Type)
else
doPlayerSendCancel(cid, CancelMessagesWar[6])
end
else
doPlayerSendCancel(cid, CancelMessagesWar[8])
end
else
doPlayerSendCancel(cid, CancelMessagesWar[4])
end
else
doPlayerSendCancel(cid, CancelMessagesWar[4])
end
else
doPlayerSendCancel(cid, CancelMessagesWar[7])
end
else
doPlayerSendCancel(cid, CancelMessagesWar[5])
end
elseif words == "/war-accept" then
if getGuildWarInfo(myGuild).By ~= 0 then
local enemyGuild = getGuildWarInfo(myGuild).By
doBroadcastMessage(BroadCast[2][1] ..getPlayerGuildName(cid).. BroadCast[2][2] ..getGuildNameById(enemyGuild).. BroadCast[2][3], BroadCast_Type)
WarAccept(myGuild, enemyGuild)
else
doPlayerSendCancel(cid, CancelMessagesWar[1])
end
elseif words == "/war-reject" then
if getGuildWarInfo(myGuild).By ~= 0 then
doBroadcastMessage(BroadCast[3][1] ..getPlayerGuildName(cid).. BroadCast[3][2] ..getGuildNameById(getGuildWarInfo(myGuild).By).. BroadCast[3][3], BroadCast_Type)
cleanInfo(getGuildWarInfo(myGuild).By)
cleanInfo(myGuild)
else
doPlayerSendCancel(cid, CancelMessagesWar[1])
end
elseif words == "/war-cancel-invite" then
if getGuildWarInfo(myGuild).To ~= 0 then
if getGuildWarInfo(myGuild).With == 0 then
doBroadcastMessage(BroadCast[4][1] ..getPlayerGuildName(cid).. BroadCast[4][2] ..getGuildNameById(getGuildWarInfo(myGuild).To).. BroadCast[4][3], BroadCast_Type)
cleanInfo(getGuildWarInfo(myGuild).To)
cleanInfo(myGuild)
else
doPlayerSendCancel(cid, CancelMessagesWar[3])
end
else
doPlayerSendCancel(cid, CancelMessagesWar[1])
end
elseif words == "/war-challenge" then
local map = Maps[param]
if map then
if getGuildWarInfo(myGuild).With ~= 0 then
local enemyGuild = getGuildWarInfo(myGuild).With
teleportGuild(myGuild, Maps["map1"].Guild1Pos)
teleportGuildEnemy(enemyGuild, Maps["map1"].Guild2Pos)
putWarOn(myGuild, enemyGuild)
doBroadcastMessage(BroadCast[5][1] ..getPlayerGuildName(cid).. BroadCast[5][2] ..getGuildNameById(enemyGuild).. BroadCast[5][3] .. param ..".", BroadCast_Type)
else
doPlayerSendCancel(cid, CancelMessagesWar[10])
end
else
doPlayerSendCancel(cid, CancelMessagesWar[9])
end
elseif words == "/war-cancel" then
local enemy = getGuildWarInfo(myGuild).With
if enemy ~= 0 then
if (os.time() - getGuildWarInfo(myGuild).T) >= (60 * DelayToCancel) then
StopWar(myGuild, enemy)
doBroadcastMessage(BroadCast[6][1] ..getGuildNameById(myGuild).. BroadCast[6][2] ..getGuildNameById(enemy).. BroadCast[6][3], BroadCast_Type)
else
doPlayerSendCancel(cid, CancelMessagesWar[11])
end
else
doPlayerSendCancel(cid, CancelMessagesWar[10])
end
end
else
doPlayerSendCancel(cid, CancelMessagesWar[2])
end
local file = io.open("data/logs/Wars.txt", "a")
file:write("".. os.date("%d %B %Y %X ", os.time()) .." --> "..getCreatureName(cid)..": "..words.." "..param.."\n")
file:close()
return TRUE
end
function teleportGuild(id, pos)
local Members = getOnlineMembers(id)
if #Members > 0 then
for i = 1, #Members do
if getTilePzInfo(getCreaturePosition(Members[i])) == TRUE then
doTeleportThing(Members[i], pos, FALSE)
doSendMagicEffect(pos, CONST_ME_TELEPORT)
doSendMagicEffect(getCreaturePosition(Members[i]), CONST_ME_POFF)
else
doBroadcastMessage("You must be in Protection Zone (PZ).", BroadCast_Type)
end
end
end
end
function teleportGuildEnemy(id, pos)
local Members = getOnlineMembers(id)
if #Members > 0 then
for i = 1, #Members do
if getTilePzInfo(getCreaturePosition(Members[i])) == TRUE then
doTeleportThing(Members[i], pos, FALSE)
doSendMagicEffect(pos, CONST_ME_TELEPORT)
doSendMagicEffect(getCreaturePosition(Members[i]), CONST_ME_POFF)
else
doBroadcastMessage("You must be in Protection Zone (PZ).", BroadCast_Type)
end
end
end
end
function putWarOn(myGuild, enemyGuild)
db.executeQuery("UPDATE `guilds` SET `war_time` = 1 WHERE `id` = ".. myGuild .."")
db.executeQuery("UPDATE `guilds` SET `war_time` = 1 WHERE `id` = ".. enemyGuild .."")
end
why 1 guild can't have more than 1 active war?: \
dofile("./GuildWar.lua")
local PZ = createConditionObject(CONDITION_INFIGHT)
setConditionParam(PZ, CONDITION_PARAM_TICKS, getConfigInfo('whiteSkullTime'))
function onKill(cid, target, lastHit)
if isPlayer(cid) == TRUE and isPlayer(target) == TRUE then
local myGuild = getPlayerGuildId(cid)
local enemyGuild = getPlayerGuildId(target)
if myGuild ~= 0 and enemyGuild ~= 0 then
if enemyGuild == getGuildWarInfo(myGuild).With then
doAddCondition(cid, PZ)
if lastHit == TRUE then
registerDeath(myGuild, enemyGuild, cid, target)
end
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "This frag will not count!")
end
end
end
return TRUE
end