Hello, i got this error with an old xampy's war system, maybe someone can help me to fix it.
TFS 0.3.6 compiled for 8.60.
Error:
Script:
Thanks
TFS 0.3.6 compiled for 8.60.
Error:
Script:
XML:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Guild War System" enabled="yes">
<talkaction words="/war-invite; /war-accept; /war-reject; /war-cancel-invite; /war-challenge; /war-cancel" event="script"><![CDATA[
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 enemy ~= 0 then
local enemyGuild = getGuildWarInfo(myGuild).With
addEvent(StartWar, 15000, {myGuild = myGuild, enemyGuild = enemyGuild, map = param})
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
]]></talkaction>
<globalevent name="wars" interval="1800" event="script"><![CDATA[
function onThink(interval, lastExecution)
for _, id in ipairs(getGuildsWithWar()) do
local Check = db.getResult("SELECT name FROM guilds WHERE id = ".. getGuildWarInfo(id).With .."")
if Check:getID() == LUA_ERROR then
cleanInfo(id)
end
end
return TRUE
end
]]></globalevent>
<event type="login" name="WarLogin" event="script"><![CDATA[
function onLogin(cid)
registerCreatureEvent(cid, "WarKill")
return true
end
]]></event>
<event type="kill" name="WarKill" event="script"><![CDATA[
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 GUID = getPlayerGUID(cid)
local NAME = getPlayerName(cid)
local namet = getPlayerName(target)
local skull = getCreatureSkullType(cid)
local skullt = getCreatureSkullType(target)
local cidd = cid
local function removeFrag(cid)
if skullt == 0 then
db.executeQuery("UPDATE killers SET unjustified = 0 WHERE id IN (SELECT kill_id FROM player_killers WHERE player_id = " .. GUID .. ") ORDER BY killers.unjustified DESC LIMIT 1;")
doPlayerSendTextMessage(cidd, 21, "Frag from "..namet.." wasn't counted.")
end
if skull < 5 then
if getCreatureSkullType(cidd) == SKULL_BLACK then
doCreatureSetSkullType(cidd, SKULL_RED)
end
elseif skull < 4 then
if getCreatureSkullType(cidd) == SKULL_RED then
doCreatureSetSkullType(cidd, SKULL_WHITE)
end
end
end
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
if getShowInfo(myGuild).S == 1 then
registerDeathOne(myGuild, enemyGuild, cid, target)
else
registerDeathTwo(myGuild, enemyGuild, cid, target)
end
end
addEvent(removeFrag, 150)
end
end
end
return TRUE
end
]]></event>
</mod>
Thanks