• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Problem with npc 7.6

Monte321

Banned User
Joined
Jul 21, 2009
Messages
137
Reaction score
0
This is bug when i say bpsd

http://img31.imageshack.us/img31/451/beztytuumfp.png


script:

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)
local msg = string.lower(msg)

if msgcontains(msg, 'hi') and focus == 0 and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. creatureGetName(cid) .. '! I sell wands, rods and bp\'s of runes.')
focus = cid
talk_start = os.clock()

elseif msgcontains(msg, 'hi') and focus ~= cid and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')

elseif focus == cid then
talk_start = os.clock()

if msgcontains(msg, 'runes') then
selfSay('I sell bp\'s HMM (1,8K), UH (50k), GFB (60k), EXPLO (30k), SD (100k), manarune.')
elseif msgcontains(msg, 'wands') then
selfSay('I sell wand of inferno (15k), plague (5k), cosmic energy (10k), vortex (100gp) and dragonbreath (1000gp).')
elseif msgcontains(msg, 'rods') then
selfSay('I sell quagmire (10k), snakebite (100gp), tempest (15k), volcanic (5k) and moonlight rod (1000gp).')

elseif msgcontains(msg, 'inferno') then
buy(cid,2187,getCount(msg),15000)
elseif msgcontains(msg, 'plague') then
buy(cid,2188,getCount(msg),5000)
elseif msgcontains(msg, 'cosmic energy') then
buy(cid,2189,getCount(msg),10000)
elseif msgcontains(msg, 'vortex') then
buy(cid,2190,getCount(msg),100)
elseif msgcontains(msg, 'dragonbreath') then
buy(cid,2191,getCount(msg),1000)

elseif msgcontains(msg, 'quagmire') then
buy(cid,2181,getCount(msg),10000)
elseif msgcontains(msg, 'snakebite') then
buy(cid,2182,getCount(msg),100)
elseif msgcontains(msg, 'tempest') then
buy(cid,2183,getCount(msg),15000)
elseif msgcontains(msg, 'volcanic') then
buy(cid,2185,getCount(msg),5000)
elseif msgcontains(msg, 'moonlight') then
buy(cid,2186,getCount(msg),1000)

elseif msgcontains(msg, 'bpsd') or msgcontains(msg, 'sudden death') then
buyContainer(cid,2003,2268,100,100000)
elseif msgcontains(msg, 'bphmm') or msgcontains(msg, 'heavy magic') then
buyContainer(cid,2001,2311,100,30000)
elseif msgcontains(msg, 'bouh') or msgcontains(msg, 'ultimate healing') then
buyContainer(cid,2002,2273,100,50000)
elseif msgcontains(msg, 'bpgfb') or msgcontains(msg, 'great fireball') then
buyContainer(cid,2000,2304,100,30000)
elseif msgcontains(msg, 'bpexplo') or msgcontains(msg, 'explosion') then
buyContainer(cid,2001,2313,100,60000)
elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. 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
 
Back
Top