No wiec zrobiłem coś takiego:
Kod :
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('shitsurei shimasu')
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, 'hiho')
or msgcontains(msg, 'cze')
or msgcontains(msg, 'siema')
or msgcontains(msg, 'czesc')
or msgcontains(msg, 'elo')
or msgcontains(msg, 'dziendobry')
or msgcontains(msg, 'yo')
or msgcontains(msg, 'hello') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Witaj, ' .. getCreatureName(cid) .. '! Chcesz moze komus pomoc, a przy okazji zarbic co nie co? Jezeli tak to dobrze trafiles - pisz zadanie1, zadanie2 itd. aby otrzymac zadanie.')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi')
or msgcontains(msg, 'hiho')
or msgcontains(msg, 'cze')
or msgcontains(msg, 'siema')
or msgcontains(msg, 'czesc')
or msgcontains(msg, 'elo')
or msgcontains(msg, 'dziendobry')
or msgcontains(msg, 'yo')
or msgcontains(msg, 'hello') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Chwilke')
elseif focus == cid then
talk_start = os.clock()
elseif msgcontains(msg, 'misija1') or msgcontains(msg, 'misja 1') or msgcontains(msg, 'zadanie1') or msgcontains(msg, 'zadanie 1') or msgcontains(msg, 'quest1') or msgcontains(msg, 'quest 1') then
if getPlayerStorageValue(cid,1095) == 3 then
selfSay('Nie oszukuj, te misje mozna wykonac tylko raz!')
else
if getPlayerStorageValue(cid,1095) == 2 then
if doPlayerRemoveItem(cid,2217,1) == 0 then
selfSay('Czy aby na pewno pomogles kaziowi?')
else
selfSay('Wiec tego chcial Kaziu. Bardzo ubolewa strate zony, ale takie jest juz zycie shinobi, czasem jedna osoba musi sie poswiecic dla dobra ogolu. No nic, oto twoja nagroda')
doPlayerAddItem(cid,7845,1)
setPlayerStorageValue(cid,1095,3)
end
else
if getPlayerStorageValue(cid,1095) <= 1 then
selfSay('Idz do Kazia, slyszalem, ze potrzebuje pomocy!')
setPlayerStorageValue(cid,1095,2)
end
end
end
elseif msgcontains(msg, 'bye')
or msgcontains(msg, 'nara')
or msgcontains(msg, 'narx')
or msgcontains(msg, 'czesc')
or msgcontains(msg, 'elo')
or msgcontains(msg, 'goodbye')
or msgcontains(msg, 'bb') and getDistanceToCreature(cid) < 4 then
selfSay('shitsurei shimasu, ' .. getCreatureName(cid) .. ' san')
focus = 0
talk_start = 0
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('shitsurei shimasu!')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Zegnaj.')
focus = 0
end
end
end
Tylko dlaczego, gdy napisze do niego "misja1" lub cos w takiego, nie chce mi odpowiedziec: "Idz do Kazia, slyszalem, ze potrzebuje pomocy!"?
Mógł by ktoś go przerobić, aby było tak jak chce ?
Zakładki