- Centrum Ots http://www.centrum-ots.pun.pl/index.php - Skrypty http://www.centrum-ots.pun.pl/viewforum.php?id=9 - 8.0+ NPC sprzedający Blessy! http://www.centrum-ots.pun.pl/viewtopic.php?id=34 |
wieczny - 2008-07-29 14:27:03 |
Spoiler: 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('Pa.') 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('Witaj ' .. getCreatureName(cid) .. ' Sprzedaje "5 blesow" 1 kosztuje 10.000.') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Przepraszam, ' .. getCreatureName(cid) .. '! ale rozmawiam z kims.') elseif focus == cid then talk_start = os.clock() elseif msgcontains(msg, '5 Blesow') then if pay(cid,10000) then selfSay('Dodalem Ci blessy.') doPlayerAddBlessing(cid, 5) else selfSay('Sorry, you do not have enough gold') bless_state = 0 end end end function onCreatureChangeOutfit(creature) end function onThink() if (os.clock() - talk_start) > 30 then if focus > 0 then selfSay('Nastepny Prosze') end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Pa.') focus = 0 end end end A potem w data/npc tworzymy plik o nazwie : Banor the blessed Kod:<npc name="Banor the blessed" script="data/npc/scripts/blessings.lua" autowalk="25" floorchange="0" access="5" level="1" maglevel="1"> <health now="150" max="150"/> <look type="129" head="114" body="119" legs="114" feet="114" corpse="2212"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|. I sell the five blessings (10k each), for each just say first bless, second bless, etc..." /> </parameters> </npc> Mam Nadzieje Że Pomogłem:P |