se for pelo talkaction, me envia a tag.
- Fórum
- OTServ
- Suporte
- Tópicos Sem Resposta
- [Encerrado] [Editar] Comando De Quizz
[Encerrado] [Editar] Comando De Quizz
Por FlamesAdmin, 01 de dez. de 2013 em Tópicos Sem Resposta
info
Grupo: Visconde
Registrado: 18/01/13
Posts: 319
Reputação: +66
Gênero: Masculino

info
Grupo: Infante
Registrado: 28/01/12
Posts: 1.6k
Reputação: +262
Gênero: Masculino

se for pelo talkaction, me envia a tag.
Ta ai:
<talkaction words="!quiz;!respquiz" script="quiz.lua" />
info
Grupo: Visconde
Registrado: 18/01/13
Posts: 319
Reputação: +66
Gênero: Masculino

<talkaction words="!quiz;!respquiz" access="3" script="quiz.lua" />
vê ai
info
Grupo: Infante
Registrado: 28/01/12
Posts: 1.6k
Reputação: +262
Gênero: Masculino

<talkaction words="!quiz;!respquiz" access="3" script="quiz.lua" />vê ai
Nao deu.
info
Grupo: Visconde
Registrado: 18/01/13
Posts: 319
Reputação: +66
Gênero: Masculino

qual erro? Tentou com a conta de player normal?
info
Grupo: Infante
Registrado: 28/01/12
Posts: 1.6k
Reputação: +262
Gênero: Masculino

Sim, nao funcionou. Nao da erro nenhum, simplesmente o ele fala normalmente o comando
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
info
Grupo: Infante
Registrado: 28/01/12
Posts: 1.6k
Reputação: +262
Gênero: Masculino

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
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
info
Grupo: Infante
Registrado: 28/01/12
Posts: 1.6k
Reputação: +262
Gênero: Masculino

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
Lol, que estranho ![]()
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
info
Grupo: Infante
Registrado: 28/01/12
Posts: 1.6k
Reputação: +262
Gênero: Masculino

Lol, que estranho
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
edit: uhahuauhshuahus, de boa. De resto, o script está funcionando como você queria?
Editado Dezembro 1 por zipter98
info
Grupo: Infante
Registrado: 28/01/12
Posts: 1.6k
Reputação: +262
Gênero: Masculino

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.




info
Grupo: Infante
Registrado: 28/01/12
Posts: 1.6k
Reputação: +262
Gênero: Masculino
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