Ir para conteúdo

Featured Replies

Postado

Fala galera!

Eu estou com um script aqui, mas ele não está completo...

Gostaria que dps de ganhar a promote, ele voltar ao level 8 e voltar para o templo

alguem ajuda?

Spoiler

local keywordHandler = KeywordHandler:new() 
local npcHandler = NpcHandler:new(keywordHandler) 
NpcSystem.parseParameters(npcHandler) 
local talkState = {} 

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end 
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end 
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end 
function onThink() npcHandler:onThink() end 

function creatureSayCallback(cid, type, msg) 
if(not npcHandler:isFocused(cid)) then 
return false 
end 

local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid 

local price = 50000
local vocations = {5,6,7,8}

if(msgcontains(msg, 'valan') or msgcontains(msg, 'semi deus')) then 
selfSay('Você quer virar valan por '..price..' gps? {yes} ', cid) 
talkState[talkUser] = 1 
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then
if isInArray(vocations, getPlayerVocation(cid)) then  
if doPlayerRemoveMoney(cid,price) == TRUE then
setPlayerPromotionLevel(cid, 2)
selfSay('Parabens,você foi promovido para a Semi Deus!', cid) 
talkState[talkUser] = 0 
else 
selfSay('Você não tem ' .. price .. ' gps para virar valan', cid) 
talkState[talkUser] = 0 
end
else
selfSay('Desculpe, mas voce nao e promote.', cid) 
talkState[talkUser] = 0 
end
elseif msg == "no" and talkState[talkUser] >= 1 then 
selfSay("Then not", cid) 
talkState[talkUser] = 0 
npcHandler:releaseFocus(cid) 
end 
return TRUE 
end 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) 
npcHandler:addModule(FocusModule:new())

 

 

@Dwarfer

@KotZletY

@up

tumblr_o70wteR8521r9n6kzo1_400.gif

  • Respostas 18
  • Visualizações 469
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Errado, funcionou sim, porém precisa relogar, o que eu esqueci, haushaushuash. Atualizei! 

  • Nada de mais rlx. Atualizei, o erro é porque a forma de executar uma query é diferente, na versão 0.3, é db.executeQuery na 0.4 é db.Query, ou ao contrário sla, kkk. Agora vai! xD

  • @Yamborghini Tenso!!  xD uma coisa, depois outra, ae embola anterior. Kkkkkk   Atualizei. Huhaushaus    

Postado

@Yamborghini

Spoiler

local keywordHandler = KeywordHandler:new() 
local npcHandler = NpcHandler:new(keywordHandler) 
NpcSystem.parseParameters(npcHandler) 
local talkState = {} 

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end 
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end 
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end 
function onThink() npcHandler:onThink() end 

local c = {
price = 50000,
vocations = {1,6,7,8},
newlevel = 5, -- novo level, deixe 1, afinal o exp novo é 0, caso contrário vai ter que colocar o exp exato do level escolhido.
pos = {x=1026, y=920, z=7}, -- Pos do templo
tmp = 3 -- apos esses segundos ele desloga automaticamente.
}

function creatureSayCallback(cid, type, msg) 
if(not npcHandler:isFocused(cid)) then 
return false 
end 
local playerid = getPlayerGUID(cid)
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid 
local xp = getExperienceForLevel(c.newlevel)

if(msgcontains(msg, 'valan') or msgcontains(msg, 'semi deus')) then 
selfSay('Você quer virar valan por '..c.price..' gps? {yes} ', cid) 
talkState[talkUser] = 1 
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then
if isInArray(c.vocations, getPlayerVocation(cid)) then  
if doPlayerRemoveMoney(cid,c.price) == TRUE then 
db.query("UPDATE `players` SET `level`="..c.newlevel..",`experience`="..xp.." WHERE `players`.`id`= ".. playerid .."")
doPlayerSetPromotionLevel(cid, 2)
doTeleportThing(cid, c.pos)
doRemoveCreature(cid) 
db.query("UPDATE `players` SET `level`="..c.newlevel..",`experience`="..xp.." WHERE `players`.`id`= ".. playerid .."")
talkState[talkUser] = 0 
else 
selfSay('Você não tem ' .. c.price .. ' gps para virar valan', cid) 
talkState[talkUser] = 0 
end
else
selfSay('Desculpe, mas voce nao e promote.', cid) 
talkState[talkUser] = 0 
end
elseif msg == "no" and talkState[talkUser] >= 1 then 
selfSay("Then not", cid) 
talkState[talkUser] = 0 
npcHandler:releaseFocus(cid) 
end 
return TRUE 
end 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) 
npcHandler:addModule(FocusModule:new())

 

 

                                                              ezgif-1-98aab239f3.gif.1a897c9c3225228909e7b356a5cfb8e4.gif

Postado
  • Autor
31 minutos atrás, KotZletY disse:

@Yamborghini

  Ocultar conteúdo


local keywordHandler = KeywordHandler:new() 
local npcHandler = NpcHandler:new(keywordHandler) 
NpcSystem.parseParameters(npcHandler) 
local talkState = {} 

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end 
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end 
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end 
function onThink() npcHandler:onThink() end 

function creatureSayCallback(cid, type, msg) 
if(not npcHandler:isFocused(cid)) then 
return false 
end 

local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid 

local price = 50000
local vocations = {5,6,7,8}
local newlevel = 1 -- novo level, deixe 1, afinal o exp novo é 0, caso contrário vai ter que colocar o exp exato do level escolhido.
local playerid = getPlayerGUID(cid)
local pos = {x=000, y=000, z=0} -- Pos do templo

if(msgcontains(msg, 'valan') or msgcontains(msg, 'semi deus')) then 
selfSay('Você quer virar valan por '..price..' gps? {yes} ', cid) 
talkState[talkUser] = 1 
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then
if isInArray(vocations, getPlayerVocation(cid)) then  
if doPlayerRemoveMoney(cid,price) == TRUE then
setPlayerPromotionLevel(cid, 2)
db.executeQuery("UPDATE `players` SET `level`="..newlevel..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."")
doTeleportThing(cid, pos)
selfSay('Parabens,você foi promovido para a Semi Deus!', cid) 
talkState[talkUser] = 0 
else 
selfSay('Você não tem ' .. price .. ' gps para virar valan', cid) 
talkState[talkUser] = 0 
end
else
selfSay('Desculpe, mas voce nao e promote.', cid) 
talkState[talkUser] = 0 
end
elseif msg == "no" and talkState[talkUser] >= 1 then 
selfSay("Then not", cid) 
talkState[talkUser] = 0 
npcHandler:releaseFocus(cid) 
end 
return TRUE 
end 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) 
npcHandler:addModule(FocusModule:new())

 

 

Mas assim o player ao matar qualquer monstro, vai do level 1 ao level que fez a promote (no caso 200)

tumblr_o70wteR8521r9n6kzo1_400.gif

Postado
  • Autor
12 minutos atrás, KotZletY disse:

Atualizei o script acima, agora bote o level que desejar. 

 

 

não funcionou :( o player não foi teleportado e nem mudou de nivel, porém, o promote deu certo

 

EDIT: deu o seguinte erro>

Spoiler

[19:31:53.568] [Error - NpcScript Interface]
[19:31:53.568] data/npc/scripts/Zeus.lua:onCreatureSay
[19:31:53.584] Description:
[19:31:53.584] data/npc/scripts/Zeus.lua:31: attempt to call field 'executeQuery' (a nil value)
[19:31:53.599] stack traceback:
[19:31:53.615]  data/npc/scripts/Zeus.lua:31: in function 'callback'
[19:31:53.615]  data/npc/lib/npcsystem/npchandler.lua:390: in function 'onCreatureSay'
[19:31:53.630]  data/npc/scripts/Zeus.lua:8: in function <data/npc/scripts/Zeus.lua:8>

 

Editado por Yamborghini (veja o histórico de edições)

tumblr_o70wteR8521r9n6kzo1_400.gif

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.9k

Informação Importante

Confirmação de Termo