Ir para conteúdo
  • Cadastre-se

Normal GUILDSHOP - TALKACTION BUGADO


Posts Recomendados

Galera, quando tento executar o comando !guildpoints pra adicionar os pontos na loja de guild no site da o seguinte erro na distro: 

alguém consegue me ajuda?

 

[26/9/2017 15:6:29] [Error - TalkAction Interface] 
[26/9/2017 15:6:29] data/talkactions/scripts/guildpoints.lua:onSay
[26/9/2017 15:6:30] Description: 
[26/9/2017 15:6:30] data/talkactions/scripts/guildpoints.lua:25: attempt to call global 'Player' (a nil value)
[26/9/2017 15:6:30] stack traceback:
[26/9/2017 15:6:30]     data/talkactions/scripts/guildpoints.lua:25: in function <data/talkactions/scripts/guildpoints.lua:24> 

 

TALKACTION-/-SCRIPTS-/-GUILDPOINTS.LUA

 

 

local config = {
        executeInterval = 24,
        minimumLevel = 70,
        membersNeeded = 7,
        minimumDifferentIps = 5,
        pointAmount = 10
}

local function getValidAccounts(guild)
        local resultId = db.storeQuery('SELECT a.`id` FROM `accounts` a, `guild_membership` m, `players` p WHERE m.`guild_id` = ' ..guild:getId() .. ' AND p.`id` = m.`player_id` AND p.`level` > ' ..  config.minimumLevel .. ' and a.`id` = p.`account_id` AND a.`guild_points_stats` = 0 GROUP BY a.`id`;')
        if resultId == false then
                return {}
        end

        local accounts = {}
        repeat
                table.insert(accounts, result.getDataInt(resultId, 'id'))
        until not result.next(resultId)
        result.free(resultId)

        return accounts
end

function onSay(cid, words, param)
        local player = Player(cid)
        local guild = player:getGuild()
        if not guild or player:getGuildLevel() ~= GUILDLEVEL_LEADER then
                player:getPosition():sendMagicEffect(CONST_ME_POFF)
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'Only guild leader can request points.')
                return false
        end

        local resultId = db.storeQuery('SELECT `last_execute_points` FROM `guilds` WHERE id = ' .. guild:getId())
        if resultId == false then
                player:getPosition():sendMagicEffect(CONST_ME_POFF)
                player:sendCancelMessage('Error while running database query.')
                return false
        end

        local lastExecution = result.getDataInt(resultId, 'last_execute_points')
        result.free(resultId)
        if lastExecution >= os.time() then
                player:getPosition():sendMagicEffect(CONST_ME_POFF)
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'The command can only be run once every ' ..config.executeInterval .. ' hours.')
                return false
        end

        local members = guild:getMembersOnline()
        for i = #members, 1, -1 do
                if members:getLevel() < config.minimumLevel then
                        table.remove(members, i)
                end
        end

        if #members < config.membersNeeded then
                player:getPosition():sendMagicEffect(CONST_ME_POFF)
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'Only ' .. #members .. ' guild members online, you need ' ..config.membersNeeded .. ' guild members with level ' .. config.minimumLevel .. ' or higher.')
                return false
        end

        local ipDictionary, ipCount = {}, 0
        for i = 1, #members do
                local ip = members:getIp()
                if not ipDictionary[ip] then
                        ipDictionary[ip] = true
                        ipCount = ipCount + 1
                end
        end

        if ipCount < config.minimumDifferentIps then
                player:getPosition():sendMagicEffect(CONST_ME_POFF)
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'Only ' .. ipCount .. ' members are valid, you need ' ..config.minimumDifferentIps .. ' players with different ip addresses.')
                return false
        end

        local validAccounts = getValidAccounts(guild)
        db.query('UPDATE `guilds` SET `last_execute_points` = ' .. (os.time() + config.executeInterval * 3600) .. ' WHERE `guilds`.`id` = ' .. guild:getId() .. ';')
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, #validAccounts .. ' guild members received points.')
        if #validAccounts > 0 then
                db.query('UPDATE `accounts` SET `guild_points` = `guild_points` + ' .. config.pointAmount .. ', `guild_points_stats` = ' .. os.time() .. ' WHERE `id` IN (' .. table.concat(validAccounts, ',') .. ');')
                for i = 1, #members do
                        local member = members
                        if isInArray(validAccounts, member:getAccountId()) then
                                member:sendTextMessage(MESSAGE_INFO_DESCR, 'You received ' .. config.pointAmount .. ' guild points.')
                        end
                end
        end
        return false
end

 

 

TALKACTIONS.XML

 

<talkaction words="!guildpoints" separator=" " script="guildpoints.lua"/>

Link para o post
Compartilhar em outros sites
5 minutos atrás, KotZletY disse:

@Vim Rusha qual a versão do seu servidor ?

Servidor 8.60 / OTX 1.2 / 

Link para o post
Compartilhar em outros sites

@Vim Rusha 

Spoiler

local config = {
        executeInterval = 24,
        minimumLevel = 70,
        membersNeeded = 7,
        minimumDifferentIps = 5,
        pointAmount = 10
}
local function getValidAccounts(guild)
        local resultId = db.storeQuery('SELECT a.`id` FROM `accounts` a, `guild_membership` m, `players` p WHERE m.`guild_id` = ' ..guild:getId() .. ' AND p.`id` = m.`player_id` AND p.`level` > ' ..  config.minimumLevel .. ' and a.`id` = p.`account_id` AND a.`guild_points_stats` = 0 GROUP BY a.`id`;')
        if resultId == false then
                return {}
        end
        local accounts = {}
        repeat
                table.insert(accounts, result.getDataInt(resultId, 'id'))
        until not result.next(resultId)
        result.free(resultId)
        return accounts
