bruxo
Mirage Team
I need some help with my spells npcs xD.
I will say the bug, if he say light healing, he buy light , and he can buy the same spell 2x...
The script:
Srry by bad english.
I will say the bug, if he say light healing, he buy light , and he can buy the same spell 2x...
The script:
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Adeus.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and focus == 0) and getDistanceToCreature(cid) < 4 then
selfSay('Olá, eu sou o l?*der da Guilda dos Knights, você quer aprender alguma magia comigo?')
focus = cid
talk_state = 0
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Agora estou ocupado.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'sim') then
selfSay('Eu posso lhe ensinar muitas magias, se você for knight, é claro. Qual que você quer aprender? Não utilize espaços.')
talk_state = 1
vocation = getPlayerVocation(cid)
elseif msgcontains(msg, 'lighthealing') and talk_state == 1 then
if vocation == 4 then
if doPlayerRemoveMoney(cid,170) == 1 then
selfSay('Você aprendeu a magia, para usá-la fale exura.')
playerLearnInstantSpell(cid, 'light healing')
else
selfSay('Você não tem dinheiro.')
end
else
selfSay('Você tem que ser knight para aprender.')
end
elseif msgcontains(msg, 'light') and talk_state == 1 then
if vocation == 4 then
if doPlayerRemoveMoney(cid,100) == 1 then
selfSay('Você aprendeu a magia, para usá-la fale utevo lux.')
playerLearnInstantSpell(cid, 'light')
else
selfSay('Você não tem dinheiro.')
end
else
selfSay('Você tem que ser knight para aprender.')
end
elseif msgcontains(msg, 'findperson') and talk_state == 1 then
if vocation == 4 then
if doPlayerRemoveMoney(cid,80) == 1 then
selfSay('Você aprendeu a magia, para usá-la fale exiva "nome.')
playerLearnInstantSpell(cid, 'find person')
else
selfSay('Você não tem dinheiro.')
end
else
selfSay('Você tem que ser knight para aprender.')
end
elseif msgcontains(msg, 'antidote') and talk_state == 1 then
if vocation == 4 then
if doPlayerRemoveMoney(cid,150) == 1 then
selfSay('Você aprendeu a magia, para usá-la fale exana pox.')
playerLearnInstantSpell(cid, 'antidote')
else
selfSay('Você não tem dinheiro.')
end
else
selfSay('Você tem que ser knight para aprender.')
end
elseif msgcontains(msg, 'greatlight') and talk_state == 1 then
if vocation == 4 then
if doPlayerRemoveMoney(cid,500) == 1 then
selfSay('Você aprendeu a magia, para usá-la fale utevo gran lux.')
playerLearnInstantSpell(cid, 'great light')
else
selfSay('Você não tem dinheiro.')
end
else
selfSay('Você tem que ser knight para aprender.')
end
talk_state = 0
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Adeus!')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
doNpcSetCreatureFocus(focus)
if (os.clock() - talk_start) > 45 then
if focus > 0 then
selfSay('Próximo por favor.')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Vá.')
focus = 0
end
end
end
Srry by bad english.