dtmasterdt
Active User
- Joined
- Dec 19, 2009
- Messages
- 105
- Reaction score
- 1
Daj? npc'ta kt?ry odblokuje nam level za 10g By Me !
W Data/Npc tworzymy bug level.xml a w nim
Teraz wchodzimy w Data/Npc/Scripts tam tworzymy bug level.lua a w nim
W Data/Npc tworzymy bug level.xml a w nim
PHP:
<npc name="Bug Level" script="data/npc/scripts/bug level.lua" autowalk="25" floorchange="0" access="5" level="1" maglevel="1">
<health now="150" max="150"/>
<look type="75" head="132" body="79" legs="97" feet="132" corpse="2212"/>
</npc>
PHP:
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('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('Czesc, ' .. getCreatureName(cid) .. '! Chcesz odblokowac level za 10g?.')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'yes') then
if doPlayerRemoveItem(cid,2160,10) == 0 then
selfSay('Sorry, you not have 10 gold.')
else
selfSay('Odblokowales level!.')
addLevel(cid,1)
end
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. getCreatureName(cid) .. ' wpadaj czesciej!')
focus = 0
talk_start = 0
end
end
end
function onThink()
doNpcSetCreatureFocus(focus)
if (os.clock() - talk_start) > 45 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Dzieki, wpadaj czesciej.')
focus = 0
end
end
end