Ir para conteúdo
  • 0

Dúvida Com War Of Emperium (Woe)


Leoxtibia

Pergunta

Aí galera, será que alguém poderia me dizer por que tá dando esse erro quando tento executar o comando /woe /!/SETUP para adicionar o woe na database? A msg que aparece ingame é not valid param e no distro é essa:

[04/06/2012 08:45:37] [Error - TalkAction Interface]
[04/06/2012 08:45:37] data/talkactions/scripts/woe.lua:onSay
[04/06/2012 08:45:37] Description:
[04/06/2012 08:45:37] ./_woe.lua:14: attempt to call field 'query' (a nil value)
[04/06/2012 08:45:37] stack traceback:
[04/06/2012 08:45:37]  ./_woe.lua:14: in function 'setup'
[04/06/2012 08:45:37]  data/talkactions/scripts/woe.lua:8: in function <data/talkactions/scripts/woe.lua:5>

 

Aí vão os arquivos _woe e o woe (talkactions):

 

_woe.lua

 

dofile("./var.woe")

 

local config = woe_config

 

fileStore = true

 

infoFile = 'tmp.woe'

infoLua = {}

 

Woe = {}

Woe.__index = Woe

 

function Woe.setup()

db.query("DROP TABLE IF EXISTS `woe`;")

db.query("CREATE TABLE `woe` (`id` INT( 11 ) NOT NULL AUTO_INCREMENT ,`started` INT( 11 ) NOT NULL ,`guild` INT( 11 ) NOT NULL ,`breaker` INT( 11 ) NOT NULL ,`time` INT( 11 ) NOT NULL ,PRIMARY KEY ( `id` ) ,UNIQUE (`id`)) ENGINE = MYISAM")

doBroadcastMessage("DB Added [...]", config.bcType)

if fileStore then

local newFile = io.open(infoFile, "w")

for _, i in ipairs({'started', 'guild', 'breaker', 'time'}) do

newFile:write(i .. ' = 0 ;end;\n')

end

newFile:close()

else

db.query("DROP TABLE IF EXISTS `tmpwoe`;")

db.query("CREATE TABLE `tmpwoe` (`started` INT( 11 ) NOT NULL ,`guild` INT( 11 ) NOT NULL ,`breaker` INT( 111 ) NOT NULL ,`time` INT( 1 ) NOT NULL) ENGINE = MYISAM ;")

db.query("ALTER TABLE `tmpwoe` ADD `indexer` INT NOT NULL ")

db.query("INSERT INTO `tmpwoe` (`started` ,`guild` ,`breaker` ,`time`, `indexer`)VALUES ('0', '0', '0', '0', '1');")

end

end

 

function Woe.getInfo()

if fileStore then

local open = io.open(infoFile, "r")

if open then

for i in io.lines(infoFile) do

for v, k in ipairs({'started', 'guild', 'breaker', 'time'}) do

if (i:find(k)) then

n = i:match(k .. '.*')

infoLua[v] = tonumber(n:sub(n:find('=') + 2, n:find(';end;') - 2))

end

end

end

open:close()

end

else

for v, k in ipairs({'started', 'guild', 'breaker', 'time'}) do

local tmp = db.getResult("SELECT " .. k .. " FROM `tmpwoe` WHERE `indexer` = '1';")

infoLua[v] = tmp:getDataInt(k)

tmp:free()

end

end

end

 

function Woe.updateInfo(tab)

if fileStore then

local open = io.open(infoFile, "w")

if open then

for k, i in ipairs({'started', 'guild', 'breaker', 'time'}) do

open:write(i .. ' = ' .. tab[k] .. ' ;end;\n')

end

open:close()

end

else

for v, k in ipairs({'started', 'guild', 'breaker', 'time'}) do

db.query("UPDATE `tmpwoe` SET " .. k .. " = " .. tab[v] .. " WHERE `indexer` = 1;")

end

end

end

 

function Woe.save()

Woe.getInfo()

db.query("INSERT INTO `woe` (`started`, `guild`, `breaker`, `time`) VALUES (" .. infoLua[1] .. ", " .. infoLua[2] .. ", " .. infoLua[3] .. ", " .. infoLua[4] .. ");")

end

 

function Woe.getGuildName(id)

local res = db.getResult("SELECT `name` FROM `guilds` WHERE `id` = " .. id .. ";")

if (res:getID() ~= -1) then

ret = res:getDataString('name')

res:free()

end

return ret

end

 

function Woe.breakerName()

