Ir para conteúdo

Featured Replies

Postado

 

Galera to usando esse script aki pra monitorar os trade que esta ocorrendo no meu servido mais esta com um erro aki podem me ajudar o erro é

 

[24/08/2018 19:15:29] [Error - CreatureEvent::configureEvent] No valid type for creature event.trade
[24/08/2018 19:15:29] [Warning - BaseEvents::loadFromXml] Cannot configure an event

 

o script e esse aki

Spoiler

local servers = {[0] = 'server1', [1] = 'server2', [2] = 'server3'}
 
local function getType(item)
    return (item.type > 0) and item.type or 1
end
 
Log = {}
Log.__index = Log
 
function Log.create()
    local t = {}
    setmetatable(t, Log)
    t.file = servers[getConfigValue("worldId")] .. "/" .. os.date("%B-%d-%Y", os.time()) .. ".txt"
    t.str, t.cstr, t.con = '', '', 0
    return t
end
 
function Log:write()
    local f = io.open("data/logs/trades/" .. self.file, "a+")
    if not f then return false end
    f:write(self.str)
    f:close()
end
 
function Log:containerString()
    self.cstr = ''
    for i = 1, self.con do
        self.cstr = self.cstr .. '-> '
    end
end
 
function Log:addContainer()
    self.con = self.con + 1
    self:containerString()
end
 
function Log:closeContainer()
    self.con = self.con - 1
    self:containerString()
end
 
function Log:setLine(txt)
    self.str = self.str .. self.cstr .. txt .. '\n'
end
 
function Log:kill()
    self.file, self.cstr, self.str, self.con = "", "", "", -1
end
 
function onTradeAccept(cid, target, item, targetItem)
    local this = Log.create()
    local name, tname = getCreatureName(cid), getCreatureName(target)
 
    this:setLine("Trade between " .. name .. " and " .. tname .. " || [" .. os.date("%d/%m/%Y %H:%M:%S") .. "]")
 
    local function logging(cid, item)
        this:setLine(getCreatureName(cid) .. " traded:")
        local function scanContainer(cid, uid)
            for k = (getContainerSize(uid) - 1), 0, -1 do
                local tmp = getContainerItem(uid, k)
                this:setLine(getItemNameById(tmp.itemid) .. " x " .. getType(tmp) .. " || itemid: " .. tmp.itemid)
                if isContainer(tmp.uid) then
                    this:addContainer()
                    scanContainer(cid, tmp.uid)
                    this:closeContainer()
                end
            end
        end
 
        this:setLine(getItemNameById(item.itemid) .. " x " .. getType(item) .. " || itemid: " .. item.itemid) 
        if isContainer(item.uid) then
            this:addContainer()
            scanContainer(cid, item.uid)
            this:closeContainer()
        end
    end
 
    logging(cid, item)
    logging(target, targetItem)
    this:setLine("END OF THIS TRADE --------------\n")
    this:write()
    this:kill()
    return true
end

 e a tag e essa aki

Spoiler

<event type="trade" name="tradeCheck" event="script" value="checktrades.lua"/>

e em login eu adcionei isso aki

 

Spoiler

registerCreatureEvent(cid, "tradeCheck")

 

mais o erro continua alguem pode ajudar?

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.9k

Informação Importante

Confirmação de Termo