Ir para conteúdo
  • Cadastre-se

(Resolvido)[RESOLVIDO] [SQLite] -=[TFS]=- [TALKACTION] - 0.4 8.60 Advanced Poll System AJUDA SOCORRO


Ir para solução Resolvido por Muvukaa,

Posts Recomendados

error em todos os comandos.
[13/03/2024 15:38:53] data/talkactions/scripts/pollsystem.lua:onSay
[13/03/2024 15:38:53] Description: 
[13/03/2024 15:38:53] data/talkactions/scripts/pollsystem.lua:15: attempt to call field 'unserialize' (a nil value)
[13/03/2024 15:38:53] stack traceback:
[13/03/2024 15:38:53] 	data/talkactions/scripts/pollsystem.lua:15: in function 'getMostVotedOption'
[13/03/2024 15:38:53] 	data/talkactions/scripts/pollsystem.lua:103: in function <data/talkactions/scripts/pollsystem.lua:27>

 

 

 

local POLL_STORAGE = 80000
local OPTIONS_STORAGE = 80001
local PLAYER_STORAGE = 80000

local function getTotalVotes()
   local options = table.unserialize(getStorage(OPTIONS_STORAGE))
   local amount = 0
   for _, option in ipairs(options) do
       amount = amount + option[2]
   end
   return amount
end

local function getMostVotedOption()
   local options = table.unserialize(getStorage(OPTIONS_STORAGE))
   local value, ret = 0
   for _, option in ipairs(options) do
       if option[2] > value then
           value = option[2]
           ret = option[1]
       end
   end
   return ret
end


function onSay(cid, words, param, channel)
   param = param or ""

   if param == "" and not words == "/poll" then
       return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The command ".. words .." need parameters.")
   end

   local parameters, vote = {}
   if(words == "/newpoll") then
       if getStorage(POLL_STORAGE) ~= -1 then
           return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, but there is a poll in progress.\nIf you want to start a new poll, type /endpoll.")
       end

       parameters = string.explode(param, ",")
       if #parameters < 3 then
           return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The command /newpoll needs a poll and at least two options.")
       end

       if parameters[1] then
           local options = {}
           for i = 2, #parameters do
               table.insert(options, {parameters[i], 0})
           end

           if #options < 2 then
               return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Insert at least two options after the poll")
           end
           doSetStorage(POLL_STORAGE, parameters[1])
           options = table.serialize(options)
           doSetStorage(OPTIONS_STORAGE, options)
           doBroadcastMessage("A new poll is in progress with the title '".. getStorage(POLL_STORAGE) .."?'!\nSee the status with /poll and vote with /vote.")
       end
   elseif(words == "/vote") then
       vote = tonumber(param) or -1
       local options = table.unserialize(getStorage(OPTIONS_STORAGE))
       if getStorage(POLL_STORAGE) == -1 then
           return doPlayerSendCancel(cid, "There is not a poll in progress.")
       end

       if vote == -1 then
           return doPlayerSendCancel(cid, "You need to choose a option to vote.")
       end

       if getCreatureStorage(cid, PLAYER_STORAGE) == 1 then
               print(getCreatureStorage(cid, PLAYER_STORAGE))
           return doPlayerSendCancel(cid, "You cannot vote two times.")
       end



       if vote > #options then
           return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
       end

       options[vote][2] = options[vote][2] + 1
       doSetStorage(OPTIONS_STORAGE, table.serialize(options))
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have voted in the option ".. options[vote][1] .." successfully!")
       doCreatureSetStorage(cid, PLAYER_STORAGE, 1)
   elseif(words == "/poll") then
       local options = table.unserialize(getStorage(OPTIONS_STORAGE))
       if getStorage(POLL_STORAGE) == -1 then
           return doPlayerSendCancel(cid, "There is not a poll in progress.")
       end

       local text = "ADVANCED poll SYSTEM\n\n".. getStorage(POLL_STORAGE) .."?\n"
       local count = 1
       for _, option in ipairs(options) do
           text = text .."\n#".. count .."   ".. option[1] .."   ".. (getTotalVotes() == 0 and 0 or math.floor((option[2]/getTotalVotes()) * 100)) .."%\n"
           count = count + 1
       end
       doPlayerPopupFYI(cid, text)
   elseif(words == "/endpoll") then
       if getStorage(POLL_STORAGE) == -1 then
           return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "There is not a poll to be ended.")
       end

       if not getMostVotedOption() then
           return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wait at least one vote to end this poll.")
       end
       doBroadcastMessage("The poll '".. getStorage(POLL_STORAGE) .."?' has been finished!\nThe most voted option was ".. getMostVotedOption() ..".")
       doSetStorage(POLL_STORAGE, -1)
       doSetStorage(OPTIONS_STORAGE, -1)
       for _, player in ipairs(getPlayersOnline()) do
           doCreatureSetStorage(player, PLAYER_STORAGE, -1)
       end

       db.executeQuery("UPDATE `player_storage` SET value = -1 WHERE `key` = ".. PLAYER_STORAGE ..";")
   end
   return true
