Ir para conteúdo
Entre para seguir isso  
Magus

Poll System (Sistema de Enquete)

Recommended Posts

Magus    2
Magus

--- Poll System ---

 

pollsysp.png

 

Gostou? Apenas clique no botão post_thanks.gif no final do tópico.

 

Nome do Sistema: Poll System

Versão: v3.0

Tipo: TalkAction

Requerimentos: SQL

 

Autor: Magus

Testado: The Forgotten Server v0.3.4 (Crying Damson)

Informações

 

Sistema de enquete in-game, com tempo e opções de resultados customizáveis. Disponível para MySQL e SQLite.

 

 

Features

 

  • Versão 3.0
  • Melhor estruturação
  • Opções de enquete podem usar vírgulas (identificador de opções mudado para "|")
  • !votepoll retorna a enquete e suas opções, para os jogadores que perderam o anúncio da enquete
  • !seepoll retorna também a data em que a enquete foi adicionada
  • Versão 2.0
  • Atualização de funções SQL
  • Versão 1.0
  • Interface em inglês
  • Vários comandos para o manuseio das enquetes
  • Comandos de manuseio limitados por group_id
  • Permissão de voto em apenas uma opção, votos limitados por account_id
  • Permitido rodar apenas uma enquete de cada vez
  • Uso de broadcastMessage (#b, em vermelho) para anúncio das enquetes, opções e resultados
  • Uso de GlobalStoragesValue (assegure-se que saveGlobalStorage está "no")
  • Arquivos PollSystem.sql e PollSystem.s3db para adicionar as tabelas necessárias

 

 

Comandos

 

  • !createpoll PERGUNTA?;Opção 1|Opção 2|Opção 3|ETC... - Adiciona a enquete e as opções no banco de dados. Um ID será gerado.
  • !activatepoll ID - Ativa a enquete de ID dado no parâmetro. Ativar a enquete significa anunciá-la no servidor.
  • !cancelpoll - Cancela uma enquete ativa. Se PollROptions não for 0, irá mostrar os resultados parciais.
  • !seepoll - Mostra as 10 últimas enquetes adicionadas, e quem a adicionou. Mostra também o ID de cada uma.
  • !seeresults ID - Mostra os resultados da enquete de ID dado no parâmetro.
  • !remvotes ID - Remove todos os resultados da enquete de ID dado no parâmetro.
  • !rempoll ID - Remove por completo a enquete de ID dado no parâmetro.
  • !votepoll Option - Quando uma enquete está ativa, esse é o comando que os jogadores irão utilizar para votar na opção desejada. O número de opções pode variar.

Os comandos em vermelho são comandos de gamemaster, e em verde comandos para todos.

 

Obs: Em alguns servidores, é necessária uma aspa na usagem do comando, ex: !activatepoll "ID

 

 

Instalação

 

Adicione as funções e tags abaixo nos arquivos respectivos.

 

(criar) PollSystem.lua, na pasta talkactions/scripts (ou clique aqui para baixar)

--[[
   Poll System v3.0 by Magus
   See changes on: http://forums.otserv.com.br/f232/poll-system-sistema-de-enquete-80706/
   Configure somethings below
-]]

PollSystem = {
   CONST_POLL_TIME = 120, --Tempo para votar na enquete (em segundos)
   CONST_POLL_ADM = 4, --Group_id mínimo necessário para manusear enquetes
   CONST_POLL_SHOWOPTIONS = 1, --0 = não mostrar resultados da enquete, 1 = mostrar resultados percentuais da enquete, 2 = mostrar resultados percentuais e reais da enquete
   CONST_POLL_FTIME = "%d/%m/%y, %H:%M" --Formato da data
}
PollSystem_mt = { __index = PollSystem }

function PollSystem:load()
   return setmetatable(PollSystem, PollSystem_mt)
end

function PollSystem:exists(id)
   local Query = db.getResult("SELECT * FROM `polls` WHERE `id` = " .. id)
   return Query:getID() ~= -1 and true or false
end

function PollSystem:getLastByName(name)
   local Query = db.getResult("SELECT `id` FROM `polls` WHERE `poll` = " .. db.escapeString(name) .. " ORDER BY `id` DESC LIMIT 1")
   return Query:getID() ~= -1 and Query:getDataInt("id") or 0
end

function PollSystem:getNamebyID(id)
   local Query = db.getResult("SELECT `poll` FROM `polls` WHERE `id` = " .. id)
   return Query:getID() ~= -1 and Query:getDataString("poll") or nil
end

function PollSystem:getOptionsTable(id)
   local Query = db.getResult("SELECT `options` FROM `polls` WHERE `id` = " .. id)
   return Query:getID() ~= -1 and string.explode(Query:getDataString("options"), "|") or {}
end

function PollSystem:getVotes(id)
   local Query = db.getResult("SELECT `votes` FROM `poll_votes` WHERE `poll_id` = " .. id)
   return Query:getID() ~= -1 and string.explode(Query:getDataString("votes"), ",") or -1
end

function PollSystem:getAll()
   local Query = db.getResult("SELECT * FROM `polls` ORDER BY `id` DESC LIMIT 0, 10")
   if(Query:getID() ~= -1) then
       local _i = {}
       local x = 1
       repeat
           _i[x] = {
               ID = Query:getDataInt("id"),
               PLAYER_ID = Query:getDataInt("player_id"),
               POLL = Query:getDataString("poll"),
               OPT = Query:getDataString("options"),
               TIME = os.date(self.CONST_POLL_FTIME, Query:getDataInt("timestamp"))
           }
           x = x+1
       until not Query:next()
       Query:free()
       return _i
   else
       return nil
   end
end

function PollSystem:create(cid, poll, options)
   return db.executeQuery("INSERT INTO `polls` (`player_id`, `poll`, `options`, `timestamp`) VALUES (" .. getPlayerGUID(cid) .. ", " .. db.escapeString(poll) .. ", " .. db.escapeString(options) .. ", " .. os.time() .. ")") or false
end

function PollSystem:remove(id)
   return db.executeQuery("DELETE FROM `polls` WHERE `id` = " .. id) or false
end

function PollSystem:remvotes(id)
   return db.executeQuery("DELETE FROM `poll_votes` WHERE `poll_id` = " .. id) or false
end

function PollSystem:addVote(cid, id, vote, optmax)
   local Query = db.getResult("SELECT * FROM `poll_votes` WHERE `poll_id` = " .. id)
   local PLAYER_GUID = getPlayerGUID(cid)
   if (Query:getID() ~= -1) then
       local Query = db.getResult("SELECT `account_id` FROM `poll_votes` WHERE `poll_id` = " .. id)
       local PLAYER_GUID_TABLE = string.explode(Query:getDataString("account_id"), ",")
       Query:free()
       if (isInArray(PLAYER_GUID_TABLE, PLAYER_GUID)) then
           return 1
       else
           local _tr = self:getVotes(id)
           _tr[vote] = _tr[vote]+1
           local votes = table.concat(_tr, ",")
           return db.executeQuery("UPDATE `poll_votes` SET `votes` = '" .. votes .. "', `account_id` = CONCAT(`account_id`,'" .. PLAYER_GUID .. ",') WHERE `poll_id` = " .. id) or false
       end
   else
       local votes = ""
       for i = 1, optmax do
           if (i == tonumber(vote)) then x = 1 else x = 0 end
           votes = votes .. x .. ","
       end
       local votes = string.sub(votes, 0, string.len(votes)-1)
       return db.executeQuery("INSERT INTO `poll_votes` (`poll_id`, `votes`, `account_id`) VALUES (" .. id .. ", '" .. votes .."', '" .. PLAYER_GUID .. ",')") or false
   end
end

function PollSystem:showResults(id, sopt, t)
   local sopt = sopt == nil and self.CONST_POLL_SHOWOPTIONS or sopt
   if (sopt ~= 0) then
       local _tr = self:getVotes(id)
       if (_tr ~= -1) then
           local _votes = 0
           for k,v in ipairs(_tr) do
               v = tonumber(v)
               if (isNumber(v)) then _votes = _votes + tonumber(v) end
           end
           local _opt = self:getOptionsTable(id)
           local results = ""
           local adt = ""
           for k,v in ipairs(_opt) do
               if (sopt == 2) then adt = " (" .. _tr[k] .. ")" end
               results = results .. "\"" .. v .. "\"".. adt.." (" .. math.floor((tonumber(_tr[k]) * 100) / _votes) .. "%)"
               if (k ~= #_opt) then results = results .. " - " end
           end
           if (t ~= 1) then return broadcastMessage("RESULTS: " .. results, MESSAGE_STATUS_CONSOLE_RED) else return results end
       else
           return nil
       end
   else
       return nil
   end
end

function onSay(cid, words, param)
   local Poll = PollSystem:load()

   if (words == "!createpoll") then
       if (getPlayerGroupId(cid) < Poll.CONST_POLL_ADM) then
           return FALSE
       else
           local str = string.explode(param, ";")
           local str = str == nil and {} or str
           if (str[1] == nil) or (str[2] == nil) or (string.match(str[2], "|(.+)$") == nil) then
               doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Syntax: !createpoll POLL QUESTION?;OPTION 1|OPTION 2|ETC... Minimum 2 options.")
           else
           Poll:create(cid, str[1], str[2])
           local _ID = Poll:getLastByName(str[1])
           doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Poll created successfully. It's ID is " .. _ID .. ". Save it.")
           end
           return TRUE
       end
   end

   if (words == "!activatepoll") then
       if (getPlayerGroupId(cid) < Poll.CONST_POLL_ADM) then
           return FALSE
       else
           if (getGlobalStorageValue(76557) ~= 1) then
               local param = tonumber(param)
               if (param == "") or (not isNumber(param)) or (param < 1) then
                   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Syntax: !activatepoll ID")
               else
                   if (Poll:exists(param)) then
                       local _opt = Poll:getOptionsTable(param)
                       setGlobalStorageValue(76557, 1)
                       setGlobalStorageValue(765572, #_opt)
                       setGlobalStorageValue(765573, param)
                       broadcastMessage("A poll has started!", MESSAGE_STATUS_WARNING)
                       local EventId = addEvent(function() EventId = addEvent(function() broadcastMessage("Options is:", MESSAGE_STATUS_CONSOLE_RED) for k,v in ipairs(_opt) do broadcastMessage("\"" .. v .. "\" - Use !votepoll " .. k .. "", MESSAGE_STATUS_CONSOLE_RED) end setGlobalStorageValue(765575, 1) EventId = addEvent(function() setGlobalStorageValue(76557, 0) setGlobalStorageValue(765575, 0) broadcastMessage("The poll has ended. Thanks for voting.", MESSAGE_STATUS_WARNING) Poll:showResults(param) end,Poll.CONST_POLL_TIME*1000,{Poll.CONST_POLL_TIME, param, _opt}) setGlobalStorageValue(765574, EventId) end, 5000, {_opt, Poll.CONST_POLL_TIME}) setGlobalStorageValue(765574, EventId) broadcastMessage("Poll: " .. Poll:getNamebyID(param), MESSAGE_STATUS_CONSOLE_RED) end, 3000, {Poll:getNamebyID(param)})
                       setGlobalStorageValue(765574, EventId)
                   else
                       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "A Poll with this ID was not found.")
                   end
               end
           else
               doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "A poll is already running.")
           end
           return TRUE
       end
   end

   if (words == "!seepoll") then
       if (getPlayerGroupId(cid) < Poll.CONST_POLL_ADM) then
           return FALSE
       else
           local _sp = Poll:getAll()
           if (_sp ~= nil) then
               doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Showing the lasts 10 polls.")
               _spn = 0
               for k,v in ipairs(_sp) do
                   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "ID: " .. v.ID .. " - Poll: " .. v.POLL .. " - Options: " .. v.OPT .. " - Made by: " .. getPlayerNameByGUID(v.PLAYER_ID) .. " - At: " .. v.TIME)
                   _spn = _spn + 1
               end
               doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, _spn .. " polls found.")
           else
                   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "0 polls found.")
           end
           return TRUE
       end
   end

   if (words == "!seeresults") then
       if (getPlayerGroupId(cid) < Poll.CONST_POLL_ADM) then
           return FALSE
       else
           local param = tonumber(param)
           if (param == "") or (not isNumber(param)) or (param < 1) then
               doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Syntax: !seeresults Poll ID")
           else
               results = Poll:showResults(param, 2, 1)
               if (results ~= nil) then
                   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Results of Poll ID " .. param .. ": " .. results)            
               else
                   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "No results for the Poll ID " .. param .. ".")
               end
           end
           return TRUE
       end
   end

   if (words == "!cancelpoll") then
       if (getPlayerGroupId(cid) < Poll.CONST_POLL_ADM) then
           return FALSE
       else
           if (getGlobalStorageValue(76557) == 1) then
               setGlobalStorageValue(76557, 0)
               stopEvent(getGlobalStorageValue(765574))
               broadcastMessage("The poll has been canceled by " .. getPlayerName(cid) .. ".", MESSAGE_STATUS_WARNING)
               Poll:showResults(getGlobalStorageValue(765573))
           else
               doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "A poll is not running.")
           end
           return TRUE
       end
   end

   if (words == "!rempoll") then
       if (getPlayerGroupId(cid) < Poll.CONST_POLL_ADM) then
           return FALSE
       else
           local param = tonumber(param)
           if (param == "") or (not isNumber(param)) or (param < 1) then
               doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Syntax: !rempoll ID")
           else
               if (Poll:exists(param)) then
                   if (Poll:remove(param)) then
                       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The poll with ID " .. param .. " was successfuly removed from the database.")
                   else
                       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "An error ocurred while trying to remove the poll with ID " .. param .. ".")
                   end
               else
                   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "A poll with this ID was not found.")
               end
           end
           return TRUE
       end
   end

   if (words == "!remvotes") then
       if (getPlayerGroupId(cid) < Poll.CONST_POLL_ADM) then
           return FALSE
       else
           local param = tonumber(param)
           if (param == "") or (not isNumber(param)) or (param < 1) then
               doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Syntax: !remvotes Poll ID")
           else
               if (Poll:exists(param)) then
                   if (Poll:remvotes(param)) then
                       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The votes of poll ID " .. param .. " was successfuly reseted.")
                   else
                       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "An error ocurred while trying to reset the votes of poll ID " .. param .. ".")
                   end
               else
                   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Votes for this poll ID was not found.")
               end
           end
           return TRUE
       end
   end

   if (words == "!votepoll") then
       if (getGlobalStorageValue(76557) == 1) then
           if (getGlobalStorageValue(765575) == 1) then
               local _optmax = getGlobalStorageValue(765572)
               local param = tonumber(param)
               local _ID = getGlobalStorageValue(765573)
               if (param == "") or (not isNumber(param)) or (param < 1) or (param > _optmax) then
                   _opt = Poll:getOptionsTable(_ID)
                   _poll = Poll:getNamebyID(_ID)
                   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Poll is: " .. _poll)
                   for k,v in ipairs(_opt) do
                       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Option " .. k .. " - \"" .. v .. "\"")
                   end
                   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Syntax: !votepoll OPTION")
               else
                   _addvote = Poll:addVote(cid, _ID, param, _optmax)
                   if (_addvote == 1) then
                       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You or one character of your account has already voted in this poll.")
                   else
                       if (_addvote ~= nil) then
                           doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your vote was successfully computed.")
                       else
                           doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "An error ocurred while trying to vote.")
                       end
                   end
               end
           else
               doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wait the options shows up.")
           end
       else
           doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "A poll is not running.")
       end
       return TRUE
   end