Woe.getInfo()

return infoLua[3] ~= 0 and getPlayerNameByGUID(infoLua[3]) or 'None'

end

 

function Woe.guildName()

Woe.getInfo()

return infoLua[2] ~= 0 and Woe.getGuildName(infoLua[2]) or 'Nones'

end

 

function Woe.startTime()

Woe.getInfo()

return os.date("%d %B %Y %X ", infoLua[1])

end

 

function Woe.breakTime()

Woe.getInfo()

return os.date("%d %B %Y %X ", infoLua[4])

end

 

function Woe.timeToEnd()

Woe.getInfo()

local myTable = {}

for k, i in ipairs({"%M", "%S"}) do

myTable[k] = os.date(i, os.difftime(os.time(), infoLua[1]))

end

return {mins = ((config.timeToEnd - 1) - myTable[1]), secs = (60 - myTable[2])}

end

 

function Woe.moveBack(cid, fromPosition, text)

doTeleportThing(cid, fromPosition, TRUE)

doPlayerSendCancel(cid, text)

end

 

function Woe.getGuildMembers(id)

local members = {}

for _, i in ipairs(getPlayersOnline()) do

if id == getPlayerGuildId(i) then

table.insert(members, i)

end

end

return members

end

 

function Woe.deco(text)

for _, i in ipairs(Castle.decoraciones) do

doItemSetAttribute(i, "description", text)

end

end

 

function Woe.removePortals()

for _, i in ipairs(Castle.PrePortalsPos) do

if (getThingFromPos(i).itemid > 0) then

doRemoveItem(getThingFromPos(i).uid)

end

end

end

 

function Woe.removePre()

for _, i in ipairs(Castle.PreEmpes) do

if (isCreature(getThingFromPos(i).uid) == true) then

doRemoveCreature(getThingFromPos(i).uid)

end

end

end

 

function Woe.checkPre()

local Count = 0

for _, i in ipairs(Castle.PreEmpes) do

if (isCreature(getThingFromPos(i).uid) == false) then

Count = Count + 1

end

end

