focus = 0
talk_start = 0
target = 0
following = false
attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
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('Hello ' .. creatureGetName(cid) .. '! I sell weapons and armors.Very cheap.That what You see here.')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. creatureGetName(cid) .. '! I will talk to you. Wait a moment.')
if msgcontains(msg, 'steel helmet') then
buy(cid,2457,1,500)
elseif msgcontains(msg, 'brass helmet') then
buy(cid,2460,1,100)
elseif msgcontains(msg, 'dark helmet') then
buy(cid,2490,1,800)
elseif msgcontains(msg, 'plate armor') then
buy(cid,2463,1,600)
elseif msgcontains(msg, 'brass armor') then
buy(cid,2465,1,250)
elseif msgcontains(msg, 'dark armor') then
buy(cid,2489,1,900)
elseif msgcontains(msg, 'plate legs') then
buy(cid,2647,1,700)
elseif msgcontains(msg, 'brass legs') then
buy(cid,2478,1,200)
elseif msgcontains(msg, 'boots of haste') then
buy(cid,2195,1,10000)
elseif msgcontains(msg, 'steel boots') then
buy(cid,2645,1,1000)
elseif msgcontains(msg, 'golden boots') then
buy(cid,2646,1,1000)
elseif msgcontains(msg, 'magic sword') then
buy(cid,2400,1,4000)
elseif msgcontains(msg, 'serpent sword') then
buy(cid,2409,1,5000)
elseif msgcontains(msg, 'katana') then
buy(cid,2412,1,4500)
elseif msgcontains(msg, 'broad sword') then
buy(cid,2413,1,4500)
elseif msgcontains(msg, 'apocalipsis') then
buy(cid,2438,1,7000)
elseif msgcontains(msg, 'giant sword') then
buy(cid,2393,1,6500)
elseif msgcontains(msg, 'fire sword') then
buy(cid,2392,1,7200)
elseif msgcontains(msg, 'magic long sword') then
buy(cid,2390,1,12000)
elseif msgcontains(msg, 'hatched lizard') then
buy(cid,3962,1,7000)
elseif msgcontains(msg, 'great halberd') then
buy(cid,2443,1,7250)
elseif msgcontains(msg, 'fire axe') then
buy(cid,2432,1,7250)
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('So go.')
focus = 0
end
end
end