local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
local id = {5889, 2344, 2346, 2348, 8979, 5884, 5886, 5945, 5887, 5888, 5947, 5950, 5953}
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Narazie.')
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') or msgcontains(msg, 'witaj')) and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Witaj, ' .. getCreatureName(cid) .. '! Jezeli przyniesies mi niektore rzeczy i powiedz \'golden boots\' dam ci je za te rzeczy.')
talk_start = os.clock()
focus = cid
elseif (msgcontains(msg, 'hi') or msgcontains(msg, 'witaj')) and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Przepraszam, ' .. getCreatureName(cid) .. '! Porozmawiam z toba za chwile.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'golden boots') then
if ((getPlayerItemCount(cid,5889) >= 1) and (getPlayerItemCount(cid,2344) >= 1) and (getPlayerItemCount(cid,2346) >= 1) and (getPlayerItemCount(cid,2348) >= 1) and (getPlayerItemCount(cid,8979) >= 1) and (getPlayerItemCount(cid,5884) >= 1) and (getPlayerItemCount(cid,5886) >= 1) and (getPlayerItemCount(cid,5945) >= 1) and (getPlayerItemCount(cid,5887) >= 1) and (getPlayerItemCount(cid,5888) >= 1) and (getPlayerItemCount(cid,5947) >= 1) and (getPlayerItemCount(cid,5950) >= 1) and (getPlayerItemCount(cid,5953) >= 1)) then
doPlayerAddItem(cid,9004,1)
for i=1, #id do
doPlayerRemoveItem(cid,id[i],1)
end
selfSay('Dzieki za te rzeczy. Oto twoje golden boots.')
else
selfSay('Musisz przyniesc mi: xxx; zeby otrzymac golden boots.')
end
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Nara, ' .. getCreatureName(cid) .. '! Zobaczymy sie pozniej')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
end