FL

[Encerrado] [Editar] Comando De Quizz

Por FlamesAdmin, 01 de dez. de 2013 em Tópicos Sem Resposta

resolvido
script
otserv
17
1.9k
01 de dezembro de 2013 às 06:48

Alguem podia editar esse comando de Quizz pra mim:

 

Script:

 

function onSay(cid, words, param)

if words == "!quiz" then

if getPlayerGroupId(cid) <= 5 then return false end
local t = string.explode(param, ",")
if not t[1] or not t[2] or not getItemNameById(tonumber(t[3])) or not tonumber(t[4]) or #t < 4 then
return doPlayerSendTextMessage(cid, 27, "Parametros incorreto, verifique o id do item e a quantidade : !quiz pergunta,resposta,premio,quantidade")
end
if getGlobalStorageValue(8745) == "evento" then
doPlayerSendTextMessage(cid, 27, "Uma pergunta ja esta em andamento, espere alguem acertar.")
end
doBroadcastMessage("EVENTO QUIZ: " .. t[1] .. "\nVALENDO: " .. tonumber(t[4]) .. "x " .. getItemNameById(tonumber(t[3])) .. "\nUtilize o comando !respquiz para responder.")
setGlobalStorageValue(8743, t[1])
setGlobalStorageValue(8744, t[2])
setGlobalStorageValue(8745, "evento")
setGlobalStorageValue(8746, tonumber(t[3]))
setGlobalStorageValue(8747, tonumber(t[4]))

elseif words == "!respquiz" then

if not param then
doPlayerSendTextMessage(cid, 27, "Parametros não encontrado: !respquiz resposta")
end
if getGlobalStorageValue(8745) ~= "evento" then
return doPlayerSendTextMessage(cid, 27, "Neste momento não existe nenhuma pergunta.")
end
local resposta = getGlobalStorageValue(8744)
if not tonumber(resposta) then
setGlobalStorageValue(8744, resposta:lower())
else
setGlobalStorageValue(8744, tonumber(resposta))
end
if not tonumber(param) then
param = param:lower()
else
param = tonumber(param)
end
if param == resposta then
doBroadcastMessage("PERGUNTA: " .. getGlobalStorageValue(8743) .. "\nRESPOSTA: " .. getGlobalStorageValue(8744) .. "\nVENCEDOR: " .. getCreatureName(cid) .. "\nPREMIO: " .. getGlobalStorageValue(8747) .. "x " .. getItemNameById(getGlobalStorageValue(8746)))
doPlayerSendTextMessage(cid, 27, "Parabéns você acertou a pergunta, aqui esta seu premio!")
doPlayerAddItem(cid, getGlobalStorageValue(8746), getGlobalStorageValue(8747))
for _, players in pairs(getPlayersOnline()) do
if getPlayerGroupId(cid) > 5 then
doPlayerSendTextMessage(player, 27, "O Player:" .. getCreatureName(cid) .. " acertou a pergunta.")
end
end
setGlobalStorageValue(8745, 0)
else
doPlayerSendTextMessage(cid, 27, "Resposta errada!")
end

end

return true
end

Gostaria que colocasse pra Tutor ( Group 3 ) e GOD ( Group 5 ) poder usar o comando.

Rep+

 

Creditos ao " xotservx "

Editado Dezembro 1 por FlamesAdmin

SoulvilingS
01 de dezembro de 2013 às 10:43

se for pelo talkaction, me envia a tag.

01 de dezembro de 2013 às 11:14

se for pelo talkaction, me envia a tag.

Ta ai:

<talkaction words="!quiz;!respquiz" script="quiz.lua" />
SoulvilingS
01 de dezembro de 2013 às 11:17
<talkaction words="!quiz;!respquiz"  access="3" script="quiz.lua" />

vê ai

01 de dezembro de 2013 às 18:45
<talkaction words="!quiz;!respquiz"  access="3" script="quiz.lua" />

vê ai

 

Nao deu.

SoulvilingS
01 de dezembro de 2013 às 18:46

qual erro? Tentou com a conta de player normal?

01 de dezembro de 2013 às 19:13

Sim, nao funcionou. Nao da erro nenhum, simplesmente o ele fala normalmente o comando

zipter98Z
01 de dezembro de 2013 às 19:14