end

 

Editado por Muvukaa (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
local POLL_STORAGE = 80000
local OPTIONS_STORAGE = 80001
local PLAYER_STORAGE = 80000

local function unserialize(s)
    local func = loadstring("return " .. s)
    if func then
        return func()
    else
        return nil, "unserialize error: string could not be deserialized."
    end
end

local function getTotalVotes()
   local options, err = unserialize(getStorage(OPTIONS_STORAGE))
   if not options then
       error(err)
   end
   local amount = 0
   for _, option in ipairs(options) do
       amount = amount + option[2]
   end
   return amount
end

local function getMostVotedOption()
   local options, err = unserialize(getStorage(OPTIONS_STORAGE))
   if not options then
       error(err)
   end
   local value, ret = 0
   for _, option in ipairs(options) do
       if option[2] > value then
           value = option[2]
           ret = option[1]
       end
   end
   return ret
end

function onSay(cid, words, param, channel)
   param = param or ""

   if param == "" and not words == "/poll" then
       return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The command ".. words .." need parameters.")
   end

   local parameters, vote = {}
   if(words == "/newpoll") then
       if getStorage(POLL_STORAGE) ~= -1 then
           return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, but there is a poll in progress.\nIf you want to start a new poll, type /endpoll.")
       end

       parameters = string.explode(param, ",")
       if #parameters < 3 then
           return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The command /newpoll needs a poll and at least two options.")
       end

       if parameters[1] then
           local options = {}
           for i = 2, #parameters do
               table.insert(options, {parameters[i], 0})
           end

           if #options < 2 then
               return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Insert at least two options after the poll")
           end
           doSetStorage(POLL_STORAGE, parameters[1])
           options = table.serialize(options)
           doSetStorage(OPTIONS_STORAGE, options)
           doBroadcastMessage("A new poll is in progress with the title '".. getStorage(POLL_STORAGE) .."?'!\nSee the status with /poll and vote with /vote.")
       end
   elseif(words == "/vote") then
       vote = tonumber(param) or -1
       local options, err = unserialize(getStorage(OPTIONS_STORAGE))
       if not options then
           error(err)
       end

       if getStorage(POLL_STORAGE) == -1 then
           return doPlayerSendCancel(cid, "There is not a poll in progress.")
       end

       if vote == -1 then
           return doPlayerSendCancel(cid, "You need to choose a option to vote.")
       end

       if getCreatureStorage(cid, PLAYER_STORAGE) == 1 then
           return doPlayerSendCancel(cid, "You cannot vote two times.")
       end

       if vote > #options then
           return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
       end

       options[vote][2] = options[vote][2] + 1
       doSetStorage(OPTIONS_STORAGE, table.serialize(options))
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have voted in the option ".. options[vote][1] .." successfully!")
       doCreatureSetStorage(cid, PLAYER_STORAGE, 1)
   elseif(words == "/poll") then
       local options, err = unserialize(getStorage(OPTIONS_STORAGE))
       if not options then
           error(err)
       end

       if getStorage(POLL_STORAGE) == -1 then
           return doPlayerSendCancel(cid, "There is not a poll in progress.")
       end

       local text = "ADVANCED poll SYSTEM\n\n".. getStorage(POLL_STORAGE) .."?\n"
       local count = 1
       for _, option in ipairs(options) do
           text = text .."\n#".. count .."   ".. option[1] .."   ".. (getTotalVotes() == 0 and 0 or math.floor((option[2]/getTotalVotes()) * 100)) .."%\n"
           count = count + 1
       end
       doPlayerPopupFYI(cid, text)
   elseif(words == "/endpoll") then
       if getStorage(POLL_STORAGE) == -1 then
           return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "There is not a poll to be ended.")
       end

       if not getMostVotedOption() then
           return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wait at least one vote to end this poll.")
       end
       doBroadcastMessage("The poll '".. getStorage(POLL_STORAGE) .."?' has been finished!\nThe most voted option was ".. getMostVotedOption() ..".")
       doSetStorage(POLL_STORAGE, -1)
       doSetStorage(OPTIONS_STORAGE, -1)
       for _, player in ipairs(getPlayersOnline()) do
           doCreatureSetStorage(player, PLAYER_STORAGE, -1)
       end

       db.executeQuery("UPDATE `player_storage` SET value = -1 WHERE `key` = ".. PLAYER_STORAGE ..";")
   end
   return true