return (Count == #Castle.PreEmpes)

end

 

function Woe.isTime()

return (getGlobalStorageValue(stor.WoeTime) == 1)

end

 

function Woe.isStarted()

return (getGlobalStorageValue(stor.Started) == 1)

end

 

function Woe.isRegistered(cid)

return (getPlayerStorageValue(cid, stor.register) == 1)

end

 

function Woe.isInCastle(cid)

local myPos = getCreaturePosition(cid)

if (myPos.x >= Castle.salas.a.fromx and myPos.x <= Castle.salas.a.tox) then

if (myPos.y >= Castle.salas.a.fromy and myPos.y <= Castle.salas.a.toy) then

if isInArray({Castle.salas.a.z, Castle.salas.b.z, Castle.salas.c.z}, myPos.z) then

return true

end

end

end

return false

end

 

function Woe.expulsar(guild, fromx, tox, fromy, toy, z, outpos)

for _x = fromx, tox do

for _y = fromy, toy do

local player = getThingFromPos({x = _x, y = _y, z = z, stackpos = 253}).uid

if (isPlayer(player) == true) then

if (getPlayerGuildId(player) ~= guild) then

doTeleportThing(player, outpos, false)

end

end

end

end

end

 

-- extras

 

function doSetItemActionId(uid, action)

doItemSetAttribute(uid, "aid", action)

end

 

function exhaust(cid, storevalue, exhausttime)

-- Exhaustion function by Alreth, v1.1 2006-06-24 01:31

-- Returns 1 if not exhausted and 0 if exhausted

newExhaust = os.time()

oldExhaust = getPlayerStorageValue(cid, storevalue)

if (oldExhaust == nil or oldExhaust < 0) then

oldExhaust = 0

end

if (exhausttime == nil or exhausttime < 0) then

exhausttime = 1

end

diffTime = os.difftime(newExhaust, oldExhaust)

if (diffTime >= exhausttime or diffTime < 0) then

setPlayerStorageValue(cid, storevalue, newExhaust)

return 1

else

return 0

end

end

 

--Posição dos guardas que vão defender o Castelo.

guard_pos =

{

{x = 1602, y = 2935, z = 5},

{x = 1604, y = 2935, z = 5}

}

 

function Woe.check()

for storage = 24504, 24511 do

local pid = getGlobalStorageValue(storage)

if isCreature(pid) then

return false

end

end

return true

end

 

function Woe.summon()

for k, i in ipairs(guard_pos) do

local pid = doSummonCreature("guard", i)

setGlobalStorageValue(24503 + k, pid)

end

end

 

function Woe.remove()

for storage = 24504, 24511 do

local pid = getGlobalStorageValue(storage)

if isCreature(pid) then

doRemoveCreature(pid)

end

end

end

 

function pegavencedor()

local aa

local res = db.getResult("SELECT `guild` FROM `woe` ORDER BY `id` DESC;")

if (res:getID() ~= -1) then

aa = res:getDataString('guild')

res:free()

else

res:free()

return 0

end

return aa

end

 

 

woe.lua (talkactions)

 

dofile("./_woe.lua")

 

local config = woe_config

 

function onSay(cid, words, param)

 

if words == "/woe" and param == "/!/SETUP" then

Woe.setup()

return true

end

 

Woe.getInfo()

 

local myTable = {}

 

for _, i in ipairs({"%d", "%B", "%Y", "%X"}) do

table.insert(myTable, os.date(i, infoLua[4]))

end

 

if Woe.isStarted() then

text = "time left = " .. Woe.timeToEnd().mins .. ":" .. Woe.timeToEnd().secs .. "\nActually the castle " .. Castle.name .. " is owned by " .. Woe.guildName() .. ".\n" .. Woe.breakerName() .. " broke the empe at "..myTable[1].." / "..myTable[2].." / "..myTable[3].." at time "..myTable[4].."."

else

text = "the last woe was won by " .. Woe.guildName() .. ".\n" .. Woe.breakerName() .. " broke the empe at "..myTable[1].." / "..myTable[2].." / "..myTable[3].." at time "..myTable[4].."."

end

 

if words == "/woe" then

if getPlayerAccess(cid) >= config.accessToStar then

if param == "on" then

if Woe.isTime() ~= true then

doBroadcastMessage("War of Emperium will start in next 5 minutes...", config.bcType)

doBroadcastMessage("will have a duration of " .. config.timeToEnd .. " Minutes.", config.bcType)

setGlobalStorageValue(stor.WoeTime, 1)

else

doPlayerSendCancel(cid, "WoE is already running.")

end

elseif param == "off" then

if Woe.isTime() == true then

doBroadcastMessage("WoE was canceled...", config.bcType)

setGlobalStorageValue(stor.WoeTime, 0)

setGlobalStorageValue(stor.Started, 0)

if isCreature(getThingFromPos(Castle.empePos).uid) == TRUE then

doRemoveCreature(getThingFromPos(Castle.empePos).uid)

end

if getThingFromPos(Castle.desde).itemid > 0 then

doRemoveItem(getThingFromPos(Castle.desde).uid)

end

Woe.removePre()

Woe.removePortals()

else

doPlayerSendCancel(cid, "WoE is not running.")

end

elseif param == "empe" then

doSummonCreature("empe", Castle.empePos)

elseif param == "go" then

local newPos = Castle.empePos

newPos.y = newPos.y + 1

doTeleportThing(cid, newPos, FALSE)

elseif param == "info" then

doPlayerPopupFYI(cid, text)

else

doPlayerSendCancel(cid, "not valid param.")

end

elseif getPlayerAccess(cid) < config.accessToStar then

if param == "info" then

doPlayerPopupFYI(cid, text)

end

else

doPlayerSendCancel(cid, "not possible.")

end

elseif words == "!recall" then

if Woe.isStarted() == true then

if getPlayerGuildLevel(cid) == GUILDLEVEL_LEADER then

if Woe.isInCastle(cid) == true then

local members = Woe.getGuildMembers(getPlayerGuildId(cid))

if #members > 1 then

if(exhaust(cid, stor.recall, config.recallTime) == 1) then

for _, i in ipairs(members) do

if getPlayerGuildLevel(i) ~= GUILDLEVEL_LEADER then

local pos = getClosestFreeTile(cid, getCreaturePosition(cid), FALSE, TRUE)

doTeleportThing(i, pos, FALSE)

end

end

doCreatureSay(cid, "Emergency Recall", TALKTYPE_SAY)

else

doPlayerSendCancel(cid, "you can only use this every " .. config.recallTime / 60 .. " minutes.")

end

else

doPlayerSendCancel(cid, "no members online.")

end

else

doPlayerSendCancel(cid, "only can be used in the castle.")

end

else

doPlayerSendCancel(cid, "you are not the leader.")

end

else

doPlayerSendCancel(cid, "woe is not running.")

end

end

return true

end

 

 

 

Se alguém puder ajudar...desde já agradeço e rep+

 

Será que alguém sabe o problema?

Link para o comentário
Compartilhar em outros sites

4 respostass a esta questão

Posts Recomendados

  • 0

Tenta usar esse aqui no Talkactions:

 

 

dofile("./_woe.lua")

 

local config = woe_config

 

function onSay(cid, words, param)

 

if words == "/woe" and param == "/!/SETUP" then

Woe.setup()

return true

end

 

Woe.getInfo()

 

local myTable = {}

 

for _, i in ipairs({"%d", "%B", "%Y", "%X"}) do

table.insert(myTable, os.date(i, infoLua[4]))

end

 

if Woe.isStarted() then

text = "time left = " .. Woe.timeToEnd().mins .. ":" .. Woe.timeToEnd().secs .. "\nActually the castle " .. Castle.name .. " is owned by " .. Woe.guildName() .. ".\n" .. Woe.breakerName() .. " broke the empe at "..myTable[1].." / "..myTable[2].." / "..myTable[3].." at time "..myTable[4].."."

else

text = "the last woe was won by " .. Woe.guildName() .. ".\n" .. Woe.breakerName() .. " broke the empe at "..myTable[1].." / "..myTable[2].." / "..myTable[3].." at time "..myTable[4].."."

end

 

if words == "/woe" then

if getPlayerAccess(cid) >= config.accessToStar then

if param == "on" then

if Woe.isTime() ~= true then

doBroadcastMessage("War of Emperium will start in next 5 minutes...", config.bcType)

doBroadcastMessage("will have a duration of " .. config.timeToEnd .. " Minutes.", config.bcType)

setGlobalStorageValue(stor.WoeTime, 1)

else

doPlayerSendCancel(cid, "WoE is already running.")

end

elseif param == "off" then

if Woe.isTime() == true then

doBroadcastMessage("WoE was canceled...", config.bcType)

setGlobalStorageValue(stor.WoeTime, 0)

setGlobalStorageValue(stor.Started, 0)

if isCreature(getThingFromPos(Castle.empePos).uid) == TRUE then

doRemoveCreature(getThingFromPos(Castle.empePos).uid)

end

if getThingFromPos(Castle.desde).itemid > 0 then

doRemoveItem(getThingFromPos(Castle.desde).uid)

end

Woe.removePre()

Woe.removePortals()

else

doPlayerSendCancel(cid, "WoE is not running.")

end

elseif param == "empe" then

doSummonCreature("empe", Castle.empePos)

elseif param == "go" then

local newPos = Castle.empePos

newPos.y = newPos.y + 1

doTeleportThing(cid, newPos, FALSE)

elseif param == "info" then

doPlayerPopupFYI(cid, text)

else

doPlayerSendCancel(cid, "not valid param.")

end

elseif getPlayerAccess(cid) < config.accessToStar then

if param == "info" then

doPlayerPopupFYI(cid, text)

end

else

doPlayerSendCancel(cid, "not possible.")

end

elseif words == "!recall" then

if Woe.isStarted() == true then

if getPlayerGuildLevel(cid) == GUILDLEVEL_LEADER then

if Woe.isInCastle(cid) == true then

local members = Woe.getGuildMembers(getPlayerGuildId(cid))

if #members > 1 then

if (exhaust (cid, stor.recall, config.recallTime) == 1) then

for _, i in ipairs(members) do

if getPlayerGuildLevel(i) ~= GUILDLEVEL_LEADER then

local pos = getClosestFreeTile(cid, getCreaturePosition(cid), FALSE, TRUE)

doTeleportThing(i, pos, FALSE)

end

end

doCreatureSay(cid, "Emergency Recall", TALKTYPE_SAY)

else

doPlayerSendCancel(cid, "you can only use this every " .. config.recallTime / 60 .. " minutes.")

end

else

doPlayerSendCancel(cid, "no members online.")

end

else

doPlayerSendCancel(cid, "only can be used in the castle.")

end

else

doPlayerSendCancel(cid, "you are not the leader.")

end

else

doPlayerSendCancel(cid, "woe is not running.")

end

end

return true

end

 

 

 

Link para o comentário
Compartilhar em outros sites

  • 0

o Seu distro nao carrega funçoes "db.query" mude td para db.executeQuery , vc vai ter q fuçar em todos os scripts e dar control f e colocar execute, ai mude td para db.executeQuery

 

Abrç

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...