Ir para conteúdo
  • Cadastre-se

Posts Recomendados

uso em otserv 10,99

 

error:

Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/gwarabsolute.lua:onSay
data/talkactions/scripts/gwarabsolute.lua:12: attempt to compare number with nil
stack traceback:
        [C]: in function '__lt'
        data/talkactions/scripts/gwarabsolute.lua:12: in function <data/talkactions/scripts/gwarabsolute.lua:1>

 

gwarabsolute.lua

function onSay(cid, words, param)
 
        local player = Player(cid)
        local guild = player:getGuild()

        if(guild == nil) then
                player:sendCancelMessage("You need to be in a guild in order to execute this talkaction.")
                return false
        end
 
        local guild = getPlayerGuildId(cid)
        if not guild or getPlayerGuildLevel(cid) < GUILDLEVEL_LEADER then
                player:sendCancelMessage("You cannot execute this talkaction.")
                return false
        end
 
        local t = string.split(param, ",")
        if(not t[2]) then      
                player:sendChannelMessage("", "Not enough param(s).", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                return false
        end
 
        local enemy = getGuildId(t[2])
        if(not enemy) then
                player:sendChannelMessage("", "Guild \"" .. t[2] .. "\" does not exists.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                return false
        end
 
        if(enemy == guild) then
                player:sendChannelMessage("", "You cannot perform war action on your own guild.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                return false
        end
 
        local enemyName, tmp = "", db.storeQuery("SELECT `name` FROM `guilds` WHERE `id` = " .. enemy)
        if tmp ~= false then
                enemyName = result.getDataString(tmp, "name")
                result.free(tmp)
        end
 
        if(isInArray({"accept", "reject", "cancel"}, t[1])) then
                local query = "`guild1` = " .. enemy .. " AND `guild2` = " .. guild
                if(t[1] == "cancel") then
                        query = "`guild1` = " .. guild .. " AND `guild2` = " .. enemy
                end
 
                tmp = db.storeQuery("SELECT `id`, `started`, `ended`, `payment` FROM `guild_wars` WHERE " .. query .. " AND `status` = 0")
                if(tmp == false) then
                        player:sendChannelMessage("", "Currently there's no pending invitation for a war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                        return false
                end
 
                if(t[1] == "accept") then
                        local _tmp = db.storeQuery("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild)
                        local state = result.getDataInt(_tmp, "balance") < result.getDataInt(tmp, "payment")
 
                        result.free(_tmp)
                        if(state) then
                                player:sendChannelMessage("", "Your guild balance is too low to accept this invitation.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                return false
                        end
 
                        db.query("UPDATE `guilds` SET `balance` = `balance` - " .. result.getDataInt(tmp, "payment") .. " WHERE `id` = " .. guild)
                end
 
                query = "UPDATE `guild_wars` SET "
                local msg = "accepted " .. enemyName .. " invitation to war."
                if(t[1] == "reject") then
                        query = query .. "`ended` = " .. os.time() .. ", `status` = 2"
                        msg = "rejected " .. enemyName .. " invitation to war."
                elseif(t[1] == "cancel") then
                        query = query .. "`ended` = " .. os.time() .. ", `status` = 3"
                        msg = "canceled invitation to a war with " .. enemyName .. "."
                else
                        query = query .. "`started` = " .. os.time() .. ", `ended` = " .. (result.getDataInt(tmp, "ended") > 0 and (os.time() + ((result.getDataInt(tmp, "started") - result.getDataInt(tmp, "ended")) / 86400)) or 0) .. ", `status` = 1"
                end
 
                query = query .. " WHERE `id` = " .. result.getDataInt(tmp, "id")
                result.free(tmp)
                db.query(query)
                broadcastMessage(getPlayerGuildName(cid) .. " has " .. msg, MESSAGE_EVENT_ADVANCE)
                return false
        end
 
        if(t[1] == "invite") then
                local str = ""
                tmp = db.storeQuery("SELECT `guild1`, `status` FROM `guild_wars` WHERE `guild1` IN (" .. guild .. "," .. enemy .. ") AND `guild2` IN (" .. enemy .. "," .. guild .. ") AND `status` IN (0, 1)")
        if(tmp ~= false) then
                       
                        if(result.getDataInt(tmp, "status") == 0) then
                                if(result.getDataInt(tmp, "guild1") == guild) then
                                        str = "You have already invited " .. enemyName .. " to war."
                                else
                                        str = enemyName .. " have already invited you to war."
                                end
                        else
                                str = "You are already on a war with " .. enemyName .. "."
                        end
 
                        result.free(tmp)
                end
 
                if(str ~= "") then
                        player:sendChannelMessage("", str, TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                        return false
                end
 
                local frags = tonumber(t[3])
                if(frags ~= nil) then
                        frags = math.max(10, math.min(1000, frags))
                else
                        frags = 100
                end
 
                local payment = tonumber(t[4])
                if(payment ~= nil) then
                        payment = math.floor(payment)+1000
                        tmp = db.storeQuery("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild)
 
                        local state = result.getDataInt(tmp, "balance") < payment
                        result.free(tmp)
                        if(state) then
                                player:sendChannelMessage("", "Your guild balance is too low for such payment.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                return false
                        end
 
                        db.query("UPDATE `guilds` SET `balance` = `balance` - " .. payment .. " WHERE `id` = " .. guild)
                else
                        payment = 0
                end
 
                local begining, ending = os.time(), tonumber(t[5])
                if(ending ~= nil and ending ~= 0) then
                        ending = begining + (ending * 86400)
                else
                        ending = 0
                end
 
                db.query("INSERT INTO `guild_wars` (`guild1`, `guild2`, `started`, `ended`, `frags`, `payment`) VALUES (" .. guild .. ", " .. enemy .. ", " .. begining .. ", " .. ending .. ", " .. frags .. ", " .. payment .. ");")
                broadcastMessage(getPlayerGuildName(cid) .. " has invited " .. enemyName .. " to war till " .. frags .. " frags.", MESSAGE_EVENT_ADVANCE)
                return false
        end
 
        if(not isInArray({"end", "finish"}, t[1])) then
                return false
        end
 
        local status = (t[1] == "end" and 1 or 4)
        tmp = db.storeQuery("SELECT `id` FROM `guild_wars` WHERE `guild1` = " .. guild .. " AND `guild2` = " .. enemy .. " AND `status` = " .. status)
        if(tmp ~= false) then
                local query = "UPDATE `guild_wars` SET `ended` = " .. os.time() .. ", `status` = 5 WHERE `id` = " .. result.getDataInt(tmp, "id")
                result.free(tmp)
 
                db.query(query)
                broadcastMessage(getPlayerGuildName(cid) .. " has " .. (status == 4 and "mend fences" or "ended up a war") .. " with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE)
                return false
        end
 
        if(status == 4) then
                player:sendChannelMessage("", "Currently there's no pending war truce from " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                return false
        end
 
        tmp = db.storeQuery("SELECT `id`, `ended` FROM `guild_wars` WHERE `guild1` = " .. enemy .. " AND `guild2` = " .. guild .. " AND `status` = 1")
        if(tmp ~= false) then
                if(result.getDataInt(tmp, "ended") > 0) then
                        result.free(tmp)
                        player:sendChannelMessage("", "You cannot request ending for war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                        return false
                end
 
                local query = "UPDATE `guild_wars` SET `status` = 4, `ended` = " .. os.time() .. " WHERE `id` = " .. result.getDataInt(tmp, "id")
                result.free(tmp)
 
                db.query(query)
                broadcastMessage(getPlayerGuildName(cid) .. " has signed an armstice declaration on a war with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE)
                return false
        end
       
        player:sendChannelMessage("", "Currently there's no active war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
        return false
end

 

ai eu tirei essa parte : getPlayerGuildLevel(cid) < GUILDLEVEL_LEADER 
então o error saiu, mas ai qualquer player vai declarar guerra, então não tem como tirar ..

testei sem essa parte, e na hora de de clarar war da que a guild não existe ...

Link para o post
Compartilhar em outros sites

tenta trocar essa parte

 

function onSay(cid, words, param)
 
        local player = Player(cid)
        local guild = player:getGuild()

        if(guild == nil) then
                player:sendCancelMessage("You need to be in a guild in order to execute this talkaction.")
                return false
        end
 
        local guild = getPlayerGuildId(cid)
        if not guild or getPlayerGuildLevel(cid) < GUILDLEVEL_LEADER then
                player:sendCancelMessage("You cannot execute this talkaction.")
                return false
        end

 

por

 

function onSay(player, words, param)
        local Myguild = player:getGuild()
        if not Myguild or Myguild:getId() == 0 then
                player:sendCancelMessage("You need to be in a guild in order to execute this talkaction.")
                return false
        end
	local guild = Myguild:getId()
        if player:getGuildLevel() < GUILDLEVEL_LEADER then
                player:sendCancelMessage("You cannot execute this talkaction.")
                return false
        end

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

@Vodkart

Citar

Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/gwarabsolute.lua:onSay
data/talkactions/scripts/gwarabsolute.lua:8: attempt to compare number with nil
stack traceback:
        [C]: in function '__lt'
        data/talkactions/scripts/gwarabsolute.lua:8: in function <data/talkactions/scripts/gwarabsolute.lua:1>

 

Line 8 :         if player:getGuildLevel() < GUILDLEVEL_LEADER then

 

versão de compilação :

Citar

The OTX Server Version: (3.8 . DEV) - Codename: ( LEZICK )
Compiled with: Microsoft Visual C++ version 14.0
Compiled on Dec 11 2016 14:56:07 for platform x64

 

Editado por Tiago6795 (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

acho que não existe mais a variável na lib

 

tenta assim

 

if player:getGuildLevel() < 3 then

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

@Vodkart

 

agora foi ! porem da outro erro, do o comando e aparece :

 

10:42 Guild " Noobs" does not exists.

 

testei com 2 guilds, da o mesmo error ...

 

creio eu que é no select, não ? 

 

Citar

        local enemyName, tmp = "", db.storeQuery("SELECT `name` FROM `guilds` WHERE `id` = " .. enemy)
        if tmp ~= false then
                enemyName = result.getDataString(tmp, "name")
                result.free(tmp)
        end

 

a variavel enemy guarda o id da guild certo ? não sei se está errado o metodo getGuildId(t[2])

 

Citar

        local enemy = getGuildId(t[2])
        if(not enemy) then
                player:sendChannelMessage("", "Guild \"" .. t[2] .. "\" does not exists.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                return false
        end

 

@edit

@Vodkart

 

Obrigado, eu coloquei o system de invite pelo site e deu certo, agradeço por me ajudar a tirar esse bug, pode servir para outras pessoas, utilizei este link para adicionar pelo site : https://otland.net/threads/gesior2012-wars-on-www-tfs-1-0-only-beta-version.209357/

 

obrigado desde já ! rep +

Editado por Tiago6795 (veja o histórico de edições)
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:
  • Estatísticas dos Fóruns

    96851
    Tópicos
    519616
    Posts
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo