Npc Hunt por Item

deviletico
em Scripts

deviletico

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 27/07/12Posts: 11

Olá galera tudo bom, tenho uma duvida com esse script Npc Hunt, eu precisso q emveiz de remover money sea um Item, obrigado pela atencao

 

 

ta ae o topico del script

http://www.xtibia.com/forum/topic/187179-npc-hunt/

 

 

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)
local pos = {x=1039, y=1072, z=7} -- Local da hunt
local posreturn = {x=1039, y=1072, z=7} -- Posiçao onde o player sera teleportado quando acabar o tempo

local money = 400000 --- Quanto de dinheiro sera removido


config = {
time = 10 ---Tempo que ele vai ficar na hunt sabendo que cada numeral equivale a um minuto-----

}

function doReturnPos()
doTeleportThing(cid, posreturn)
setGlobalStorageValue(24688, 0)
setGlobalStorageValue(24686, none)
setPlayerStorageValue(cid, 28680, 0)
end

if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

if msgcontains(msg, 'hunt') then
if getGlobalStorageValue(24688) == 1 then
doPlayerSendTextMessage(cid,22,"O player "..getGlobalStorageValue(24686).." esta na hunt")
return true
end
if not doPlayerRemoveMoney(cid, money) then
doPlayerSendTextMessage(cid,22,""..getPlayerName(cid).." precisa de "..money.." para usar a hunt paga")
return true
end
doPlayerRemoveMoney(cid, money)
doPlayerSendTextMessage(cid,22,"Obrigado "..getPlayerName(cid).." foi teleportado.")
doTeleportThing(cid, pos)
setGlobalStorageValue(24688, 1)
setGlobalStorageValue(24686, getPlayerName(cid))
setPlayerStorageValue(cid, 28680, 1)
addEvent(doReturnPos, config.time*60*1000)
else
selfSay('Diga Hunt', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

RigBy

Katrina? Romero Brito?
avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 05/02/14Posts: 411Gênero: MasculinoChar no Tibia: Zeh Sergipano

Testa assim:

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)
local pos = {x=1039, y=1072, z=7} -- Local da hunt
local posreturn = {x=1039, y=1072, z=7} -- Posiçao onde o player sera teleportado quando acabar o tempo
local itemid = 2160 -- item que sera removido
local quantidade = 1 -- quantidade
 
 
config = {
time = 10 ---Tempo que ele vai ficar na hunt sabendo que cada numeral equivale a um minuto-----
 
}
 
function doReturnPos()
doTeleportThing(cid, posreturn)
setGlobalStorageValue(24688, 0)
setGlobalStorageValue(24686, none)
setPlayerStorageValue(cid, 28680, 0)
end
 
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
 
if msgcontains(msg, 'hunt') then
if getGlobalStorageValue(24688) == 1 then
doPlayerSendTextMessage(cid,22,"O player "..getGlobalStorageValue(24686).." esta na hunt")
return true
end
if not doPlayerRemoveItem(cid, itemid, quantidade) then
doPlayerSendTextMessage(cid,22,""..getPlayerName(cid)..", voce precisa do "..itemid.." para usar a hunt paga")
return true
end
doPlayerRemoveItem(cid, itemid, quantidade)
doPlayerSendTextMessage(cid,22,"Obrigado "..getPlayerName(cid).." foi teleportado.")
doTeleportThing(cid, pos)
setGlobalStorageValue(24688, 1)
setGlobalStorageValue(24686, getPlayerName(cid))
setPlayerStorageValue(cid, 28680, 1)
addEvent(doReturnPos, config.time*60*1000)
else
selfSay('Diga Hunt', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())



DXBXk1i.gif

deviletico

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 27/07/12Posts: 11

 

Testa assim:

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)
local pos = {x=1039, y=1072, z=7} -- Local da hunt
local posreturn = {x=1039, y=1072, z=7} -- Posiçao onde o player sera teleportado quando acabar o tempo
local itemid = 2160 -- item que sera removido
local quantidade = 1 -- quantidade
 
 
config = {
time = 10 ---Tempo que ele vai ficar na hunt sabendo que cada numeral equivale a um minuto-----
 
}
 
function doReturnPos()
doTeleportThing(cid, posreturn)
setGlobalStorageValue(24688, 0)
setGlobalStorageValue(24686, none)
setPlayerStorageValue(cid, 28680, 0)
end
 
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
 
if msgcontains(msg, 'hunt') then
if getGlobalStorageValue(24688) == 1 then
doPlayerSendTextMessage(cid,22,"O player "..getGlobalStorageValue(24686).." esta na hunt")
return true
end
if not doPlayerRemoveItem(cid, itemid, quantidade) then
doPlayerSendTextMessage(cid,22,""..getPlayerName(cid)..", voce precisa do "..itemid.." para usar a hunt paga")
return true
end
doPlayerRemoveItem(cid, itemid, quantidade)
doPlayerSendTextMessage(cid,22,"Obrigado "..getPlayerName(cid).." foi teleportado.")
doTeleportThing(cid, pos)
setGlobalStorageValue(24688, 1)
setGlobalStorageValue(24686, getPlayerName(cid))
setPlayerStorageValue(cid, 28680, 1)
addEvent(doReturnPos, config.time*60*1000)
else
selfSay('Diga Hunt', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Oi bro testei e funfo obrigado pelo ajuda +rep

zipter98

avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 20/09/12Posts: 2553Gênero: Masculino

Tópico movido para a seção de dúvidas e pedidos resolvidos.

Não respondo PMs solicitando suporte. Já existem seções no fórum para isto.