end

talkactions.xml, antes de </talkactions>

    <!-- pollsystem talkactions -->
   <talkaction words="!createpoll" event="script" value="PollSystem.lua"/>
   <talkaction words="!activatepoll" event="script" value="PollSystem.lua"/>
   <talkaction words="!cancelpoll" event="script" value="PollSystem.lua"/>
   <talkaction words="!seepoll" event="script" value="PollSystem.lua"/>
   <talkaction words="!seeresults" event="script" value="PollSystem.lua"/>
   <talkaction words="!remvotes" event="script" value="PollSystem.lua"/>
   <talkaction words="!rempoll" event="script" value="PollSystem.lua"/>
   <talkaction words="!votepoll" event="script" value="PollSystem.lua"/>

MySQL Query (clique aqui para baixar)

CREATE TABLE IF NOT EXISTS `polls` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `player_id` int(11) NOT NULL,
 `poll` varchar(255) NOT NULL,
 `options` varchar(255) NOT NULL,
 `timestamp` int(11) NOT NULL,
 PRIMARY KEY (`id`),
 FOREIGN KEY (`player_id`) REFERENCES `players` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci ROW_FORMAT=DYNAMIC AUTO_INCREMENT=1 ;

INSERT INTO `polls` (`player_id`, `poll`, `options`, `timestamp`) VALUES
(2, 'What about this Poll System?', 'Really good|Nice!|Huh?|Worst', UNIX_TIMESTAMP());