end
function onSay(player, words, param)
        local guild = player:getGuild()
        if not guild or player:getGuildLevel() ~= GUILDLEVEL_LEADER then
                player:getPosition():sendMagicEffect(CONST_ME_POFF)
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'Only guild leader can request points.')
                return false
        end
        local resultId = db.storeQuery('SELECT `last_execute_points` FROM `guilds` WHERE id = ' .. guild:getId())
        if resultId == false then
                player:getPosition():sendMagicEffect(CONST_ME_POFF)
                player:sendCancelMessage('Error while running database query.')
                return false
        end
        local lastExecution = result.getDataInt(resultId, 'last_execute_points')
        result.free(resultId)
        if lastExecution >= os.time() then
                player:getPosition():sendMagicEffect(CONST_ME_POFF)
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'The command can only be run once every ' ..config.executeInterval .. ' hours.')
                return false
        end
        local members = guild:getMembersOnline()
        for i = #members, 1, -1 do
                if members:getLevel() < config.minimumLevel then
                        table.remove(members, i)
                end
        end
        if #members < config.membersNeeded then
                player:getPosition():sendMagicEffect(CONST_ME_POFF)
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'Only ' .. #members .. ' guild members online, you need ' ..config.membersNeeded .. ' guild members with level ' .. config.minimumLevel .. ' or higher.')
                return false
        end
        local ipDictionary, ipCount = {}, 0
        for i = 1, #members do
                local ip = members:getIp()
                if not ipDictionary[ip] then
                        ipDictionary[ip] = true
                        ipCount = ipCount + 1
                end
        end
        if ipCount < config.minimumDifferentIps then
                player:getPosition():sendMagicEffect(CONST_ME_POFF)
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'Only ' .. ipCount .. ' members are valid, you need ' ..config.minimumDifferentIps .. ' players with different ip addresses.')
                return false
        end
        local validAccounts = getValidAccounts(guild)
        db.query('UPDATE `guilds` SET `last_execute_points` = ' .. (os.time() + config.executeInterval * 3600) .. ' WHERE `guilds`.`id` = ' .. guild:getId() .. ';')
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, #validAccounts .. ' guild members received points.')
        if #validAccounts > 0 then
                db.query('UPDATE `accounts` SET `guild_points` = `guild_points` + ' .. config.pointAmount .. ', `guild_points_stats` = ' .. os.time() .. ' WHERE `id` IN (' .. table.concat(validAccounts, ',') .. ');')
                for i = 1, #members do
                        local member = members
                        if isInArray(validAccounts, member:getAccountId()) then
                                member:sendTextMessage(MESSAGE_INFO_DESCR, 'You received ' .. config.pointAmount .. ' guild points.')
                        end
                end
        end
        return false
end

 

 

                                                              ezgif-1-98aab239f3.gif.1a897c9c3225228909e7b356a5cfb8e4.gif

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Conteúdo Similar

    • Por Jaurez
      .
    • Por Cat
      Em alguns casos, o tibia 8.60 comum não abre de jeito nenhum no map editor, mesmo desmarcando check file signatures e configurando o path corretamente.
       
      Este é o client 8.60 adaptado para o Remere's Map Editor. Resolvi postar já que ele foi removido do site oficial do RME. (ficou apenas a versão para linux lá)
      Se estiver tendo problemas para abrir a versão 8.60, tente utilizar este.
                                                                                                                     
      Baixar o Tibia Client 8.60 que funciona no Remere’s Map Editor
      Essa versão do Tibia 8.60 client resolve o erro unsupported client version ou Could not locate tibia.dat and/or tibia.spr, please navigate to your tibia 8.60 installation folder.
       
      Downloads
      https://tibiaking.com/applications/core/interface/file/attachment.php?id=47333

      Scan: https://www.virustotal.com/gui/file/333e172ac49ba2028db9eb5889994509e7d2de28ebccfa428c04e86defbe15cc
       
    • Por danilo belato
      Fala Galera To Com um problema aki 
       
      quero exporta umas sprites de um server para colocar em outro 
       
      eu clico na sprites ai aparece tds a forma delas do lado de la >>
       
      ai eu clico nela e ponho a opiçao de export mais quando salvo a sprite ela n abri 
       
      aparece isso quando tento vê-la 
       
      visualização não disponível ( no formatos png e bitmap)
       
      Agora no formato idc fala que o paint n pode ler 
       
      me ajudem ae...
    • Por Vitor Bicaleto
      Galera to com o script do addon doll aqui, quando eu digito apenas "!addon" ele aparece assim: Digite novamente, algo está errado!"
      quando digito por exemplo: "!addon citizen" ele não funciona e não da nenhum erro
       
      mesma coisa acontece com o mount doll.. 
    • Por Ayron5
      Substitui uma stone no serve, deu tudo certo fora  esse  erro ajudem  Valendo  Rep+  Grato  

      Erro: data/actions/scripts/boost.lua:557: table index is nil
       [Warning - Event::loadScript] Cannot load script (data/actions/scripts/boost.lua)

      Script:
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo