--[[Desenvolvido por Skydangerous
--------- | / \ /
| | / \ /
| | / \/
|________ |/ |
| |\ |
| | \ |
| | \ |
---------| | \ |
]]--
local configs = {
level = 8,
price = 20,
premmy = false
}
local status = {
["vida"] = {qta = 20, tempo = 15},
["mana"] = {qta = 20, tempo = 15},
["velocidade"] = {qta = 20, tempo = 15}
}
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
------------------CONFIGURANDO -----------------------
if getPlayerMoney(cid) < configs.price then
return selfSay("Desculpe, voce precisa de "..configs.price.." gps.",cid)
end
if getPlayerLevel(cid) < configs.level then
return selfSay("Desculpe, voce precisa de "..configs.level.." level.",cid)
end
if not isPremium(cid) and configs.premmy then
return selfSay("Desculpe, só premium account.",cid)
end
--------------------Terminando------------------------
if(msgcontains(msg, 'list') or msgcontains(msg, 'list efect')) then
local str = ""
str = str .. "Eu vendo esses efeitos: "
for efect,qta in pairs(status) do
str = str.." {"..efect.."} = "..status[efect].qta..", quantidade"
end
str = str .. "."
npcHandler:say(str, cid)
elseif msg:lower() == "vida" then
if status[msg:lower()] then
selfSay("?", cid)
doPlayerRemoveMoney(cid, configs.price)
for i = 1, status[msg:lower()].tempo do
addEvent(doCreatureAddHealth, i*1000, cid, status[msg:lower()].qta)
end
elseif msg:lower() == "mana" then
if status[msg:lower()] then
selfSay("?", cid)
doPlayerRemoveMoney(cid, configs.price)
for i = 1, status[msg:lower()].tempo do
addEvent(doCreatureAddMana, i*1000, cid, status[msg:lower()].qta)
end
elseif msg:lower() == "velocidade" then
if status[msg:lower()] then
selfSay("?", cid)
doPlayerRemoveMoney(cid, configs.price)
for i = 1, status[msg:lower()].tempo do
addEvent(doChangeSpeed, i*1000, cid, status[msg:lower()].qta)
end
end
end
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Ele não está recuperando a vida, mana ou velocidade .. alguém sabe por quê?
Pergunta
SkyDangerous 395
Fiz esse npc para postar porém tem um bug
Ele não está recuperando a vida, mana ou velocidade .. alguém sabe por quê?
Link para o comentário
Compartilhar em outros sites
0 respostass a esta questão
Posts Recomendados