CREATE TABLE IF NOT EXISTS `poll_votes` (
 `poll_id` int(11) NOT NULL,
 `votes` varchar(255) NOT NULL,
 `account_id` varchar(255) NOT NULL,
 FOREIGN KEY (`poll_id`) REFERENCES `polls` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1

SQLite Query (clique aqui para baixar)

CREATE TABLE IF NOT EXISTS `polls` (
 `id` INTEGER PRIMARY KEY AUTOINCREMENT,
 `player_id` int(11) NOT NULL,
 `poll` varchar(255) NOT NULL,
 `options` varchar(255) NOT NULL,
 `timestamp` int(11) NOT NULL,
 FOREIGN KEY (`player_id`) REFERENCES `players` (`id`)
);

INSERT INTO `polls` (`player_id`, `poll`, `options`, `timestamp`) VALUES
(2, 'What about this Poll System?', 'Really good|Nice!|Huh?|Worst', strftime('%s','now'));

CREATE TABLE IF NOT EXISTS `poll_votes` (
 `poll_id` int(11) NOT NULL,
 `votes` varchar(255) NOT NULL,
 `account_id` varchar(255) NOT NULL,
 FOREIGN KEY (`poll_id`) REFERENCES `polls` (`id`) ON DELETE CASCADE
)

[spoiler=Versões Antigas]

Em versões de OTServ antigas, você precisará:

 

Instalar a classe abaixo:

 

Adicionar a função abaixo, no final de global.lua:

function string.explode(str, sep)
    local pos, t = 1, {}
    if #sep == 0 or #str == 0 then
        return
    end

    for s, e in function() return str:find(sep, pos) end do
        table.insert(t, str:sub(pos, s - 1):trim())
        pos = e + 1
    end

    table.insert(t, str:sub(pos):trim())
    return t
end

 

 

Executando a SQL Query

 

Se você usa MySQL, entre no phpMyAdmin e vá até o banco de dados do seu servidor. Clique em SQL (ao lado de Estrutura), cole o conteúdo de "MySQL Query" acima e clique em "Executar".

 

Se você usa SQLite, abra as tabelas do servidor na coluna esquerda. Clique em Tools > Open SQL query editor, cole o conteúdo de "SQLite Query" acima e aperte o botão "Execute query (F9)".

 

 

Download

Editado por Black Ice

Compartilhar este post


Link para o post
fabianobn    0
fabianobn

[Duvida]

 

Quando se fala no jogo: !votepoll "Option

 

Aparece as Options?

 

Obrigado!

Compartilhar este post


Link para o post
Magus    2
Magus

Atualizado para versão 2.0

 

@fabianobn

Quando você digita !votepoll ele informa quantas opções têm, mas não diz quais são. Só é dito uma vez, no anúncio.

Compartilhar este post


Link para o post
Shyzoul    0
Shyzoul

Aqui deu o seguinte erro:

 

[20/04/2009 19:59:00] Lua Script Error: [TalkAction Interface]

[20/04/2009 19:59:00] data/talkactions/scripts/PollSystem.lua:onSay

[20/04/2009 19:59:00] data/talkactions/scripts/PollSystem.lua:43: attempt to get length of local 'PollAcOptions' (a nil value)

[20/04/2009 19:59:00] stack traceback:

[20/04/2009 19:59:00] data/talkactions/scripts/PollSystem.lua:43: in function <data/talkactions/scripts/PollSystem.lua:6>

Compartilhar este post


Link para o post
Magus    2
Magus
Aqui deu o seguinte erro:

O code do fórum zuou um pouco o script, pega denovo lá ou baixa o arquivo PollSystem.lua e tenta denovo.

Compartilhar este post


Link para o post
Shyzoul    0
Shyzoul

Seguinte, não deu mais o erro;

 

mais quando fala !createpoll~

 

ele da o id e tudo mais, não amnda a broad mensagem pra todos nem se eu fale !activepoll~

 

E se o player vai vota aparece isso;

 

19:05 Wait the options shows up.

Compartilhar este post


Link para o post
Magus    2
Magus

Atualizado para versão 3.0

 

Mudanças:

 

  • Melhor estruturação
  • Opções de enquete podem usar vírgulas (identificador de opções mudado para "|")
  • !votepoll retorna a enquete e suas opções, para os jogadores que perderam o anúncio da enquete
  • !seepoll retorna também a data em que a enquete foi adicionada

Compartilhar este post


Link para o post
Seven Log    0
Seven Log

Uma Duvida ele nao encerra sozinho nao neah ? so fexa quando eu de end la neah fora isso...

Perfeito!! Vlw mesmo.Espero q de certo aki ^^

Vlw Flw 10

________

Edit: Ignora essa msg eu vi no script la e deu certinho no tfs 8.42 vlw

Editado por Seven Log

Compartilhar este post


Link para o post
Magus    2
Magus

Encerra sozinha sim, depois do tempo configurado em CONST_POLL_TIME não dá pra votar mais.

Compartilhar este post


Link para o post
MaximusZerk    0
MaximusZerk

Olá Magus,

 

Muito boa essa enquete e obrigado por compartilhar.

 

Em sqlite to tendo um probleminha com ela.

Ela funfa de boa, o povo vota, eh salvo na db e talz, mas na hora de mostrar o resultado, ela mostra 100% em uma opção, parece q ta sobreescrevendo os votos e qndo lê o resultado so mostra o ultimo voto la 100% em uma opção.

 

Pode me ajudar?

 

Eu uso o TFS 0.3.5/8.52

 

Abraços

Compartilhar este post


Link para o post
Llol    0
Llol

Cara muito bom msm so q quando eu falo !activatepoll n da tpw olha:

 

21:12 Poll created successfully. It's ID is 0. Save it.

21:12 Syntax: !activatepoll ID

 

Tpw vai ser assim:

 

!activatepoll 0?

 

 

Editado por Llol

Compartilhar este post


Link para o post
Iago Felipe    5
Iago Felipe

Cara, eu crio a enquente, ai se por exemplo tiver 3 caras onlines no servidor, o primeiro vai la e vota em sim, ai os outros dois conseguem votar só que o voto dos outros dois não contam, aparece a mensagem que salva o voto dele, só que depois que acaba a enquete, só tem 1 voto pra sim e fiac sim (100%), e não (0%), porque os outro dois não conseguiram votar, eles votaram, apareceu a mensagem que salvou o voto deles, só que não validou o não detectou ou não salvou o voto.

Compartilhar este post


Link para o post
Proviem    0
Proviem

isso funciona em 8.52?

Compartilhar este post


Link para o post
MaximusZerk    0
MaximusZerk
Cara, eu crio a enquente, ai se por exemplo tiver 3 caras onlines no servidor, o primeiro vai la e vota em sim, ai os outros dois conseguem votar só que o voto dos outros dois não contam, aparece a mensagem que salva o voto dele, só que depois que acaba a enquete, só tem 1 voto pra sim e fiac sim (100%), e não (0%), porque os outro dois não conseguiram votar, eles votaram, apareceu a mensagem que salvou o voto deles, só que não validou o não detectou ou não salvou o voto.

 

Eh eu achava q estava sobreescrevendo, mas na verdade depois do primeiro voto não pode mais votar. Essa enquete não eh democratica. >.<

 

To tendo mesmo problema tanto em sqlite qnto mysql ajuda ae Magus plx.

Compartilhar este post


Link para o post
subdark    0
subdark

Muito massa essa talkaction, vlws

Compartilhar este post


Link para o post
Magus    2
Magus

Fiz tem um tempo, talvez não funcione direito na versão de vcs.. qual é? 8.52?

Compartilhar este post


Link para o post
Limaozinho    0
Limaozinho

Adorei esse script, nunca tinha visto em nenhum servidor, ficou simplesmente perfeito, uma das talkactions mais bem pensadas que ja vi.

Compartilhar este post


Link para o post
MaximusZerk    0
MaximusZerk

Ela funcinou perfeito em mysql, mas sqlite deixa a desejar, abraços.

Compartilhar este post


Link para o post
Welkin Guide    0
Welkin Guide

Muito boa essa enquete e obrigado por compartilhar.

Gostei mesmo.

Compartilhar este post


Link para o post
Markim Bozi    0
Markim Bozi

Meus Parabéns , eu vou usar isso no meu otserv que esta quase acabando

obrigado

 

____________

MarkimBozi

Compartilhar este post


Link para o post
Visitante
Este tópico está impedido de receber novos posts.
Entre para seguir isso  
  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×