Resumindo: você quer apenas que pessoas do group id 3 em diante, possam realizar o comando? Ou que apenas tutores e GODs possam? E qual dos comandos? !quiz ou !respquiz?

Editado Dezembro 1 por zipter98

01 de dezembro de 2013 às 19:17

Resumindo: você quer apenas que pessoas do group id 3 em diante, possam realizar o comando? Ou que apenas tutores e GODs possam? E qual dos comandos? !quiz ou !respquiz?

Apenas Tutor (3) e ADM (6) podem executar o comando !quiz, e os players respondam com !respquiz

zipter98Z
01 de dezembro de 2013 às 19:31

Tenta assim:

 

 

function onSay(cid, words, param)
 
    if words == "!quiz" then
 
        if getPlayerGroupId(cid) <= 2 or (getPlayerGroupId(cid) >= 4 and getPlayerGroupId(cid) <= 5) then
            return doPlayerSendCancel(cid, "Só tutores e GODs podem usar esse comando!")
        end
        
        local t = string.explode(param, ",")
        if not t[1] or not t[2] or not getItemNameById(tonumber(t[3])) or not tonumber(t[4]) or #t < 4 then
            return doPlayerSendTextMessage(cid, 27, "Parametros incorreto, verifique o id do item e a quantidade : !quiz pergunta,resposta,premio,quantidade")
        end
        if getGlobalStorageValue(8745) == "evento" then
            doPlayerSendTextMessage(cid, 27, "Uma pergunta ja esta em andamento, espere alguem acertar.")
        end
        doBroadcastMessage("EVENTO QUIZ: " .. t[1] .. "\nVALENDO: " .. tonumber(t[4]) .. "x " .. getItemNameById(tonumber(t[3])) .. "\nUtilize o comando !respquiz para responder.")
        setGlobalStorageValue(8743, t[1])
        setGlobalStorageValue(8744, t[2])
        setGlobalStorageValue(8745, "evento")
        setGlobalStorageValue(8746, tonumber(t[3]))
        setGlobalStorageValue(8747, tonumber(t[4]))
 
    elseif words == "!respquiz" then
 
        if not param then
            doPlayerSendTextMessage(cid, 27, "Parametros não encontrado: !respquiz resposta")
        end
        if getGlobalStorageValue(8745) ~= "evento" then
            return doPlayerSendTextMessage(cid, 27, "Neste momento não existe nenhuma pergunta.")
        end
        local resposta = getGlobalStorageValue(8744)
        if not tonumber(resposta) then
            setGlobalStorageValue(8744, resposta:lower())
        else
            setGlobalStorageValue(8744, tonumber(resposta))
        end
        if not tonumber(param) then
            param = param:lower()
        else
            param = tonumber(param)
        end
        if param == resposta then
            doBroadcastMessage("PERGUNTA: " .. getGlobalStorageValue(8743) .. "\nRESPOSTA: " .. getGlobalStorageValue(8744) .. "\nVENCEDOR: " .. getCreatureName(cid) .. "\nPREMIO: " .. getGlobalStorageValue(8747) .. "x " .. getItemNameById(getGlobalStorageValue(8746)))
            doPlayerSendTextMessage(cid, 27, "Parabéns você acertou a pergunta, aqui esta seu premio!")
            doPlayerAddItem(cid, getGlobalStorageValue(8746), getGlobalStorageValue(8747))
            for _, players in pairs(getPlayersOnline()) do
                if getPlayerGroupId(cid) > 5 then
                    doPlayerSendTextMessage(player, 27, "O Player:" .. getCreatureName(cid) .. " acertou a pergunta.")
                end
            end
            setGlobalStorageValue(8745, 0)
        else
            doPlayerSendTextMessage(cid, 27, "Resposta errada!")
        end
 
    end
 
    return true
end

01 de dezembro de 2013 às 19:51

 

Tenta assim:

 

 

