Dark Magican
Senior User
- Joined
- Apr 13, 2009
- Messages
- 677
- Reaction score
- 42
Cze??. Potrafi?by kto?, przerobi? ten oto skrypt, tak aby by?a mo?liwo?? dawania kilku task?w w ofercie, a nie tylko jeden ?
Skrypt:
_/Regards.
Skrypt:
Code:
local focus = 0
local talk_start = 0
local target = 0
local config = {name="Demon", storage=1111, count=5, item=2160, itemct=10}
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
if(getPlayerStorageValue(cid, config.storage) <= 0)then
selfSay('Witaj ' .. creatureGetName(cid) .. '! Mialbym dla Ciebie drobne zadanie czy zgodzilbys sie je wykonac??')
focus = cid
talk_start = os.clock()
elseif(getPlayerStorageValue(cid, config.storage) == config.count+2)then
selfSay('Jestem Ci dozgonnie wdzieczny!')
elseif(getPlayerStorageValue(cid, config.storage) == config.count+1)then
selfSay('Wreszcie blogi spokoj dziekuje Ci bardzo oto twa nagroda!')
setPlayerStorageValue(cid, config.storage, config.count+2)
end
elseif(msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4)then
selfSay('Przepraszam, ' .. creatureGetName(cid) .. '! Teraz rozmawiam z kims innym.')
elseif focus == cid then
talk_start = os.clock()
if(msgcontains(msg, 'yes'))then
selfSay('Oh to dobrze od kilku dni neka mnie ' .. config.count .. ' potwotow ktore zwa ' .. config.name .. ' pozbadz sie ich a nagroda Cie nie minie.')
setPlayerStorageValue(cid, config.storage, 1)
focus = 0
talk_start = 0
elseif(msgcontains(msg, 'no'))then
selfSay('Trodno jakos sobie poradze. Zegnaj.')
focus = 0
talk_start = 0
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Bywaj, ' .. 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('Good bye then.')
focus = 0
end
end
end
_/Regards.