Ir para conteúdo

Featured Replies

  • Respostas 18
  • Visualizações 450
  • 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 = {5,6,7,8},
newlevel = 8, -- novo level, deixe 1, afinal o exp novo é 0, caso contrário vai ter que colocar o exp exato do level escolhido.
pos = {x=723, y=599, z=7}, -- Pos do templo
tmp = 3 -- apos esses segundos ele desloga automaticamente.
}

local hp = 185
local mp = 35

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 
setCreatureMaxHealth(cid, hp)
setCreatureMaxMana(cid, mp)
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())

 

 

Contato:

 

Postado
  • Autor
Em 19/09/2017 em 18:03, Dwarfer disse:

@Yamborghini

 

  Mostrar conteúdo oculto


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 = {5,6,7,8},
newlevel = 8, -- novo level, deixe 1, afinal o exp novo é 0, caso contrário vai ter que colocar o exp exato do level escolhido.
pos = {x=723, y=599, z=7}, -- Pos do templo
tmp = 3 -- apos esses segundos ele desloga automaticamente.
}

local hp = 185
local mp = 35

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 
setCreatureMaxHealth(cid, hp)
setCreatureMaxMana(cid, mp)
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())

 

 

 

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

tumblr_o70wteR8521r9n6kzo1_400.gif

  • 4 months later...
Postado
  • Autor
Em 19/09/2017 em 18:03, Dwarfer 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 
local c = {
price = 50000,
vocations = {5,6,7,8},
newlevel = 8, -- novo level, deixe 1, afinal o exp novo é 0, caso contrário vai ter que colocar o exp exato do level escolhido.
pos = {x=723, y=599, z=7}, -- Pos do templo
tmp = 3 -- apos esses segundos ele desloga automaticamente.
}

local hp = 185
local mp = 35

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 
setCreatureMaxHealth(cid, hp)
setCreatureMaxMana(cid, mp)
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())

 

 

 

O player não está voltando com 185 de Hp e 35 de mana!

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.7k

Informação Importante

Confirmação de Termo