function onSay(cid, words, param)
 
    if words == "!quiz" then
 
        if getPlayerGroupId(cid) <= 2 or (getPlayerGroupId(cid) >= 4 and getPlayerGroupId(cid) <= 5) then
            return doPlayerSendCancel(cid, "Só tutores e GODs podem usar esse comando!")
        end
        
        local t = string.explode(param, ",")
        if not t[1] or not t[2] or not getItemNameById(tonumber(t[3])) or not tonumber(t[4]) or #t < 4 then
            return doPlayerSendTextMessage(cid, 27, "Parametros incorreto, verifique o id do item e a quantidade : !quiz pergunta,resposta,premio,quantidade")
        end
        if getGlobalStorageValue(8745) == "evento" then
            doPlayerSendTextMessage(cid, 27, "Uma pergunta ja esta em andamento, espere alguem acertar.")
        end
        doBroadcastMessage("EVENTO QUIZ: " .. t[1] .. "\nVALENDO: " .. tonumber(t[4]) .. "x " .. getItemNameById(tonumber(t[3])) .. "\nUtilize o comando !respquiz para responder.")
        setGlobalStorageValue(8743, t[1])
        setGlobalStorageValue(8744, t[2])
        setGlobalStorageValue(8745, "evento")
        setGlobalStorageValue(8746, tonumber(t[3]))
        setGlobalStorageValue(8747, tonumber(t[4]))
 
    elseif words == "!respquiz" then
 
        if not param then
            doPlayerSendTextMessage(cid, 27, "Parametros não encontrado: !respquiz resposta")
        end
        if getGlobalStorageValue(8745) ~= "evento" then
            return doPlayerSendTextMessage(cid, 27, "Neste momento não existe nenhuma pergunta.")
        end
        local resposta = getGlobalStorageValue(8744)
        if not tonumber(resposta) then
            setGlobalStorageValue(8744, resposta:lower())
        else
            setGlobalStorageValue(8744, tonumber(resposta))
        end
        if not tonumber(param) then
            param = param:lower()
        else
            param = tonumber(param)
        end
        if param == resposta then
            doBroadcastMessage("PERGUNTA: " .. getGlobalStorageValue(8743) .. "\nRESPOSTA: " .. getGlobalStorageValue(8744) .. "\nVENCEDOR: " .. getCreatureName(cid) .. "\nPREMIO: " .. getGlobalStorageValue(8747) .. "x " .. getItemNameById(getGlobalStorageValue(8746)))
            doPlayerSendTextMessage(cid, 27, "Parabéns você acertou a pergunta, aqui esta seu premio!")
            doPlayerAddItem(cid, getGlobalStorageValue(8746), getGlobalStorageValue(8747))
            for _, players in pairs(getPlayersOnline()) do
                if getPlayerGroupId(cid) > 5 then
                    doPlayerSendTextMessage(player, 27, "O Player:" .. getCreatureName(cid) .. " acertou a pergunta.")
                end
            end
            setGlobalStorageValue(8745, 0)
        else
            doPlayerSendTextMessage(cid, 27, "Resposta errada!")
        end
 
    end
 
    return true
end

 

Player normal ta dando pra usar o comando.

Nao tem que mudar essa parte aqui em baixo ?

for _, players in pairs(getPlayersOnline()) do
                if getPlayerGroupId(cid) > 5 then
zipter98Z
01 de dezembro de 2013 às 19:51

Lol, que estranho o.O

Vou testar essa talkaction aqui, logo edito meu comentário.

 

EDIT: Aqui funcionou perfeitamente, só tutores e GODs podendo usar o comando. Talvez você tenha adicionado alguma parte desse script erroneamente, ou, em seu servidor, não há determinada função usada nessa talkaction.

Editado Dezembro 1 por zipter98

01 de dezembro de 2013 às 19:52

Lol, que estranho o.O

Vou testar essa talkaction aqui, logo edito meu comentário.

Ok.

 

 

---EDIT--

Affs que Fail, o outro player que eu tava testando era Tutor tbm pqp, desculpa erro meu.

Editado Dezembro 1 por FlamesAdmin

zipter98Z
01 de dezembro de 2013 às 19:59

edit: uhahuauhshuahus, de boa. De resto, o script está funcionando como você queria?

Editado Dezembro 1 por zipter98

01 de dezembro de 2013 às 20:06

Eu testei com essa tag:

<talkaction words="!quiz;!respquiz" event="script" value="quiz.lua"/>

A verificação do group id do jogador, já é feito no próprio script. Só não entendi o porque de não ter funcionado com você.

Funcionou aqui, tava testanto com players tutores, tinha eskecido que o outro player na acc era tutor tbm, vlw ai pela ajuda man. Ja dei rep+ pra tu.

edit: uhahuauhshuahus, de boa. De resto, o script está funcionando como você queria?

Ta sim vlw.