end

 

Link para o post
Compartilhar em outros sites

Não pego esses comandos no seu script Mateus Robeerto

 

/endpoll

 

[14/03/2024 11:33:46] [Error - TalkAction Interface] 
[14/03/2024 11:33:46] data/talkactions/scripts/pollsystem.lua:onSay
[14/03/2024 11:33:46] Description: 
[14/03/2024 11:33:46] data/talkactions/scripts/pollsystem.lua:32: bad argument #1 to 'ipairs' (table expected, got number)
[14/03/2024 11:33:46] stack traceback:
[14/03/2024 11:33:46]     [C]: in function 'ipairs'
[14/03/2024 11:33:46]     data/talkactions/scripts/pollsystem.lua:32: in function 'getMostVotedOption'
[14/03/2024 11:33:46]     data/talkactions/scripts/pollsystem.lua:122: in function <data/talkactions/scripts/pollsystem.lua:41>

 

/poll

 

[14/03/2024 11:33:47] [Error - TalkAction Interface] 
[14/03/2024 11:33:47] data/talkactions/scripts/pollsystem.lua:onSay
[14/03/2024 11:33:47] Description: 
[14/03/2024 11:33:47] data/talkactions/scripts/pollsystem.lua:112: bad argument #1 to 'ipairs' (table expected, got number)
[14/03/2024 11:33:47] stack traceback:
[14/03/2024 11:33:47]     [C]: in function 'ipairs'
[14/03/2024 11:33:47]     data/talkactions/scripts/pollsystem.lua:112: in function <data/talkactions/scripts/pollsystem.lua:41>

 

@Mateus Robeerto

Editado por Muvukaa (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • Muvukaa mudou o título para [SQLite] -=[TFS]=- [TALKACTION] - 0.4 8.60 Advanced Poll System AJUDA SOCORRO
  • Sub-Admin
local POLL_STORAGE = 80000
local OPTIONS_STORAGE = 80001
local PLAYER_STORAGE = 80000

local function getTotalVotes()
   local options = table.unserialize(getStorage(OPTIONS_STORAGE))
   local amount = 0
   for _, option in ipairs(options) do
       amount = amount + option[2]
   end
   return amount
end

local function getMostVotedOption()
   local options = table.unserialize(getStorage(OPTIONS_STORAGE))
   local value, ret = 0, {} -- Inicialize ret as an empty table
   for _, option in ipairs(options) do
       if option[2] > value then
           value = option[2]
           ret = {option[1]} -- Wrap option[1] in a table
       elseif option[2] == value then
           table.insert(ret, option[1]) -- Add option[1] to ret if it has the same value as the current max
       end
   end
   return ret
end

function onSay(cid, words, param, channel)
   param = param or ""

   if param == "" and not words == "/poll" then
       return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The command ".. words .." need parameters.")
   end

   local parameters, vote = {}
   if(words == "/newpoll") then
       if getStorage(POLL_STORAGE) ~= -1 then
           return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, but there is a poll in progress.\nIf you want to start a new poll, type /endpoll.")
       end

       parameters = string.explode(param, ",")
       if #parameters < 3 then
           return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The command /newpoll needs a poll and at least two options.")
       end

       if parameters[1] then
           local options = {}
           for i = 2, #parameters do
               table.insert(options, {parameters[i], 0})
           end

           if #options < 2 then
               return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Insert at least two options after the poll")
           end
           doSetStorage(POLL_STORAGE, parameters[1])
           options = table.serialize(options)
           doSetStorage(OPTIONS_STORAGE, options)
           doBroadcastMessage("A new poll is in progress with the title '".. getStorage(POLL_STORAGE) .."?'!\nSee the status with /poll and vote with /vote.")
       end
   elseif(words == "/vote") then
       vote = tonumber(param) or -1
       local options = table.unserialize(getStorage(OPTIONS_STORAGE))
       if getStorage(POLL_STORAGE) == -1 then
           return doPlayerSendCancel(cid, "There is not a poll in progress.")
       end

       if vote == -1 then
           return doPlayerSendCancel(cid, "You need to choose a option to vote.")
       end

       if getCreatureStorage(cid, PLAYER_STORAGE) == 1 then
               print(getCreatureStorage(cid, PLAYER_STORAGE))
           return doPlayerSendCancel(cid, "You cannot vote two times.")
       end

       if vote > #options then
           return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
       end

       options[vote][2] = options[vote][2] + 1
       doSetStorage(OPTIONS_STORAGE, table.serialize(options))
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have voted in the option ".. options[vote][1] .." successfully!")
       doCreatureSetStorage(cid, PLAYER_STORAGE, 1)
   elseif(words == "/poll") then
       local options = table.unserialize(getStorage(OPTIONS_STORAGE))
       if getStorage(POLL_STORAGE) == -1 then
           return doPlayerSendCancel(cid, "There is not a poll in progress.")
       end

       local text = "ADVANCED poll SYSTEM\n\n".. getStorage(POLL_STORAGE) .."?\n"
       local count = 1
       for _, option in ipairs(options) do
           text = text .."\n#".. count .."   ".. option[1] .."   ".. (getTotalVotes() == 0 and 0 or math.floor((option[2]/getTotalVotes()) * 100)) .."%\n"
           count = count + 1
       end
       doPlayerPopupFYI(cid, text)
   elseif(words == "/endpoll") then
       if getStorage(POLL_STORAGE) == -1 then
           return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "There is not a poll to be ended.")
       end

       if not getMostVotedOption() then
           return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wait at least one vote to end this poll.")
       end
       local mostVotedOptions = getMostVotedOption()
       local mostVotedText = table.concat(mostVotedOptions, ", ")
       doBroadcastMessage("The poll '".. getStorage(POLL_STORAGE) .."?' has been finished!\nThe most voted option(s) was/were: ".. mostVotedText ..".")
       doSetStorage(POLL_STORAGE, -1)
       doSetStorage(OPTIONS_STORAGE, -1)
       for _, player in ipairs(getPlayersOnline()) do
           doCreatureSetStorage(player, PLAYER_STORAGE, -1)
       end

       db.executeQuery("UPDATE `player_storage` SET value = -1 WHERE `key` = ".. PLAYER_STORAGE ..";")
   end
   return true
end

 

function table.unserialize(str)
    if type(str) ~= 'string' or str:len() == 0 then
        return {}
    end

    local f = load("return " .. str)
    if f then
        return f()
    else
        return {}
    end
end

 

 

20230912_034613.png.cf49b650c34dd7d7b1f79bd49c70f53c.png

Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código.  #OpenSource #Programação #Contribuição

 

Link para o post
Compartilhar em outros sites

OLHA COMO FICA NO SEU SCRIPT LEKOT Screenshot_3.png.ca8e02c5c5f43981dbafa3ba42088d76.png

 

OLHA DO ONESHOT

Screenshot_4.png.36cc89101d7a73afa2e09562565d6030.png

aparece isso quando uso comando /newpoll

 

[15/03/2024 03:33:50] [Error - TalkAction Interface] 
[15/03/2024 03:33:50] data/talkactions/scripts/pollsystem.lua:onSay
[15/03/2024 03:33:50] Description: 
[15/03/2024 03:33:50] data/talkactions/scripts/pollsystem.lua:56: attempt to call field 'serialize' (a nil value)
[15/03/2024 03:33:50] stack traceback:
[15/03/2024 03:33:50]     data/talkactions/scripts/pollsystem.lua:56: in function <data/talkactions/scripts/pollsystem.lua:28>

 

Link para o post
Compartilhar em outros sites
  • Sub-Admin
local POLL_STORAGE = 80000
local OPTIONS_STORAGE = 80001
local PLAYER_STORAGE = 80000

function table.serialize(tbl)
    local str = "{"
    local sep = ""
    for k, v in pairs(tbl) do
        str = str .. sep
        if type(k) == "number" then
            str = str .. "[" .. k .. "]"
        else
            str = str .. k
        end
        str = str .. "="
        if type(v) == "table" then
            str = str .. table.serialize(v)
        elseif type(v) == "number" or type(v) == "boolean" then
            str = str .. tostring(v)
        else
            str = str .. string.format("%q", v)
        end
        sep = ","
    end
    str = str .. "}"
    return str
end

local function getTotalVotes()
   local options = table.unserialize(getStorage(OPTIONS_STORAGE))
   local amount = 0
   for _, option in ipairs(options) do
       amount = amount + option[2]
   end
   return amount
end

local function getMostVotedOption()
   local options = table.unserialize(getStorage(OPTIONS_STORAGE))
   local value, ret = 0, {}
   for _, option in ipairs(options) do
       if option[2] > value then
           value = option[2]
           ret = {option[1]}
       elseif option[2] == value then
           table.insert(ret, option[1])
       end
   end
   return ret
end

function onSay(cid, words, param, channel)
   param = param or ""

   if param == "" and not words == "/poll" then
       return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The command ".. words .." need parameters.")
   end

   local parameters, vote = {}
   if(words == "/newpoll") then
       if getStorage(POLL_STORAGE) ~= -1 then
           return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, but there is a poll in progress.\nIf you want to start a new poll, type /endpoll.")
       end

       parameters = string.explode(param, ",")
       if #parameters < 3 then
           return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The command /newpoll needs a poll and at least two options.")
       end

       if parameters[1] then
           local options = {}
           for i = 2, #parameters do
               table.insert(options, {parameters[i], 0})
           end

           if #options < 2 then
               return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Insert at least two options after the poll")
           end
           doSetStorage(POLL_STORAGE, parameters[1])
           options = table.serialize(options)
           doSetStorage(OPTIONS_STORAGE, options)
           doBroadcastMessage("A new poll is in progress with the title '".. getStorage(POLL_STORAGE) .."?'!\nSee the status with /poll and vote with /vote.")
       end
   elseif(words == "/vote") then
       vote = tonumber(param) or -1
       local options = table.unserialize(getStorage(OPTIONS_STORAGE))
       if getStorage(POLL_STORAGE) == -1 then
           return doPlayerSendCancel(cid, "There is not a poll in progress.")
       end

       if vote == -1 then
           return doPlayerSendCancel(cid, "You need to choose a option to vote.")
       end

       if getCreatureStorage(cid, PLAYER_STORAGE) == 1 then
               print(getCreatureStorage(cid, PLAYER_STORAGE))
           return doPlayerSendCancel(cid, "You cannot vote two times.")
       end

       if vote > #options then
           return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
       end

       options[vote][2] = options[vote][2] + 1
       doSetStorage(OPTIONS_STORAGE, table.serialize(options))
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have voted in the option ".. options[vote][1] .." successfully!")
       doCreatureSetStorage(cid, PLAYER_STORAGE, 1)
   elseif(words == "/poll") then
       local options = table.unserialize(getStorage(OPTIONS_STORAGE))
       if getStorage(POLL_STORAGE) == -1 then
           return doPlayerSendCancel(cid, "There is not a poll in progress.")
       end

       local text = "ADVANCED poll SYSTEM\n\n".. getStorage(POLL_STORAGE) .."?\n"
       local count = 1
       for _, option in ipairs(options) do
           text = text .."\n#".. count .."   ".. option[1] .."   ".. (getTotalVotes() == 0 and 0 or math.floor((option[2]/getTotalVotes()) * 100)) .."%\n"
           count = count + 1
       end
       doPlayerPopupFYI(cid, text)
   elseif(words == "/endpoll") then
       if getStorage(POLL_STORAGE) == -1 then
           return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "There is not a poll to be ended.")
       end

       if not getMostVotedOption() then
           return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wait at least one vote to end this poll.")
       end
       local mostVotedOptions = getMostVotedOption()
       local mostVotedText = table.concat(mostVotedOptions, ", ")
       doBroadcastMessage("The poll '".. getStorage(POLL_STORAGE) .."?' has been finished!\nThe most voted option(s) was/were: ".. mostVotedText ..".")
       doSetStorage(POLL_STORAGE, -1)
       doSetStorage(OPTIONS_STORAGE, -1)
       for _, player in ipairs(getPlayersOnline()) do
           doCreatureSetStorage(player, PLAYER_STORAGE, -1)
       end

       db.executeQuery("UPDATE `player_storage` SET value = -1 WHERE `key` = ".. PLAYER_STORAGE ..";")
   end
   return true
end

 

 

20230912_034613.png.cf49b650c34dd7d7b1f79bd49c70f53c.png

Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código.  #OpenSource #Programação #Contribuição

 

Link para o post
Compartilhar em outros sites
  • Solução

EU CRIEI /newpoll e apareceu esses erros e a /newpoll eu criei apareceu mensagem vermelha mais comandos bugaram


 

/vote



[15/03/2024 08:27:16] [Error - TalkAction Interface] 
[15/03/2024 08:27:16] data/talkactions/scripts/pollsystem.lua:onSay
[15/03/2024 08:27:16] Description: 
[15/03/2024 08:27:16] data/lib/012-table.lua:6: bad argument #1 to 'load' (function expected, got string)
[15/03/2024 08:27:16] stack traceback:
[15/03/2024 08:27:16]     [C]: in function 'load'
[15/03/2024 08:27:16]     data/lib/012-table.lua:6: in function 'unserialize'
[15/03/2024 08:27:16]     data/talkactions/scripts/pollsystem.lua:86: in function <data/talkactions/scripts/pollsystem.lua:52>



/poll




[15/03/2024 08:26:20] [Error - TalkAction Interface] 
[15/03/2024 08:26:20] data/talkactions/scripts/pollsystem.lua:onSay
[15/03/2024 08:26:20] Description: 
[15/03/2024 08:26:20] data/lib/012-table.lua:6: bad argument #1 to 'load' (function expected, got string)
[15/03/2024 08:26:20] stack traceback:
[15/03/2024 08:26:20]     [C]: in function 'load'
[15/03/2024 08:26:20]     data/lib/012-table.lua:6: in function 'unserialize'
[15/03/2024 08:26:20]     data/talkactions/scripts/pollsystem.lua:39: in function 'getMostVotedOption'
[15/03/2024 08:26:20]     data/talkactions/scripts/pollsystem.lua:126: in function <data/talkactions/scripts/pollsystem.lua:52>





/endpoll

[15/03/2024 08:26:26] [Error - TalkAction Interface] 
[15/03/2024 08:26:26] data/talkactions/scripts/pollsystem.lua:onSay
[15/03/2024 08:26:26] Description: 
[15/03/2024 08:26:26] data/lib/012-table.lua:6: bad argument #1 to 'load' (function expected, got string)
[15/03/2024 08:26:26] stack traceback:
[15/03/2024 08:26:26]     [C]: in function 'load'
[15/03/2024 08:26:27]     data/lib/012-table.lua:6: in function 'unserialize'
[15/03/2024 08:26:27]     data/talkactions/scripts/pollsystem.lua:39: in function 'getMostVotedOption'
[15/03/2024 08:26:27]     data/talkactions/scripts/pollsystem.lua:126: in function <data/talkactions/scripts/pollsystem.lua:52>

 

Link para o post
Compartilhar em outros sites
  • Muvukaa mudou o título para [RESOLVIDO] [SQLite] -=[TFS]=- [TALKACTION] - 0.4 8.60 Advanced Poll System AJUDA SOCORRO
  • Sub-Admin

Lib 

 

function table.unserialize(str)
    if(type(str) ~= 'string' or str:len() == 0) then
        return {}
    end

    return loadstring("return " .. str)()
end

 

20230912_034613.png.cf49b650c34dd7d7b1f79bd49c70f53c.png

Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código.  #OpenSource #Programação #Contribuição

 

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.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo